Skip to content

Commit

Permalink
feat: add cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
nick-bisonai committed Jul 11, 2024
1 parent 457d075 commit e7578ed
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions node/pkg/dal/tests/stats_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ type WebsocketSubscription struct {

func TestInsertRestCall(t *testing.T) {
ctx := context.Background()
_ = db.QueryWithoutResult(ctx, "DELETE FROM rest_calls", nil)

err := stats.InsertRestCall(ctx, "test", "test", 200, 10*time.Millisecond)
assert.NoError(t, err)

Expand All @@ -52,6 +54,8 @@ func TestInsertRestCall(t *testing.T) {

func TestInsertWebsocketConnection(t *testing.T) {
ctx := context.Background()
_ = db.QueryWithoutResult(ctx, "DELETE FROM websocket_connections", nil)

id, err := stats.InsertWebsocketConnection(ctx, "test")
assert.NoError(t, err)
assert.Greater(t, id, int32(0))
Expand All @@ -66,6 +70,7 @@ func TestInsertWebsocketConnection(t *testing.T) {

func TestUpdateWebsocketConnection(t *testing.T) {
ctx := context.Background()
_ = db.QueryWithoutResult(ctx, "DELETE FROM websocket_connections", nil)
id, err := stats.InsertWebsocketConnection(ctx, "test")
assert.NoError(t, err)
assert.Greater(t, id, int32(0))
Expand All @@ -84,6 +89,8 @@ func TestUpdateWebsocketConnection(t *testing.T) {

func TestWebsocketSubcription(t *testing.T) {
ctx := context.Background()
_ = db.QueryWithoutResult(ctx, "DELETE FROM websocket_subscriptions", nil)
_ = db.QueryWithoutResult(ctx, "DELETE FROM websocket_connections", nil)
id, err := stats.InsertWebsocketConnection(ctx, "test")
assert.NoError(t, err)
assert.Greater(t, id, int32(0))
Expand Down

0 comments on commit e7578ed

Please sign in to comment.