[infra][ftx] Use LUCIEXE_FAKEBUILD instead of binary proto for testing
Change-Id: I19cdbee64d57dbbbedadbd1d4528affb85da7261
Reviewed-on: https://fuchsia-review.googlesource.com/c/infra/infra/+/862245
Commit-Queue: Rahul Bangar <rahulbn@google.com>
Reviewed-by: Vinicius Felizardo <felizardo@google.com>
diff --git a/cmd/ftxtest/gen.sh b/cmd/ftxtest/gen.sh
index 4e2f78e..a3e60cd 100755
--- a/cmd/ftxtest/gen.sh
+++ b/cmd/ftxtest/gen.sh
@@ -2,5 +2,3 @@
# module=PREFIX is needed to strip PREFIX off of go_package specified in .proto file
protoc --go_out=. --go_opt=module=go.fuchsia.dev/infra/cmd/ftxtest proto/input.proto
-# Write a binary protobuf message for tests
-protoc --encode=InputProperties proto/input.proto <test/input.textproto >test/input.pb
diff --git a/cmd/ftxtest/main.go b/cmd/ftxtest/main.go
index c231598..8833e69 100644
--- a/cmd/ftxtest/main.go
+++ b/cmd/ftxtest/main.go
@@ -14,6 +14,11 @@
var writeOutputProps func(*any.Any)
build.Main(input, &writeOutputProps, nil, func(ctx context.Context, extraArgs []string, state *build.State) error {
fmt.Printf("Build started with args: %v\n", extraArgs)
- return nil // Mark the build as success
+ return processInput(ctx, input)
})
}
+
+func processInput(ctx context.Context, input *ftxproto.InputProperties) error {
+ fmt.Printf("Build input: %+v\n", input)
+ return nil
+}
diff --git a/cmd/ftxtest/run.sh b/cmd/ftxtest/run.sh
index 4d254c7..3cdb93d 100755
--- a/cmd/ftxtest/run.sh
+++ b/cmd/ftxtest/run.sh
@@ -1,6 +1,6 @@
#!/bin/bash
+set -x
+
./gen.sh
-rm -f /tmp/ftxtest.socket
-nc -lU /tmp/ftxtest.socket >/dev/null &
-LOGDOG_STREAM_SERVER_PATH=unix:/tmp/ftxtest.socket go run main.go <test/input.pb
+LUCIEXE_FAKEBUILD=test/build.json go run main.go -- -working-dir=$PWD
diff --git a/cmd/ftxtest/test/build.json b/cmd/ftxtest/test/build.json
new file mode 100644
index 0000000..7eb02d4
--- /dev/null
+++ b/cmd/ftxtest/test/build.json
@@ -0,0 +1,12 @@
+{
+ "input": {
+ "properties": {
+ "input_artifacts_digest": "0123456789abcdef",
+ "test_command": "some/command",
+ "target_dimensions": {
+ "d1": "v1",
+ "d2": "v2"
+ }
+ }
+ }
+}
diff --git a/cmd/ftxtest/test/input.pb b/cmd/ftxtest/test/input.pb
deleted file mode 100644
index ab166c3..0000000
--- a/cmd/ftxtest/test/input.pb
+++ /dev/null
@@ -1,5 +0,0 @@
-
-0123456789abcdef
- some/pathsome-tag "some/command*
-key1val1*
-key2val2
\ No newline at end of file
diff --git a/cmd/ftxtest/test/input.textproto b/cmd/ftxtest/test/input.textproto
deleted file mode 100644
index 4772390..0000000
--- a/cmd/ftxtest/test/input.textproto
+++ /dev/null
@@ -1,14 +0,0 @@
-input_artifacts_digest: "0123456789abcdef"
-cipd_packages: [
- {
- path: "some/path"
- tag: "some-tag"
- }
-]
-prepration_params: {
- flash: True
- run_package_server: True
-}
-test_command: "some/command"
-target_dimensions { key: "key1", value: "val1" }
-target_dimensions { key: "key2", value: "val2" }