Skip to content

Commit

Permalink
Revert "add close connection on telemetry unmarshal error unit test"
Browse files Browse the repository at this point in the history
This reverts commit e8447f9.
  • Loading branch information
QxBytes committed Apr 29, 2024
1 parent e8447f9 commit 486483c
Showing 1 changed file with 0 additions and 24 deletions.
24 changes: 0 additions & 24 deletions telemetry/telemetrybuffer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,30 +70,6 @@ func TestClientConnClose(t *testing.T) {
tbClient.Close()
}

func TestCloseOnWriteError(t *testing.T) {
tbServer, closeTBServer := createTBServer(t)
defer closeTBServer()

tbClient := NewTelemetryBuffer(nil)
err := tbClient.Connect()
require.NoError(t, err)
defer tbClient.Close()

data := []byte("{\"good\":1}")
_, err = tbClient.Write(data)
require.NoError(t, err)
// need to wait for connection to populate in server
time.Sleep(1 * time.Second)
require.Len(t, tbServer.connections, 1)

// the connection should be automatically closed on failure
badData := []byte("} malformed json }}}")
_, err = tbClient.Write(badData)
require.NoError(t, err)
time.Sleep(1 * time.Second)
require.Empty(t, tbServer.connections)
}

func TestWrite(t *testing.T) {
_, closeTBServer := createTBServer(t)
defer closeTBServer()
Expand Down

0 comments on commit 486483c

Please sign in to comment.