This repository has been archived by the owner on Jan 24, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
531 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package nixbuild | ||
|
||
import ( | ||
"embly/pkg/config" | ||
"embly/pkg/tester" | ||
"fmt" | ||
"os" | ||
"testing" | ||
"time" | ||
) | ||
|
||
func TestClientServer(te *testing.T) { | ||
t := tester.New(te) | ||
if os.Getenv("NIXBUILD_INTEGRATION_TEST") == "" { | ||
t.Skip() | ||
return | ||
} | ||
|
||
cfg, err := config.New("../../examples/kv") | ||
if err != nil { | ||
return | ||
} | ||
|
||
builder, err := NewBuilder(BuildConfig{}) | ||
t.PanicOnErr(err) | ||
builder.SetProject(cfg) | ||
|
||
go func() { | ||
if err := builder.startServer(); err != nil { | ||
t.Fatal(err) | ||
} | ||
}() | ||
time.Sleep(time.Second) | ||
t.PanicOnErr(builder.connectToBuildServer()) | ||
result, err := builder.startRemoteBuild("main") | ||
fmt.Println(result) | ||
t.PanicOnErr(err) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1 @@ | ||
package nixbuild | ||
|
||
type Client struct { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,43 @@ | ||
syntax = "proto3"; | ||
package nixbuildpb; | ||
|
||
|
||
message ClientPayload { | ||
Build build = 1; | ||
Build build = 1; | ||
CompressedFile file = 2; | ||
} | ||
|
||
bytes zip = 2; | ||
message CompressedFile { | ||
bytes body = 1; | ||
string name = 2; | ||
bytes requested_hash = 3; | ||
string path = 4; | ||
} | ||
|
||
message ServerPayload { | ||
repeated OutFile files = 1; | ||
repeated bytes hash_needed = 2; | ||
repeated CompressedFile files = 1; | ||
repeated HashRequest hash_needed = 2; | ||
repeated string log = 3; | ||
} | ||
|
||
message OutFile { | ||
string name = 1; | ||
bytes body = 2; | ||
message HashRequest { | ||
bytes hash = 1; | ||
string path = 2; | ||
} | ||
|
||
message Build { | ||
string name = 1; | ||
repeated File files = 2; | ||
string build_location = 3; | ||
string name = 1; | ||
repeated File files = 2; | ||
string build_location = 3; | ||
} | ||
|
||
message File { | ||
string path = 1; | ||
string name = 2; | ||
bool is_dir = 3; | ||
int64 size = 4; | ||
bytes hash = 5; | ||
string path = 1; | ||
string name = 2; | ||
bool is_dir = 3; | ||
int64 size = 4; | ||
bytes hash = 5; | ||
} | ||
|
||
service BuildService { | ||
rpc Build(stream ClientPayload) returns (stream ServerPayload); | ||
} | ||
rpc Build(stream ClientPayload) returns (stream ServerPayload); | ||
} |
Oops, something went wrong.