From 67bd8d722e55a2604b71a1fa50dd1a0a75257144 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Viktor=20Levente=20T=C3=B3th?= Date: Wed, 11 Sep 2024 16:25:00 +0200 Subject: [PATCH] test: gsoc listener --- pkg/pushsync/pushsync_test.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pkg/pushsync/pushsync_test.go b/pkg/pushsync/pushsync_test.go index f139f3ebf46..5d806d6b714 100644 --- a/pkg/pushsync/pushsync_test.go +++ b/pkg/pushsync/pushsync_test.go @@ -130,6 +130,12 @@ func TestSocListener(t *testing.T) { t.Fatal(err) } sch2 = sch2.WithStamp(chunk2.Stamp()) + expectedPayload := chunk1.Data() + gsocListener := func(soc soc.SOC) { + if !bytes.Equal(soc.WrappedChunk().Data(), expectedPayload) { + t.Fatalf("unexpected SOC payload on GSOC listener. got %s, want %s", soc.WrappedChunk().Data(), expectedPayload) + } + } // create a pivot node and a mocked closest node pivotNode := swarm.MustParseHexAddress("0000000000000000000000000000000000000000000000000000000000000000") // base is 0000 @@ -143,7 +149,7 @@ func TestSocListener(t *testing.T) { // pivot node needs the streamer since the chunk is intercepted by // the chunk worker, then gets sent by opening a new stream - psPivot, _, _ := createGsocPushSyncNode(t, pivotNode, defaultPrices, recorder, nil, defaultSigner, mock.WithClosestPeer(closestPeer)) + psPivot, _, _ := createGsocPushSyncNode(t, pivotNode, defaultPrices, recorder, gsocListener, defaultSigner, mock.WithClosestPeer(closestPeer)) // Trigger the sending of chunk to the closest node receipt, err := psPivot.PushChunkToClosest(context.Background(), sch1) @@ -162,6 +168,7 @@ func TestSocListener(t *testing.T) { waitOnRecordAndTest(t, closestPeer, recorder, sch1.Address(), nil) recorder.Reset() + expectedPayload = chunk2.Data() // Trigger the sending of chunk to the closest node receipt, err = psPivot.PushChunkToClosest(context.Background(), sch2)