makes sure we are having Nat set to None for the tests

This commit is contained in:
Marcin Czenko 2025-11-10 12:06:02 +01:00
parent f69939fdae
commit 7e3b855103
No known key found for this signature in database
GPG Key ID: A0449219BDBA98AE
3 changed files with 17 additions and 1 deletions

View File

@ -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)

View File

@ -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)

View File

@ -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)