From 975a1c4d0717b347accf85f5295fe203a6dead04 Mon Sep 17 00:00:00 2001 From: Paolo Galli Date: Mon, 27 May 2024 11:03:57 +0200 Subject: [PATCH] remove flaky subscription test (#742) --- api/subscriptions/subscriptions_test.go | 29 ------------------------- 1 file changed, 29 deletions(-) diff --git a/api/subscriptions/subscriptions_test.go b/api/subscriptions/subscriptions_test.go index f60c5a352..589a6d58d 100644 --- a/api/subscriptions/subscriptions_test.go +++ b/api/subscriptions/subscriptions_test.go @@ -34,7 +34,6 @@ func TestMain(t *testing.T) { initSubscriptionsServer(t) defer ts.Close() - testHandlePendingTransactions(t) testHandleSubjectWithBlock(t) testHandleSubjectWithEvent(t) testHandleSubjectWithTransfer(t) @@ -43,34 +42,6 @@ func TestMain(t *testing.T) { testHandleSubjectWithNonValidArgument(t) } -func testHandlePendingTransactions(t *testing.T) { - u := url.URL{Scheme: "ws", Host: strings.TrimPrefix(ts.URL, "http://"), Path: "/subscriptions/txpool"} - - conn, resp, err := websocket.DefaultDialer.Dial(u.String(), nil) - assert.NoError(t, err) - defer conn.Close() - - // Check the protocol upgrade to websocket - assert.Equal(t, http.StatusSwitchingProtocols, resp.StatusCode) - assert.Equal(t, "Upgrade", resp.Header.Get("Connection")) - assert.Equal(t, "websocket", resp.Header.Get("Upgrade")) - - // Add a new tx to the mempool - transaction := createTx(t, repo, 1) - txPool.AddLocal(transaction) - - _, msg, err := conn.ReadMessage() - - assert.NoError(t, err) - - var pendingTx *PendingTxIDMessage - if err := json.Unmarshal(msg, &pendingTx); err != nil { - t.Fatal(err) - } else { - assert.Equal(t, transaction.ID(), pendingTx.ID) - } -} - func testHandleSubjectWithBlock(t *testing.T) { genesisBlock := blocks[0] queryArg := fmt.Sprintf("pos=%s", genesisBlock.Header().ID().String())