From 1c4e0d46c883721c71c7a38fca80863a3838b702 Mon Sep 17 00:00:00 2001 From: Bernd Date: Mon, 7 Aug 2023 17:43:18 +0200 Subject: [PATCH 1/4] Tests: Fix failing e2e tests --- tests/e2e/actions.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/e2e/actions.go b/tests/e2e/actions.go index 8faca43c0a..131982651b 100644 --- a/tests/e2e/actions.go +++ b/tests/e2e/actions.go @@ -1819,8 +1819,9 @@ type assignConsumerPubKeyAction struct { func (tr TestRun) assignConsumerPubKey(action assignConsumerPubKeyAction, verbose bool) { valCfg := tr.validatorConfigs[action.validator] + // Note: to get error response reported back from this command '--gas auto' needs to be set. assignKey := fmt.Sprintf( - `%s tx provider assign-consensus-key %s '%s' --from validator%s --chain-id %s --home %s --node %s --gas 90000 --keyring-backend test -y -o json`, + `%s tx provider assign-consensus-key %s '%s' --from validator%s --chain-id %s --home %s --node %s --gas auto --keyring-backend test -y -o json`, tr.chainConfigs[chainID("provi")].binaryName, string(tr.chainConfigs[action.chain].chainId), action.consumerPubkey, @@ -1847,6 +1848,10 @@ func (tr TestRun) assignConsumerPubKey(action assignConsumerPubKeyAction, verbos } if action.expectError { + if err == nil { + log.Fatalf("expected error not raised: %s", string(bz)) + } + if verbose { fmt.Printf("got expected error during key assignment | err: %s \n", err.Error()) } From 2abfe71086f156a6a0fdaff0cac49caa86db20ba Mon Sep 17 00:00:00 2001 From: bernd-m <43466467+bermuell@users.noreply.github.com> Date: Tue, 8 Aug 2023 15:10:06 +0200 Subject: [PATCH 2/4] Update tests/e2e/actions.go Co-authored-by: MSalopek --- tests/e2e/actions.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/e2e/actions.go b/tests/e2e/actions.go index 131982651b..2428326c3e 100644 --- a/tests/e2e/actions.go +++ b/tests/e2e/actions.go @@ -1853,7 +1853,7 @@ func (tr TestRun) assignConsumerPubKey(action assignConsumerPubKeyAction, verbos } if verbose { - fmt.Printf("got expected error during key assignment | err: %s \n", err.Error()) + fmt.Printf("got expected error during key assignment | err: %s | output: %s \n", err, string(bz)) } } From 660091ea3baaee9894f787aa009ed8126934c800 Mon Sep 17 00:00:00 2001 From: MSalopek Date: Tue, 8 Aug 2023 15:49:31 +0200 Subject: [PATCH 3/4] chore: appease lint rules --- tests/e2e/actions.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/e2e/actions.go b/tests/e2e/actions.go index 2428326c3e..40b0c389ee 100644 --- a/tests/e2e/actions.go +++ b/tests/e2e/actions.go @@ -1853,7 +1853,7 @@ func (tr TestRun) assignConsumerPubKey(action assignConsumerPubKeyAction, verbos } if verbose { - fmt.Printf("got expected error during key assignment | err: %s | output: %s \n", err, string(bz)) + fmt.Printf("got expected error during key assignment | err: %s | output: %s \n", err, string(bz)) } } From c12725764bb69189254b562d84f9f922cab2d8a4 Mon Sep 17 00:00:00 2001 From: Bernd Date: Wed, 9 Aug 2023 09:09:18 +0200 Subject: [PATCH 4/4] added check error message --- tests/e2e/actions.go | 7 ++++--- tests/e2e/steps_start_chains.go | 2 ++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/e2e/actions.go b/tests/e2e/actions.go index 40b0c389ee..faad8cb6f8 100644 --- a/tests/e2e/actions.go +++ b/tests/e2e/actions.go @@ -1813,7 +1813,8 @@ type assignConsumerPubKeyAction struct { // reconfigureNode will change keys the node uses and restart reconfigureNode bool // executing the action should raise an error - expectError bool + expectError bool + expectedError string } func (tr TestRun) assignConsumerPubKey(action assignConsumerPubKeyAction, verbose bool) { @@ -1848,8 +1849,8 @@ func (tr TestRun) assignConsumerPubKey(action assignConsumerPubKeyAction, verbos } if action.expectError { - if err == nil { - log.Fatalf("expected error not raised: %s", string(bz)) + if err == nil || !strings.Contains(string(bz), action.expectedError) { + log.Fatalf("expected error not raised: expected: '%s', got '%s'", action.expectedError, (bz)) } if verbose { diff --git a/tests/e2e/steps_start_chains.go b/tests/e2e/steps_start_chains.go index 15d0045760..6017a22641 100644 --- a/tests/e2e/steps_start_chains.go +++ b/tests/e2e/steps_start_chains.go @@ -88,6 +88,7 @@ func stepsStartConsumerChain(consumerName string, proposalIndex, chainIndex uint consumerPubkey: `{"@type":"/cosmos.crypto.ed25519.PubKey","key":"Ui5Gf1+mtWUdH8u3xlmzdKID+F3PK0sfXZ73GZ6q6is="}`, reconfigureNode: false, expectError: true, + expectedError: "a validator has assigned the consumer key already: consumer key is already in use by a validator", }, state: State{}, }, @@ -100,6 +101,7 @@ func stepsStartConsumerChain(consumerName string, proposalIndex, chainIndex uint consumerPubkey: `{"@type":"/cosmos.crypto.ed25519.PubKey","key":"Ui5Gf1+mtWUdH8u3xlmzdKID+F3PK0sfXZ73GZ6q6is="}`, reconfigureNode: false, expectError: true, + expectedError: "a validator has assigned the consumer key already: consumer key is already in use by a validator", }, state: State{ chainID(consumerName): ChainState{