Remove github.com/stretchr/testify dependency from the acceptance tests

This commit is contained in:
M. Mert Yildiran
2021-11-10 12:22:04 +03:00
parent 40fb0ea260
commit 4874e5d8f5
3 changed files with 12 additions and 9 deletions

View File

@@ -4,7 +4,6 @@ go 1.16
require (
github.com/gorilla/websocket v1.4.2
github.com/stretchr/testify v1.6.1
github.com/up9inc/mizu/shared v0.0.0
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b
)

View File

@@ -75,7 +75,6 @@ github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsr
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/creack/pty v1.1.11/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/daviddengcn/go-colortext v0.0.0-20160507010035-511bcaf42ccd/go.mod h1:dv4zxwHi5C/8AeI+4gX4dCWOIvNi7I6JCSX0HvlKPgE=
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
@@ -314,7 +313,6 @@ github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI=
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
@@ -367,7 +365,6 @@ github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoH
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw=
github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=

View File

@@ -15,7 +15,6 @@ import (
"time"
"github.com/gorilla/websocket"
"github.com/stretchr/testify/assert"
)
// waitTimeout waits for the waitgroup for the specified max timeout.
@@ -41,7 +40,10 @@ func checkDBHasEntries(t *testing.T, timestamp int64, limit int) (entries []map[
webSocketUrl := getWebSocketUrl(defaultApiServerPort)
connection, _, err := websocket.DefaultDialer.Dial(webSocketUrl, nil)
assert.Nil(t, err)
if err != nil {
t.Errorf("%v", err)
return
}
defer connection.Close()
handleWSConnection := func(wg *sync.WaitGroup) {
@@ -53,8 +55,10 @@ func checkDBHasEntries(t *testing.T, timestamp int64, limit int) (entries []map[
}
var data map[string]interface{}
err = json.Unmarshal([]byte(message), &data)
assert.Nil(t, err)
if err = json.Unmarshal([]byte(message), &data); err != nil {
t.Errorf("%v", err)
return
}
if data["messageType"] == "entry" {
entries = append(entries, data)
@@ -63,7 +67,10 @@ func checkDBHasEntries(t *testing.T, timestamp int64, limit int) (entries []map[
}
err = connection.WriteMessage(websocket.TextMessage, []byte(query))
assert.Nil(t, err)
if err != nil {
t.Errorf("%v", err)
return
}
var wg sync.WaitGroup
go handleWSConnection(&wg)