From efb37b0e658b041b4b6bb1365da5fa6d25120a01 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Tue, 24 Oct 2023 13:36:03 +0300 Subject: [PATCH] [#750] adm: Fix invalid tests Introduced in a9d04ba86f2. Signed-off-by: Evgenii Stratonikov --- .../internal/modules/morph/initialize_test.go | 10 ++++++++-- cmd/frostfs-adm/internal/modules/morph/root.go | 4 ++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/cmd/frostfs-adm/internal/modules/morph/initialize_test.go b/cmd/frostfs-adm/internal/modules/morph/initialize_test.go index 30a7168d..39da5666 100644 --- a/cmd/frostfs-adm/internal/modules/morph/initialize_test.go +++ b/cmd/frostfs-adm/internal/modules/morph/initialize_test.go @@ -20,7 +20,7 @@ import ( ) const ( - contractsPath = "../../../../../../frostfs-contract/frostfs-contract-v0.16.0.tar.gz" + contractsPath = "../../../../../../contract/frostfs-contract-v0.18.0.tar.gz" protoFileName = "proto.yml" ) @@ -58,7 +58,9 @@ func testInitialize(t *testing.T, committeeSize int) { // Set to the path or remove the next statement to download from the network. require.NoError(t, initCmd.Flags().Set(contractsInitFlag, contractsPath)) - v.Set(localDumpFlag, filepath.Join(testdataDir, "out")) + + dumpPath := filepath.Join(testdataDir, "out") + require.NoError(t, initCmd.Flags().Set(localDumpFlag, dumpPath)) v.Set(alphabetWalletsFlag, testdataDir) v.Set(epochDurationInitFlag, 1) v.Set(maxObjectSizeInitFlag, 1024) @@ -67,12 +69,15 @@ func testInitialize(t *testing.T, committeeSize int) { require.NoError(t, initializeSideChainCmd(initCmd, nil)) t.Run("force-new-epoch", func(t *testing.T) { + require.NoError(t, forceNewEpoch.Flags().Set(localDumpFlag, dumpPath)) require.NoError(t, forceNewEpochCmd(forceNewEpoch, nil)) }) t.Run("set-config", func(t *testing.T) { + require.NoError(t, setConfig.Flags().Set(localDumpFlag, dumpPath)) require.NoError(t, setConfigCmd(setConfig, []string{"MaintenanceModeAllowed=true"})) }) t.Run("set-policy", func(t *testing.T) { + require.NoError(t, setPolicy.Flags().Set(localDumpFlag, dumpPath)) require.NoError(t, setPolicyCmd(setPolicy, []string{"ExecFeeFactor=1"})) }) t.Run("remove-node", func(t *testing.T) { @@ -80,6 +85,7 @@ func testInitialize(t *testing.T, committeeSize int) { require.NoError(t, err) pub := hex.EncodeToString(pk.PublicKey().Bytes()) + require.NoError(t, removeNodes.Flags().Set(localDumpFlag, dumpPath)) require.NoError(t, removeNodesCmd(removeNodes, []string{pub})) }) } diff --git a/cmd/frostfs-adm/internal/modules/morph/root.go b/cmd/frostfs-adm/internal/modules/morph/root.go index bee1837a..133d5162 100644 --- a/cmd/frostfs-adm/internal/modules/morph/root.go +++ b/cmd/frostfs-adm/internal/modules/morph/root.go @@ -320,6 +320,7 @@ func initSetConfigCmd() { setConfig.Flags().String(alphabetWalletsFlag, "", "Path to alphabet wallets dir") setConfig.Flags().StringP(endpointFlag, "r", "", "N3 RPC node endpoint") setConfig.Flags().Bool(forceConfigSet, false, "Force setting not well-known configuration key") + setConfig.Flags().String(localDumpFlag, "", "Path to the blocks dump file") } func initDumpNetworkConfigCmd() { @@ -337,18 +338,21 @@ func initSetPolicyCmd() { RootCmd.AddCommand(setPolicy) setPolicy.Flags().String(alphabetWalletsFlag, "", "Path to alphabet wallets dir") setPolicy.Flags().StringP(endpointFlag, "r", "", "N3 RPC node endpoint") + setPolicy.Flags().String(localDumpFlag, "", "Path to the blocks dump file") } func initRemoveNodesCmd() { RootCmd.AddCommand(removeNodes) removeNodes.Flags().String(alphabetWalletsFlag, "", "Path to alphabet wallets dir") removeNodes.Flags().StringP(endpointFlag, "r", "", "N3 RPC node endpoint") + removeNodes.Flags().String(localDumpFlag, "", "Path to the blocks dump file") } func initForceNewEpochCmd() { RootCmd.AddCommand(forceNewEpoch) forceNewEpoch.Flags().String(alphabetWalletsFlag, "", "Path to alphabet wallets dir") forceNewEpoch.Flags().StringP(endpointFlag, "r", "", "N3 RPC node endpoint") + forceNewEpoch.Flags().String(localDumpFlag, "", "Path to the blocks dump file") } func initGenerateStorageCmd() {