From 29c0229f8a6c78b77e5ff74da0b8371181be9454 Mon Sep 17 00:00:00 2001 From: josh <josh@elixxir.io> Date: Thu, 2 Dec 2021 10:01:22 -0800 Subject: [PATCH] Allow for disabling TLS in tests --- network/gateway/hostpool_test.go | 8 ++++++++ network/message/garbled_test.go | 9 +++++++++ network/rounds/remoteFilters_test.go | 9 +++++++++ registration/permissioning_test.go | 9 +++++++++ ud/addFact_test.go | 8 ++++++++ 5 files changed, 43 insertions(+) diff --git a/network/gateway/hostpool_test.go b/network/gateway/hostpool_test.go index 919d3faed..5e93ba8df 100644 --- a/network/gateway/hostpool_test.go +++ b/network/gateway/hostpool_test.go @@ -9,6 +9,7 @@ package gateway import ( "fmt" + jww "github.com/spf13/jwalterweatherman" "gitlab.com/elixxir/client/storage" "gitlab.com/elixxir/comms/network" "gitlab.com/elixxir/crypto/fastRNG" @@ -16,10 +17,17 @@ import ( "gitlab.com/xx_network/crypto/csprng" "gitlab.com/xx_network/primitives/id" "gitlab.com/xx_network/primitives/ndf" + "os" "reflect" "testing" ) +func TestMain(m *testing.M) { + jww.SetStdoutThreshold(jww.LevelTrace) + connect.TestingOnlyDisableTLS = true + os.Exit(m.Run()) +} + // Unit test func TestNewHostPool(t *testing.T) { manager := newMockManager() diff --git a/network/message/garbled_test.go b/network/message/garbled_test.go index b651c02e0..45a0a98fc 100644 --- a/network/message/garbled_test.go +++ b/network/message/garbled_test.go @@ -2,6 +2,7 @@ package message import ( "encoding/binary" + jww "github.com/spf13/jwalterweatherman" "gitlab.com/elixxir/client/interfaces/message" "gitlab.com/elixxir/client/interfaces/params" "gitlab.com/elixxir/client/network/gateway" @@ -13,13 +14,21 @@ import ( "gitlab.com/elixxir/comms/client" "gitlab.com/elixxir/crypto/fastRNG" "gitlab.com/elixxir/primitives/format" + "gitlab.com/xx_network/comms/connect" "gitlab.com/xx_network/crypto/csprng" "gitlab.com/xx_network/primitives/netTime" "math/rand" + "os" "testing" "time" ) +func TestMain(m *testing.M) { + jww.SetStdoutThreshold(jww.LevelTrace) + connect.TestingOnlyDisableTLS = true + os.Exit(m.Run()) +} + type TestListener struct { ch chan bool } diff --git a/network/rounds/remoteFilters_test.go b/network/rounds/remoteFilters_test.go index 924f7f970..a04d7f51c 100644 --- a/network/rounds/remoteFilters_test.go +++ b/network/rounds/remoteFilters_test.go @@ -8,17 +8,26 @@ package rounds import ( + jww "github.com/spf13/jwalterweatherman" bloom "gitlab.com/elixxir/bloomfilter" "gitlab.com/elixxir/client/interfaces" "gitlab.com/elixxir/client/storage/reception" "gitlab.com/elixxir/comms/mixmessages" + "gitlab.com/xx_network/comms/connect" "gitlab.com/xx_network/primitives/id" "gitlab.com/xx_network/primitives/id/ephemeral" + "os" "reflect" "testing" "time" ) +func TestMain(m *testing.M) { + jww.SetStdoutThreshold(jww.LevelTrace) + connect.TestingOnlyDisableTLS = true + os.Exit(m.Run()) +} + // Unit test NewRemoteFilter func TestNewRemoteFilter(t *testing.T) { bloomFilter := &mixmessages.ClientBloom{ diff --git a/registration/permissioning_test.go b/registration/permissioning_test.go index 56083a5dd..616ab9393 100644 --- a/registration/permissioning_test.go +++ b/registration/permissioning_test.go @@ -8,12 +8,21 @@ package registration import ( + jww "github.com/spf13/jwalterweatherman" "gitlab.com/elixxir/comms/client" + "gitlab.com/xx_network/comms/connect" "gitlab.com/xx_network/primitives/id" "gitlab.com/xx_network/primitives/ndf" + "os" "testing" ) +func TestMain(m *testing.M) { + jww.SetStdoutThreshold(jww.LevelTrace) + connect.TestingOnlyDisableTLS = true + os.Exit(m.Run()) +} + // Init should create a valid Registration communications struct func TestInit(t *testing.T) { // Create dummy comms and ndf diff --git a/ud/addFact_test.go b/ud/addFact_test.go index eebb92a1d..ba6db2dc1 100644 --- a/ud/addFact_test.go +++ b/ud/addFact_test.go @@ -1,6 +1,7 @@ package ud import ( + jww "github.com/spf13/jwalterweatherman" "gitlab.com/elixxir/comms/client" pb "gitlab.com/elixxir/comms/mixmessages" "gitlab.com/elixxir/primitives/fact" @@ -8,9 +9,16 @@ import ( "gitlab.com/xx_network/crypto/csprng" "gitlab.com/xx_network/crypto/signature/rsa" "gitlab.com/xx_network/primitives/id" + "os" "testing" ) +func TestMain(m *testing.M) { + jww.SetStdoutThreshold(jww.LevelTrace) + connect.TestingOnlyDisableTLS = true + os.Exit(m.Run()) +} + type testAFC struct{} // Dummy implementation of SendRegisterFact so that we don't need to run our own -- GitLab