Skip to content

Commit

Permalink
Update parameters_test.go
Browse files Browse the repository at this point in the history
  • Loading branch information
aditya1702 committed Nov 2, 2023
1 parent 867e3d5 commit d54fa7c
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions services/horizon/internal/integration/parameters_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ const (
PUBLIC_KEY="GD5KD2KEZJIGTC63IGW6UMUSMVUVG5IHG64HUTFWCHVZH2N2IBOQN7PS"
ADDRESS="localhost"
QUALITY="MEDIUM"`

STELLAR_CORE_URL = "http://localhost:11626"

Check failure on line 57 in services/horizon/internal/integration/parameters_test.go

View workflow job for this annotation

GitHub Actions / golangci

ST1003: should not use ALL_CAPS in Go names; use CamelCase instead (stylecheck)
)

var (
Expand Down Expand Up @@ -97,37 +99,34 @@ func TestEnvironmentPreserved(t *testing.T) {
// running an integration test.

// Note that we ALSO need to make sure we don't modify parent env state.
value, isSet := os.LookupEnv("CAPTIVE_CORE_CONFIG_PATH")
value, isSet := os.LookupEnv("STELLAR_CORE_URL")
defer func() {
if isSet {
_ = os.Setenv("CAPTIVE_CORE_CONFIG_PATH", value)
_ = os.Setenv("STELLAR_CORE_URL", value)
} else {
_ = os.Unsetenv("CAPTIVE_CORE_CONFIG_PATH")
_ = os.Unsetenv("STELLAR_CORE_URL")
}
}()

err := os.Setenv("CAPTIVE_CORE_CONFIG_PATH", "original value")
err := os.Setenv("STELLAR_CORE_URL", "original value")
assert.NoError(t, err)

confName, _, cleanup := createCaptiveCoreConfig(SIMPLE_CAPTIVE_CORE_TOML)
defer cleanup()
testConfig := integration.GetTestConfig()
testConfig.HorizonEnvironment = map[string]string{
"CAPTIVE_CORE_CONFIG_PATH": confName,
"CAPTIVE_CORE_BINARY_PATH": os.Getenv("HORIZON_INTEGRATION_TESTS_CAPTIVE_CORE_BIN"),
"STELLAR_CORE_URL": STELLAR_CORE_URL,
}
test := integration.NewTest(t, *testConfig)

err = test.StartHorizon()
assert.NoError(t, err)
test.WaitForHorizon()

envValue := os.Getenv("CAPTIVE_CORE_CONFIG_PATH")
assert.Equal(t, confName, envValue)
envValue := os.Getenv("STELLAR_CORE_URL")
assert.Equal(t, STELLAR_CORE_URL, envValue)

test.Shutdown()

envValue = os.Getenv("CAPTIVE_CORE_CONFIG_PATH")
envValue = os.Getenv("STELLAR_CORE_URL")
assert.Equal(t, "original value", envValue)
}

Expand Down

0 comments on commit d54fa7c

Please sign in to comment.