diff options
author | Cecylia Bocovich <cohosh@torproject.org> | 2023-09-19 13:19:27 -0400 |
---|---|---|
committer | Cecylia Bocovich <cohosh@torproject.org> | 2023-09-20 12:34:51 -0400 |
commit | 3a050c6bb3b0b5f419028a5038569e21fcdc9b55 (patch) | |
tree | 4b89174a82ab716191289250b219039ab65f1852 | |
parent | e45e8e555be16c563a325d8be75a4b47cc0f0131 (diff) | |
download | snowflake-3a050c6bb3b0b5f419028a5038569e21fcdc9b55.tar.gz snowflake-3a050c6bb3b0b5f419028a5038569e21fcdc9b55.zip |
Use ShouldBeNil to check for nil valuesrenovate/github.com-smartystreets-goconvey-1.xmr-origin-165
-rw-r--r-- | broker/snowflake-broker_test.go | 4 | ||||
-rw-r--r-- | common/messages/messages_test.go | 34 | ||||
-rw-r--r-- | proxy/lib/proxy-go_test.go | 14 |
3 files changed, 26 insertions, 26 deletions
diff --git a/broker/snowflake-broker_test.go b/broker/snowflake-broker_test.go index 37b17ec..b42e094 100644 --- a/broker/snowflake-broker_test.go +++ b/broker/snowflake-broker_test.go @@ -553,7 +553,7 @@ func TestInvalidGeoipFile(t *testing.T) { log.Printf("loading geo ip databases returned error: %v", err) } ctx.metrics.UpdateCountryStats("127.0.0.1", "", NATUnrestricted) - So(ctx.metrics.geoipdb, ShouldEqual, nil) + So(ctx.metrics.geoipdb, ShouldBeNil) }) } @@ -566,7 +566,7 @@ func TestMetrics(t *testing.T) { i := &IPC{ctx} err := ctx.metrics.LoadGeoipDatabases("test_geoip", "test_geoip6") - So(err, ShouldEqual, nil) + So(err, ShouldBeNil) //Test addition of proxy polls Convey("for proxy polls", func() { diff --git a/common/messages/messages_test.go b/common/messages/messages_test.go index 2fc76df..c70e6f3 100644 --- a/common/messages/messages_test.go +++ b/common/messages/messages_test.go @@ -123,13 +123,13 @@ func TestDecodeProxyPollRequest(t *testing.T) { func TestEncodeProxyPollRequests(t *testing.T) { Convey("Context", t, func() { b, err := EncodeProxyPollRequest("ymbcCMto7KHNGYlp", "standalone", "unknown", 16) - So(err, ShouldEqual, nil) + So(err, ShouldBeNil) sid, proxyType, natType, clients, err := DecodeProxyPollRequest(b) So(sid, ShouldEqual, "ymbcCMto7KHNGYlp") So(proxyType, ShouldEqual, "standalone") So(natType, ShouldEqual, "unknown") So(clients, ShouldEqual, 16) - So(err, ShouldEqual, nil) + So(err, ShouldBeNil) }) } @@ -180,18 +180,18 @@ func TestDecodeProxyPollResponse(t *testing.T) { func TestEncodeProxyPollResponse(t *testing.T) { Convey("Context", t, func() { b, err := EncodePollResponse("fake offer", true, "restricted") - So(err, ShouldEqual, nil) + So(err, ShouldBeNil) offer, natType, err := DecodePollResponse(b) So(offer, ShouldEqual, "fake offer") So(natType, ShouldEqual, "restricted") - So(err, ShouldEqual, nil) + So(err, ShouldBeNil) b, err = EncodePollResponse("", false, "unknown") - So(err, ShouldEqual, nil) + So(err, ShouldBeNil) offer, natType, err = DecodePollResponse(b) So(offer, ShouldEqual, "") So(natType, ShouldEqual, "unknown") - So(err, ShouldEqual, nil) + So(err, ShouldBeNil) }) } @@ -267,11 +267,11 @@ func TestDecodeProxyAnswerRequest(t *testing.T) { func TestEncodeProxyAnswerRequest(t *testing.T) { Convey("Context", t, func() { b, err := EncodeAnswerRequest("test answer", "test sid") - So(err, ShouldEqual, nil) + So(err, ShouldBeNil) answer, sid, err := DecodeAnswerRequest(b) So(answer, ShouldEqual, "test answer") So(sid, ShouldEqual, "test sid") - So(err, ShouldEqual, nil) + So(err, ShouldBeNil) }) } @@ -309,16 +309,16 @@ func TestDecodeProxyAnswerResponse(t *testing.T) { func TestEncodeProxyAnswerResponse(t *testing.T) { Convey("Context", t, func() { b, err := EncodeAnswerResponse(true) - So(err, ShouldEqual, nil) + So(err, ShouldBeNil) success, err := DecodeAnswerResponse(b) So(success, ShouldEqual, true) - So(err, ShouldEqual, nil) + So(err, ShouldBeNil) b, err = EncodeAnswerResponse(false) - So(err, ShouldEqual, nil) + So(err, ShouldBeNil) success, err = DecodeAnswerResponse(b) So(success, ShouldEqual, false) - So(err, ShouldEqual, nil) + So(err, ShouldBeNil) }) } @@ -406,7 +406,7 @@ func TestEncodeClientPollRequests(t *testing.T) { Fingerprint: test.fingerprint, } b, err := req1.EncodeClientPollRequest() - So(err, ShouldEqual, nil) + So(err, ShouldBeNil) req2, err := DecodeClientPollRequest(b) So(err, ShouldHaveSameTypeAs, test.err) if test.err == nil { @@ -455,18 +455,18 @@ func TestEncodeClientPollResponse(t *testing.T) { Answer: "fake answer", } b, err := resp1.EncodePollResponse() - So(err, ShouldEqual, nil) + So(err, ShouldBeNil) resp2, err := DecodeClientPollResponse(b) - So(err, ShouldEqual, nil) + So(err, ShouldBeNil) So(resp1, ShouldResemble, resp2) resp1 = &ClientPollResponse{ Error: "failed", } b, err = resp1.EncodePollResponse() - So(err, ShouldEqual, nil) + So(err, ShouldBeNil) resp2, err = DecodeClientPollResponse(b) - So(err, ShouldEqual, nil) + So(err, ShouldBeNil) So(resp1, ShouldResemble, resp2) }) } diff --git a/proxy/lib/proxy-go_test.go b/proxy/lib/proxy-go_test.go index 4ff970f..547492b 100644 --- a/proxy/lib/proxy-go_test.go +++ b/proxy/lib/proxy-go_test.go @@ -338,7 +338,7 @@ func TestBrokerInteractions(t *testing.T) { Convey("Proxy connections to broker", t, func() { var err error broker, err = newSignalingServer("localhost", false) - So(err, ShouldEqual, nil) + So(err, ShouldBeNil) tokens = newTokens(0) //Mock peerConnection @@ -359,7 +359,7 @@ func TestBrokerInteractions(t *testing.T) { var err error b, err := messages.EncodePollResponse(sampleOffer, true, "unknown") - So(err, ShouldEqual, nil) + So(err, ShouldBeNil) broker.transport = &MockTransport{ http.StatusOK, b, @@ -373,7 +373,7 @@ func TestBrokerInteractions(t *testing.T) { var err error b := []byte("test") - So(err, ShouldEqual, nil) + So(err, ShouldBeNil) broker.transport = &MockTransport{ http.StatusOK, b, @@ -386,17 +386,17 @@ func TestBrokerInteractions(t *testing.T) { var err error b, err := messages.EncodeAnswerResponse(true) - So(err, ShouldEqual, nil) + So(err, ShouldBeNil) broker.transport = &MockTransport{ http.StatusOK, b, } err = broker.sendAnswer(sampleAnswer, pc) - So(err, ShouldEqual, nil) + So(err, ShouldBeNil) b, err = messages.EncodeAnswerResponse(false) - So(err, ShouldEqual, nil) + So(err, ShouldBeNil) broker.transport = &MockTransport{ http.StatusOK, b, @@ -486,7 +486,7 @@ func TestUtilityFuncs(t *testing.T) { bytes := make([]byte, 6) n, err := c2.Read(bytes) So(n, ShouldEqual, 6) - So(err, ShouldEqual, nil) + So(err, ShouldBeNil) So(bytes, ShouldResemble, []byte("Hello!")) s1.Close() |