From 4d4f9e308965545684fc881a7af491ee45a0ca19 Mon Sep 17 00:00:00 2001 From: lazar Date: Tue, 17 Sep 2024 12:12:23 +0200 Subject: [PATCH] wrangling ports --- e2etest/container/config.go | 4 ++-- e2etest/container/container.go | 22 ++++++++++++++++------ e2etest/submitter_e2e_test.go | 1 - e2etest/test_manager.go | 3 ++- 4 files changed, 20 insertions(+), 10 deletions(-) diff --git a/e2etest/container/config.go b/e2etest/container/config.go index f37297f9..ffc45aca 100644 --- a/e2etest/container/config.go +++ b/e2etest/container/config.go @@ -13,8 +13,8 @@ type ImageConfig struct { const ( dockerBitcoindRepository = "lncm/bitcoind" dockerBitcoindVersionTag = "v27.0" - dockerBabylondRepository = "babylonlabs-io/babylond" - dockerBabylondVersionTag = "latest" // todo(Lazar): we need version b1e255a + dockerBabylondRepository = "babylonlabs/babylond" + dockerBabylondVersionTag = "8e0222804ed19b18d74d599b80baa18f05e87d8a" // this is built from commit b1e255a ) // NewImageConfig returns ImageConfig needed for running e2e test. diff --git a/e2etest/container/container.go b/e2etest/container/container.go index 5aad54f3..7dff1f55 100644 --- a/e2etest/container/container.go +++ b/e2etest/container/container.go @@ -19,8 +19,8 @@ import ( ) const ( - bitcoindContainerName = "bitcoind-test" - babylondContainerName = "babylond-test" + bitcoindContainerName = "bitcoind" + babylondContainerName = "babylond" ) var ( @@ -142,13 +142,24 @@ func (m *Manager) RunBitcoindResource( ) (*dockertest.Resource, error) { bitcoindResource, err := m.pool.RunWithOptions( &dockertest.RunOptions{ - Name: bitcoindContainerName, + Name: fmt.Sprintf("%s-%s", bitcoindContainerName, t.Name()), Repository: m.cfg.BitcoindRepository, Tag: m.cfg.BitcoindVersion, User: "root:root", + Labels: map[string]string{ + "e2e": "bitcoind", + }, Mounts: []string{ fmt.Sprintf("%s/:/data/.bitcoin", bitcoindCfgPath), }, + ExposedPorts: []string{ + "8332", + "8333", + "28332", + "28333", + "18443", + "18444", + }, Cmd: []string{ "-regtest", "-txindex", @@ -200,7 +211,7 @@ func (m *Manager) RunBabylondResource( resource, err := m.pool.RunWithOptions( &dockertest.RunOptions{ - Name: babylondContainerName, + Name: fmt.Sprintf("%s-%s", babylondContainerName, t.Name()), Repository: m.cfg.BabylonRepository, Tag: m.cfg.BabylonVersion, Labels: map[string]string{ @@ -242,7 +253,6 @@ func (m *Manager) RunBabylondResource( // ClearResources removes all outstanding Docker resources created by the Manager. func (m *Manager) ClearResources() error { for _, resource := range m.resources { - fmt.Printf("cleaning %s\n", resource.Container.Name) if err := m.pool.Purge(resource); err != nil { continue } @@ -252,7 +262,7 @@ func (m *Manager) ClearResources() error { } func noRestart(config *docker.HostConfig) { - // in this case we don't want the nodes to restart on failure + // in this case, we don't want the nodes to restart on failure config.RestartPolicy = docker.RestartPolicy{ Name: "no", } diff --git a/e2etest/submitter_e2e_test.go b/e2etest/submitter_e2e_test.go index e8751b78..c01d85dc 100644 --- a/e2etest/submitter_e2e_test.go +++ b/e2etest/submitter_e2e_test.go @@ -187,7 +187,6 @@ func TestSubmitterSubmissionReplace(t *testing.T) { } func TestSubmitterDocker(t *testing.T) { - numMatureOutputs := uint32(10) tm := StartManager(t, numMatureOutputs, defaultEpochInterval) diff --git a/e2etest/test_manager.go b/e2etest/test_manager.go index 8af00104..7c9ee9f0 100644 --- a/e2etest/test_manager.go +++ b/e2etest/test_manager.go @@ -60,6 +60,7 @@ type TestManager struct { BTCClient *btcclient.Client Config *config.Config WalletPrivKey *btcec.PrivateKey + manger *container.Manager } func initBTCClientWithSubscriber(t *testing.T, cfg *config.Config) *btcclient.Client { @@ -162,11 +163,11 @@ func StartManager(t *testing.T, numMatureOutputsInWallet uint32, epochInterval u BTCClient: btcClient, Config: cfg, WalletPrivKey: walletPrivKey, + manger: manager, } } func (tm *TestManager) Stop(t *testing.T) { - tm.BitcoindHandler.Stop() if tm.BabylonClient.IsRunning() { err := tm.BabylonClient.Stop() require.NoError(t, err)