Skip to content

Commit

Permalink
Allow using captive core in integration tests (#3107)
Browse files Browse the repository at this point in the history
To do so, you need to set the
`HORIZON_INTEGRATION_ENABLE_CAPTIVE_CORE` env variable
to any value (e.g. `true`).
  • Loading branch information
2opremio authored Oct 8, 2020
1 parent 63e0e3f commit 34bf6a5
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions services/horizon/internal/test/integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,16 +274,26 @@ func createTestContainer(i *IntegrationTest, image string) error {
t.Log("Creating container...")
ctx, cancel = context.WithTimeout(context.Background(), 5*time.Minute)
defer cancel()
containerConfig := &container.Config{
Image: image,
Cmd: []string{
"--standalone",
"--protocol-version", strconv.FormatInt(int64(i.config.ProtocolVersion), 10),
},
ExposedPorts: nat.PortSet{"8000": struct{}{}, "6060": struct{}{}},
}

if os.Getenv("HORIZON_INTEGRATION_ENABLE_CAPTIVE_CORE") != "" {
containerConfig.Env = append(containerConfig.Env,
"ENABLE_CAPTIVE_CORE_INGESTION=true",
"STELLAR_CORE_BINARY_PATH=/opt/stellar/core/bin/start",
"STELLAR_CORE_CONFIG_PATH=/opt/stellar/core/etc/stellar-core.cfg",
)
}

i.container, err = i.cli.ContainerCreate(
ctx,
&container.Config{
Image: image,
Cmd: []string{
"--standalone",
"--protocol-version", strconv.FormatInt(int64(i.config.ProtocolVersion), 10),
},
ExposedPorts: nat.PortSet{"8000": struct{}{}, "6060": struct{}{}},
},
containerConfig,
&container.HostConfig{
PortBindings: map[nat.Port][]nat.PortBinding{
nat.Port("8000"): {{HostIP: "127.0.0.1", HostPort: "8000"}},
Expand Down

0 comments on commit 34bf6a5

Please sign in to comment.