Skip to content

Commit 9af2e89

Browse files
committed
import latest gcp and llama tests fixes from pgwatch_rpc_server
1 parent a7b81f2 commit 9af2e89

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

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)