Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ testall: test longtest sequentialtest
smoketest:
@mkdir -p /tmp/teranode-test-results
# cd test/e2e/daemon && go test -race -tags "testtxmetacache" -count=1 -timeout=5m -parallel 1 -coverprofile=coverage.out ./test/e2e/daemon/ready/... 2>&1 | grep -v "ld: warning:"
cd test/e2e/daemon/ready && SETTINGS_CONTEXT=$(or $(settings_context),$(SETTINGS_CONTEXT_DEFAULT)) go test -v -count=1 -race -timeout=5m -parallel 1 -run . 2>&1 | tee /tmp/teranode-test-results/smoketest-results.txt
cd test/e2e/daemon/ready && go test -v -count=1 -race -timeout=5m -parallel 1 -run . 2>&1 | tee /tmp/teranode-test-results/smoketest-results.txt


.PHONY: nightly-tests
Expand Down
12 changes: 6 additions & 6 deletions compose/docker-compose-3blasters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ services:
KAFKA_VALIDATORTXS: validatortxs-teranode1
volumes:
- ../settings.conf:/app/settings.conf
- ../settings_local.conf:/app/settings_local.conf
- ./settings_test.conf:/app/settings_local.conf
- ../data/teranode1/txstore:/app/data/txstore
- ../data/teranode1/subtreestore:/app/data/subtreestore
- ../data/teranode1/blockstore:/app/data/blockstore
Expand Down Expand Up @@ -229,7 +229,7 @@ services:
KAFKA_VALIDATORTXS: validatortxs-teranode2
volumes:
- ../settings.conf:/app/settings.conf
- ../settings_local.conf:/app/settings_local.conf
- ./settings_test.conf:/app/settings_local.conf
- ../data/teranode2/txstore:/app/data/txstore
- ../data/teranode2/subtreestore:/app/data/subtreestore
- ../data/teranode2/blockstore:/app/data/blockstore
Expand Down Expand Up @@ -300,7 +300,7 @@ services:
KAFKA_VALIDATORTXS: validatortxs-teranode3
volumes:
- ../settings.conf:/app/settings.conf
- ../settings_local.conf:/app/settings_local.conf
- ./settings_test.conf:/app/settings_local.conf
- ../data/teranode3/txstore:/app/data/txstore
- ../data/teranode3/subtreestore:/app/data/subtreestore
- ../data/teranode3/blockstore:/app/data/blockstore
Expand Down Expand Up @@ -379,7 +379,7 @@ services:

volumes:
- ../settings.conf:/app/settings.conf
- ../settings_local.conf:/app/settings_local.conf
- ./settings_test.conf:/app/settings_local.conf
- ../data/coinbase1:/app/data

block-generator-2:
Expand Down Expand Up @@ -432,7 +432,7 @@ services:
LOG_LEVEL: "info"
volumes:
- ../settings.conf:/app/settings.conf
- ../settings_local.conf:/app/settings_local.conf
- ./settings_test.conf:/app/settings_local.conf
- ../data/coinbase2:/app/data

block-generator-3:
Expand Down Expand Up @@ -485,7 +485,7 @@ services:
LOG_LEVEL: "info"
volumes:
- ../settings.conf:/app/settings.conf
- ../settings_local.conf:/app/settings_local.conf
- ./settings_test.conf:/app/settings_local.conf
- ../data/coinbase3:/app/data

tx-blaster-1:
Expand Down
7 changes: 5 additions & 2 deletions compose/docker-compose-chainintegrity.yml
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ services:
- "9292"
volumes:
- ../settings.conf:/app/settings.conf
- ./settings_test.conf:/app/settings_local.conf
- ./wait.sh:/app/wait.sh
- ../data/teranode1/txstore:/app/data/txstore
- ../data/teranode1/subtreestore:/app/data/subtreestore
Expand Down Expand Up @@ -231,6 +232,7 @@ services:
- "9292"
volumes:
- ../settings.conf:/app/settings.conf
- ./settings_test.conf:/app/settings_local.conf
- ./wait.sh:/app/wait.sh
- ../data/teranode2/txstore:/app/data/txstore
- ../data/teranode2/subtreestore:/app/data/subtreestore
Expand Down Expand Up @@ -286,6 +288,7 @@ services:
- "9292"
volumes:
- ../settings.conf:/app/settings.conf
- ./settings_test.conf:/app/settings_local.conf
- ./wait.sh:/app/wait.sh
- ../data/teranode3/txstore:/app/data/txstore
- ../data/teranode3/subtreestore:/app/data/subtreestore
Expand Down Expand Up @@ -325,7 +328,7 @@ services:
profilerAddr: "localhost:17092"
volumes:
- ../settings.conf:/app/settings.conf
- ../settings_local.conf:/app/settings_local.conf
- ./settings_test.conf:/app/settings_local.conf
- ../data/test/${TEST_ID:-chainintegrity}/coinbase1:/app/data

tx-blaster-1:
Expand All @@ -350,5 +353,5 @@ services:
]
volumes:
- ../settings.conf:/app/settings.conf
- ../settings_local.conf:/app/settings_local.conf
- ./settings_test.conf:/app/settings_local.conf
- ../data/test/${TEST_ID:-chainintegrity}/txblaster1:/app/data
394 changes: 394 additions & 0 deletions compose/settings_test.conf

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion daemon/daemon_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ func TestDaemon_Start_AllServices(t *testing.T) {
require.NoError(t, err, "Failed to get free port for Asset")

// Configure settings - this will now pick up KAFKA_PORT and persister URLs from gocore.Config
appSettings := settings.NewSettings("docker.host.teranode3.daemon")
appSettings := settings.NewSettings()
appSettings.LocalTestStartFromState = "RUNNING"
appSettings.P2P.Port = p2pPort
appSettings.Asset.HTTPPort = assetPort
Expand Down
34 changes: 14 additions & 20 deletions daemon/test_daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ type TestOptions struct {
EnableP2P bool
EnableRPC bool
EnableValidator bool
SettingsContext string
SettingsOverrideFunc func(*settings.Settings)
SkipRemoveDataDir bool
StartDaemonDependencies bool
Expand Down Expand Up @@ -122,11 +121,7 @@ func NewTestDaemon(t *testing.T, opts TestOptions) *TestDaemon {
appSettings *settings.Settings
)

if opts.SettingsContext != "" {
appSettings = settings.NewSettings(opts.SettingsContext)
} else {
appSettings = settings.NewSettings() // This reads gocore.Config and applies sensible defaults
}
appSettings = settings.NewSettings() // This reads gocore.Config and applies sensible defaults

// Dynamically allocate free ports for all relevant services
allocatePort := func(schema string) (listenAddr string, clientAddr string, addrPort int) {
Expand Down Expand Up @@ -259,15 +254,15 @@ func NewTestDaemon(t *testing.T, opts TestOptions) *TestDaemon {
require.NoError(t, err)
appSettings.HealthCheckHTTPListenAddress = listenAddr

path := filepath.Join("data", appSettings.ClientName)
if strings.HasPrefix(opts.SettingsContext, "dev.system.test") {
// Create a unique data directory per test to avoid SQLite locking issues
// Use test name and timestamp to ensure uniqueness across sequential test runs
testName := strings.ReplaceAll(t.Name(), "/", "_")
path = filepath.Join("data", fmt.Sprintf("test_%s_%d", testName, time.Now().UnixNano()))
}
// Create a unique data directory per test
// Use test name and timestamp to ensure uniqueness across sequential test runs
testName := strings.ReplaceAll(t.Name(), "/", "_")
appSettings.ClientName = testName
path := filepath.Join("data")

if !opts.SkipRemoveDataDir {
// path := filepath.Join("data", fmt.Sprintf("test_%s_%d", testName, time.Now().UnixNano()))

if !opts.SkipRemoveDataDir && opts.SkipRemoveDataDir == false {
absPath, err := filepath.Abs(path)
require.NoError(t, err)

Expand All @@ -287,12 +282,11 @@ func NewTestDaemon(t *testing.T, opts TestOptions) *TestDaemon {

// Override DataFolder BEFORE creating any directories
// This ensures all store paths (blockstore, quorum, etc.) use the test-specific path
if strings.HasPrefix(opts.SettingsContext, "dev.system.test") {
appSettings.DataFolder = path
// Override QuorumPath to ensure it uses the test-specific directory
// This prevents tests from sharing the same quorum directory
appSettings.SubtreeValidation.QuorumPath = filepath.Join(path, "subtree_quorum")
}
// Always set DataFolder and QuorumPath to test-specific directory
appSettings.DataFolder = path
// Override QuorumPath to ensure it uses the test-specific directory
// This prevents tests from sharing the same quorum directory
// appSettings.SubtreeValidation.QuorumPath = filepath.Join(path, "subtree_quorum")

absPath, err := filepath.Abs(path)
require.NoError(t, err)
Expand Down
Loading
Loading