Skip to content

Commit 5a046be

Browse files
authored
[*] update test workflow to use rpc/ not gRPC_sinks/ (#2)
* update `test.yml` to cd into `rpc/` intstead of `gRPC_sinks` * set `rpc` to be default working directory for `Lint` job * update path for cover profile to `rpc/profile.cov` * import latest gcp and llama tests fixes from pgwatch_rpc_server
1 parent 99af615 commit 5a046be

File tree

3 files changed

+16
-10
lines changed

3 files changed

+16
-10
lines changed

.github/workflows/test.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ concurrency:
1414
jobs:
1515
Lint:
1616
runs-on: ubuntu-latest
17+
defaults:
18+
run:
19+
working-directory: rpc
1720
steps:
1821

1922
- name: Check out code
@@ -32,17 +35,21 @@ jobs:
3235
uses: golangci/golangci-lint-action@v8
3336
with:
3437
version: latest
38+
working-directory: rpc
3539

3640
Unit-Test:
3741
runs-on: ubuntu-latest
42+
defaults:
43+
run:
44+
working-directory: rpc
3845
steps:
3946
- uses: actions/checkout@v4
4047

4148
- name: Set up Go
4249
uses: actions/setup-go@v5
4350
with:
4451
go-version: '1.23'
45-
cache-dependency-path: 'go.sum'
52+
cache-dependency-path: 'rpc/go.sum'
4653

4754
- name: Setup Protobuf
4855
uses: ./.github/actions/setup-protobuf
@@ -60,17 +67,15 @@ jobs:
6067
6168
- name: gRPC Golang Tests
6269
run: |
63-
cd gRPC_sinks
6470
go generate ./sinks/pb
6571
go test -timeout 20m -failfast -v -coverprofile=profile.cov ./...
6672
6773
- name: gRPC Python Tests
6874
run: |
69-
cd gRPC_sinks
7075
python3 -m grpc_tools.protoc -I sinks/pb --python_out=cmd/pyiceberg_receiver --grpc_python_out=cmd/pyiceberg_receiver sinks/pb/pgwatch.proto
7176
pytest
7277
7378
- name: Coveralls
7479
uses: coverallsapp/github-action@v2
7580
with:
76-
file: profile.cov
81+
file: rpc/profile.cov

rpc/cmd/gcp_pubsub_receiver/pubsub_receiver_test.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,17 @@ func TestPubsubReceiver(t *testing.T) {
5555
a.NotNil(psr)
5656

5757
t.Run("Test Pub/Sub Receiver UpdateMeasurements()", func(t *testing.T) {
58+
// To read the published message from the Pub/Sub server.
59+
sub, err := CreateSubscription(psr)
60+
a.NoError(err)
61+
5862
msg := testutils.GetTestMeasurementEnvelope()
5963
reply, err := psr.UpdateMeasurements(context.Background(), msg)
64+
psr.publisher.Flush()
6065

6166
a.NoError(err)
6267
a.Equal(reply.GetLogmsg(), "Message published.")
6368

64-
// Try read the published message from the Pub/Sub server.
65-
sub, err := CreateSubscription(psr)
66-
a.NoError(err)
67-
6869
ctx, cancel := context.WithCancel(context.Background())
6970
err = sub.Receive(ctx, func(ctx context.Context, m *pubsub.Message) {
7071
var recvd_msg map[string]any

rpc/cmd/llama_receiver/llama_receiver_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ func TestLLamaReceiver(t *testing.T) {
141141
})
142142

143143
t.Run("Update Measurements Multiple", func(t *testing.T) {
144-
for range 10 {
144+
for range 3 {
145145
_, err := recv.UpdateMeasurements(ctx, msg)
146146
assert.NoError(t, err, "error encountered while updating measurements")
147147
}
@@ -151,7 +151,7 @@ func TestLLamaReceiver(t *testing.T) {
151151
err := conn.QueryRow(recv.Ctx, "SELECT COUNT(*) FROM insights;").Scan(&newInsightsCount)
152152

153153
assert.NoError(t, err)
154-
assert.Greater(t, newInsightsCount, 1, "No new entries inserted in insights table")
154+
assert.GreaterOrEqual(t, newInsightsCount, 1, "No new entries inserted in insights table")
155155
})
156156

157157
t.Run("LLama SyncMetricHandler", func(t *testing.T) {

0 commit comments

Comments
 (0)