From 83d46bff4556fb4b26c9ab9270083d5d0901d595 Mon Sep 17 00:00:00 2001 From: Fangyu Gai Date: Wed, 11 Dec 2024 21:00:00 +0800 Subject: [PATCH] fix tests --- itest/e2e_test.go | 13 +++++++++---- itest/test_manager.go | 4 +--- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/itest/e2e_test.go b/itest/e2e_test.go index 7f5c986e..08525980 100644 --- a/itest/e2e_test.go +++ b/itest/e2e_test.go @@ -1,3 +1,6 @@ +//go:build e2e +// +build e2e + package e2etest import ( @@ -236,7 +239,7 @@ func TestFinalityProviderEditCmd(t *testing.T) { moniker = "test2-moniker" args = []string{ fpIns.GetBtcPkHex(), - "--" + fpdDaemonAddressFlag, tm.FpConfig.RPCListener, + "--" + fpdDaemonAddressFlag, fpIns.GetConfig().RPCListener, "--" + monikerFlag, moniker, } @@ -261,9 +264,11 @@ func TestFinalityProviderEditCmd(t *testing.T) { } func TestFinalityProviderCreateCmd(t *testing.T) { - tm, _ := StartManagerWithFinalityProvider(t, 1) + tm, fps := StartManagerWithFinalityProvider(t, 1) defer tm.Stop(t) + fpIns := fps[0] + cmd := daemon.CommandCreateFP() eotsKeyName := "eots-key-2" @@ -284,7 +289,7 @@ func TestFinalityProviderCreateCmd(t *testing.T) { Details string `json:"details"` EotsPK string `json:"eotsPK"` }{ - KeyName: tm.FpConfig.BabylonConfig.Key, + KeyName: fpIns.GetConfig().BabylonConfig.Key, ChainID: testChainID, Passphrase: passphrase, CommissionRate: "0.10", @@ -310,7 +315,7 @@ func TestFinalityProviderCreateCmd(t *testing.T) { cmd.SetArgs([]string{ "--from-file=" + file.Name(), - "--daemon-address=" + tm.FpConfig.RPCListener, + "--daemon-address=" + fpIns.GetConfig().RPCListener, }) // Run the command diff --git a/itest/test_manager.go b/itest/test_manager.go index e48b0ae8..309a8038 100644 --- a/itest/test_manager.go +++ b/itest/test_manager.go @@ -203,8 +203,6 @@ func (tm *TestManager) AddFinalityProvider(t *testing.T) *service.FinalityProvid err = fpServer.RunUntilShutdown() require.NoError(t, err) }() - // wait for the service to start - time.Sleep(5 * time.Second) tm.Fps = append(tm.Fps, fpApp) @@ -262,7 +260,7 @@ func (tm *TestManager) Stop(t *testing.T) { require.NoError(t, err) err = os.RemoveAll(tm.baseDir) require.NoError(t, err) - tm.EOTSServerHandler.Stop() + // tm.EOTSServerHandler.Stop() } func (tm *TestManager) WaitForFpPubRandTimestamped(t *testing.T, fpIns *service.FinalityProviderInstance) {