Skip to content

Commit

Permalink
#4538: fix captive listen port conflicts on reingest integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sreuland committed Aug 21, 2024
1 parent 805950a commit 3b335b7
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion services/horizon/internal/integration/db_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,8 @@ func TestReingestDB(t *testing.T) {
// subprocesses to conflict.
itest.StopHorizon()

var disableCaptiveHTTPPort = uint(0)
horizonConfig.CaptiveCoreTomlParams.HTTPPort = &disableCaptiveHTTPPort
var rootCmd = horizoncmd.NewRootCmd()
rootCmd.SetArgs(command(t, horizonConfig, "db",
"reingest",
Expand Down Expand Up @@ -735,7 +737,11 @@ func TestReingestDBWithFilterRules(t *testing.T) {
// repopulate the db with reingestion which should catchup using core reapply filter rules
// correctly on reingestion ranged
rootCmd = horizoncmd.NewRootCmd()
rootCmd.SetArgs(command(t, itest.GetHorizonIngestConfig(), "db",

horizonConfig := itest.GetHorizonIngestConfig()
var disableCaptiveHTTPPort = uint(0)
horizonConfig.CaptiveCoreTomlParams.HTTPPort = &disableCaptiveHTTPPort
rootCmd.SetArgs(command(t, horizonConfig, "db",
"reingest",
"range",
"1",
Expand Down Expand Up @@ -782,6 +788,12 @@ func TestReingestDBWithFilterRules(t *testing.T) {
}

func command(t *testing.T, horizonConfig horizon.Config, args ...string) []string {

coreHttpPort := "0"
if horizonConfig.CaptiveCoreTomlParams.HTTPPort != nil {
coreHttpPort = strconv.FormatUint(uint64(*horizonConfig.CaptiveCoreTomlParams.HTTPPort), 10)
}

return append([]string{
"--stellar-core-url",
horizonConfig.StellarCoreURL,
Expand All @@ -800,6 +812,8 @@ func command(t *testing.T, horizonConfig horizon.Config, args ...string) []strin
// due to ARTIFICIALLY_ACCELERATE_TIME_FOR_TESTING
"--checkpoint-frequency",
"8",
"--captive-core-http-port",
coreHttpPort,
// Create the storage directory outside of the source repo,
// otherwise it will break Golang test caching.
"--captive-core-storage-path=" + t.TempDir(),
Expand Down Expand Up @@ -914,6 +928,8 @@ func TestFillGaps(t *testing.T) {
// subprocesses to conflict.
itest.StopHorizon()

var disableCaptiveHTTPPort = uint(0)
horizonConfig.CaptiveCoreTomlParams.HTTPPort = &disableCaptiveHTTPPort
var oldestLedger, latestLedger int64
tt.NoError(historyQ.ElderLedger(context.Background(), &oldestLedger))
tt.NoError(historyQ.LatestLedger(context.Background(), &latestLedger))
Expand Down

0 comments on commit 3b335b7

Please sign in to comment.