diff --git a/Makefile b/Makefile index d7ddf34..9f434c9 100644 --- a/Makefile +++ b/Makefile @@ -21,7 +21,7 @@ update: | submodules libcodex: @echo "Building libcodex..." - @$(MAKE) -C $(NIM_CODEX_DIR) libcodex + @$(MAKE) -C $(NIM_CODEX_DIR) libcodex CODEX_LIB_PARAMS="-d:codex_enable_api_debug_peers" build: @echo "Building Codex Go Bindings..." @@ -31,6 +31,14 @@ test: @echo "Running tests..." CGO_ENABLED=1 CGO_CFLAGS="$(CGO_CFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" GOTESTFLAGS="-timeout=2m" go test ./... +test2: + @echo "Running tests..." + CGO_ENABLED=1 CGO_CFLAGS="$(CGO_CFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" GOTESTFLAGS="-timeout=2m" gotestsum --packages="./..." -f testname -- -count 1 -run TestConnectWithAddress + +test3: + @echo "Running tests..." + CGO_ENABLED=1 CGO_CFLAGS="$(CGO_CFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" GOTESTFLAGS="-timeout=2m" gotestsum --packages="./..." -f testname -- -count 1 + clean: @echo "Cleaning up..." @git submodule deinit -f $(NIM_CODEX_DIR) diff --git a/codex/p2p_test.go b/codex/p2p_test.go index 44106a9..44337fd 100644 --- a/codex/p2p_test.go +++ b/codex/p2p_test.go @@ -36,6 +36,7 @@ func TestConnectWithAddress(t *testing.T) { LogFormat: LogFormatNoColors, MetricsEnabled: false, DiscoveryPort: 8090, + Nat: "none", }) if err != nil { t.Fatalf("Failed to create codex1: %v", err) @@ -50,6 +51,7 @@ func TestConnectWithAddress(t *testing.T) { LogFormat: LogFormatNoColors, MetricsEnabled: false, DiscoveryPort: 8091, + Nat: "none", }) if err != nil { t.Fatalf("Failed to create codex2: %v", err) diff --git a/codex/testutil.go b/codex/testutil.go index 274495b..a42c303 100644 --- a/codex/testutil.go +++ b/codex/testutil.go @@ -15,6 +15,7 @@ func defaultConfigHelper(t *testing.T) Config { MetricsEnabled: false, BlockRetries: 3000, LogLevel: "ERROR", + Nat: "none", } } @@ -43,6 +44,11 @@ func newCodexNode(t *testing.T, opts ...Config) *CodexNode { if c.DiscoveryPort != 0 { config.DiscoveryPort = c.DiscoveryPort } + + // in case someone wants to change the config.Nat default value + if c.Nat != "" { + config.Nat = c.Nat + } } node, err := New(config)