From 7e5ceaa743d6d6aa6a24133595a34c3103aa49ea Mon Sep 17 00:00:00 2001 From: Michael Schurter Date: Mon, 21 Oct 2024 06:31:20 -0700 Subject: [PATCH] Fix test and add CI (#321) --- .github/workflows/test.yaml | 41 +++++++++++++++++++++++++++++++++++++ grpc_client_test.go | 2 +- 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/test.yaml diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml new file mode 100644 index 00000000..c7811d78 --- /dev/null +++ b/.github/workflows/test.yaml @@ -0,0 +1,41 @@ +name: CI Tests +on: + pull_request: + paths-ignore: + - 'README.md' + push: + branches: + - 'main' + paths-ignore: + - 'README.md' + +permissions: + contents: read + +jobs: + go-fmt-and-vet: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 + - uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # v3.5.0 + with: + go-version: '1.20' + cache: true + - run: | + files=$(go fmt ./...) + if [ -n "$files" ]; then + echo "The following file(s) do not conform to go fmt:" + echo "$files" + exit 1 + fi + go-test: + needs: go-fmt-and-vet + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 + - uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # v3.5.0 + with: + go-version: '1.20' + cache: true + - run: | + go test -race ./... diff --git a/grpc_client_test.go b/grpc_client_test.go index a7800a5a..3ce24ee1 100644 --- a/grpc_client_test.go +++ b/grpc_client_test.go @@ -163,7 +163,7 @@ func testGRPCClientReflection(t *testing.T, multiplex bool) { } // TODO: maybe only assert some specific services here to make test more resilient - expectedSvcs := []string{"grpc.health.v1.Health", "grpc.reflection.v1alpha.ServerReflection", "grpctest.Test", "plugin.GRPCBroker", "plugin.GRPCController", "plugin.GRPCStdio"} + expectedSvcs := []string{"grpc.health.v1.Health", "grpc.reflection.v1.ServerReflection", "grpc.reflection.v1alpha.ServerReflection", "grpctest.Test", "plugin.GRPCBroker", "plugin.GRPCController", "plugin.GRPCStdio"} if !reflect.DeepEqual(svcs, expectedSvcs) { t.Fatalf("expected: %v\ngot: %v", expectedSvcs, svcs)