Skip to content

Commit

Permalink
refactor: Capitalized e2e test action name (#1494)
Browse files Browse the repository at this point in the history
* Capitalized all action's names

* Fix typo ReDelegate
  • Loading branch information
neitdung authored Dec 11, 2023
1 parent a9b090f commit 8a5932d
Show file tree
Hide file tree
Showing 29 changed files with 637 additions and 637 deletions.
196 changes: 98 additions & 98 deletions tests/e2e/action_rapid_test.go

Large diffs are not rendered by default.

146 changes: 73 additions & 73 deletions tests/e2e/actions.go

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions tests/e2e/actions_consumer_misbehaviour.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ import (
"time"
)

// forkConsumerChainAction forks the consumer chain by cloning of a validator node
// ForkConsumerChainAction forks the consumer chain by cloning of a validator node
// Note that the chain fork is running in an different network
type forkConsumerChainAction struct {
type ForkConsumerChainAction struct {
ConsumerChain ChainID
ProviderChain ChainID
Validator ValidatorID
RelayerConfig string
}

func (tc TestConfig) forkConsumerChain(action forkConsumerChainAction, verbose bool) {
func (tc TestConfig) forkConsumerChain(action ForkConsumerChainAction, verbose bool) {
valCfg := tc.validatorConfigs[action.Validator]

//#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments.
Expand Down Expand Up @@ -62,15 +62,15 @@ func (tc TestConfig) forkConsumerChain(action forkConsumerChainAction, verbose b
time.Sleep(5 * time.Second)
}

type updateLightClientAction struct {
type UpdateLightClientAction struct {
Chain ChainID
HostChain ChainID
RelayerConfig string
ClientID string
}

func (tc TestConfig) updateLightClient(
action updateLightClientAction,
action UpdateLightClientAction,
verbose bool,
) {
// retrieve a trusted height of the consumer light client
Expand All @@ -86,7 +86,7 @@ func (tc TestConfig) updateLightClient(
"--trusted-height", strconv.Itoa(int(trustedHeight.RevisionHeight)),
)
if verbose {
log.Println("updateLightClientAction cmd:", cmd.String())
log.Println("UpdateLightClientAction cmd:", cmd.String())
}

bz, err := cmd.CombinedOutput()
Expand Down
6 changes: 3 additions & 3 deletions tests/e2e/actions_sovereign_chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func (tr TestConfig) startSovereignChain(
if err := scanner.Err(); err != nil {
log.Fatal(err)
}
tr.addChainToRelayer(addChainToRelayerAction{
tr.addChainToRelayer(AddChainToRelayerAction{
Chain: action.Chain,
Validator: action.Validators[0].Id,
}, verbose)
Expand Down Expand Up @@ -156,12 +156,12 @@ func (tr *TestConfig) submitLegacyUpgradeProposal(action LegacyUpgradeProposalAc
tr.waitBlocks(action.ChainID, 1, 15*time.Second)
}

type waitUntilBlockAction struct {
type WaitUntilBlockAction struct {
Block uint
Chain ChainID
}

func (tr *TestConfig) waitUntilBlockOnChain(action waitUntilBlockAction) {
func (tr *TestConfig) waitUntilBlockOnChain(action WaitUntilBlockAction) {
fmt.Println("waitUntilBlockOnChain is waiting for block:", action.Block)
tr.waitUntilBlock(action.Chain, action.Block, 120*time.Second)
fmt.Println("waitUntilBlockOnChain done waiting for block:", action.Block)
Expand Down
132 changes: 66 additions & 66 deletions tests/e2e/json_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ func (step *Step) UnmarshalJSON(data []byte) error {
func UnmarshalMapToActionType(rawAction json.RawMessage, actionTypeString string) (interface{}, error) {
var err error
switch actionTypeString {
case "main.submitConsumerAdditionProposalAction":
var a submitConsumerAdditionProposalAction
case "main.SubmitConsumerAdditionProposalAction":
var a SubmitConsumerAdditionProposalAction
err = json.Unmarshal(rawAction, &a)
if err == nil {
return a, nil
Expand All @@ -83,152 +83,152 @@ func UnmarshalMapToActionType(rawAction json.RawMessage, actionTypeString string
if err == nil {
return a, nil
}
case "main.submitTextProposalAction":
var a submitTextProposalAction
case "main.SubmitTextProposalAction":
var a SubmitTextProposalAction
err := json.Unmarshal(rawAction, &a)
if err == nil {
return a, nil
}
case "main.submitConsumerRemovalProposalAction":
var a submitConsumerRemovalProposalAction
case "main.SubmitConsumerRemovalProposalAction":
var a SubmitConsumerRemovalProposalAction
err := json.Unmarshal(rawAction, &a)
if err == nil {
return a, nil
}
case "main.submitParamChangeLegacyProposalAction":
var a submitParamChangeLegacyProposalAction
case "main.SubmitParamChangeLegacyProposalAction":
var a SubmitParamChangeLegacyProposalAction
err := json.Unmarshal(rawAction, &a)
if err == nil {
return a, nil
}
case "main.voteGovProposalAction":
var a voteGovProposalAction
case "main.VoteGovProposalAction":
var a VoteGovProposalAction
err := json.Unmarshal(rawAction, &a)
if err == nil {
return a, nil
}
case "main.startConsumerChainAction":
var a startConsumerChainAction
case "main.StartConsumerChainAction":
var a StartConsumerChainAction
err := json.Unmarshal(rawAction, &a)
if err == nil {
return a, nil
}
case "main.addChainToRelayerAction":
var a addChainToRelayerAction
case "main.AddChainToRelayerAction":
var a AddChainToRelayerAction
err := json.Unmarshal(rawAction, &a)
if err == nil {
return a, nil
}
case "main.addIbcConnectionAction":
var a addIbcConnectionAction
case "main.AddIbcConnectionAction":
var a AddIbcConnectionAction
err := json.Unmarshal(rawAction, &a)
if err == nil {
return a, nil
}
case "main.addIbcChannelAction":
var a addIbcChannelAction
case "main.AddIbcChannelAction":
var a AddIbcChannelAction
err := json.Unmarshal(rawAction, &a)
if err == nil {
return a, nil
}
case "main.transferChannelCompleteAction":
var a transferChannelCompleteAction
case "main.TransferChannelCompleteAction":
var a TransferChannelCompleteAction
err := json.Unmarshal(rawAction, &a)
if err == nil {
return a, nil
}
case "main.unjailValidatorAction":
var a unjailValidatorAction
case "main.UnjailValidatorAction":
var a UnjailValidatorAction
err := json.Unmarshal(rawAction, &a)
if err == nil {
return a, nil
}
case "main.assignConsumerPubKeyAction":
var a assignConsumerPubKeyAction
case "main.AssignConsumerPubKeyAction":
var a AssignConsumerPubKeyAction
err := json.Unmarshal(rawAction, &a)
if err == nil {
return a, nil
}
case "main.delegateTokensAction":
var a delegateTokensAction
case "main.DelegateTokensAction":
var a DelegateTokensAction
err := json.Unmarshal(rawAction, &a)
if err == nil {
return a, nil
}
case "main.relayPacketsAction":
var a relayPacketsAction
case "main.RelayPacketsAction":
var a RelayPacketsAction
err := json.Unmarshal(rawAction, &a)
if err == nil {
return a, nil
}
case "main.registerRepresentativeAction":
var a registerRepresentativeAction
case "main.RegisterRepresentativeAction":
var a RegisterRepresentativeAction
err := json.Unmarshal(rawAction, &a)
if err == nil {
return a, nil
}
case "main.relayRewardPacketsToProviderAction":
var a relayRewardPacketsToProviderAction
case "main.RelayRewardPacketsToProviderAction":
var a RelayRewardPacketsToProviderAction
err := json.Unmarshal(rawAction, &a)
if err == nil {
return a, nil
}
case "main.submitChangeRewardDenomsProposalAction":
var a submitChangeRewardDenomsProposalAction
case "main.SubmitChangeRewardDenomsProposalAction":
var a SubmitChangeRewardDenomsProposalAction
err := json.Unmarshal(rawAction, &a)
if err == nil {
return a, nil
}
case "main.downtimeSlashAction":
var a downtimeSlashAction
case "main.DowntimeSlashAction":
var a DowntimeSlashAction
err := json.Unmarshal(rawAction, &a)
if err == nil {
return a, nil
}
case "main.unbondTokensAction":
var a unbondTokensAction
case "main.UnbondTokensAction":
var a UnbondTokensAction
err := json.Unmarshal(rawAction, &a)
if err == nil {
return a, nil
}
case "main.cancelUnbondTokensAction":
var a cancelUnbondTokensAction
case "main.CancelUnbondTokensAction":
var a CancelUnbondTokensAction
err := json.Unmarshal(rawAction, &a)
if err == nil {
return a, nil
}
case "main.redelegateTokensAction":
var a redelegateTokensAction
case "main.RedelegateTokensAction":
var a RedelegateTokensAction
err := json.Unmarshal(rawAction, &a)
if err == nil {
return a, nil
}
case "main.doublesignSlashAction":
var a doublesignSlashAction
case "main.DoublesignSlashAction":
var a DoublesignSlashAction
err := json.Unmarshal(rawAction, &a)
if err == nil {
return a, nil
}
case "main.startRelayerAction":
var a startRelayerAction
case "main.StartRelayerAction":
var a StartRelayerAction
err := json.Unmarshal(rawAction, &a)
if err == nil {
return a, nil
}
case "main.slashMeterReplenishmentAction":
var a slashMeterReplenishmentAction
case "main.SlashMeterReplenishmentAction":
var a SlashMeterReplenishmentAction
err := json.Unmarshal(rawAction, &a)
if err == nil {
return a, nil
}
case "main.waitTimeAction":
var a waitTimeAction
case "main.WaitTimeAction":
var a WaitTimeAction
err := json.Unmarshal(rawAction, &a)
if err == nil {
return a, nil
}
case "main.createIbcClientsAction":
var a createIbcClientsAction
case "main.CreateIbcClientsAction":
var a CreateIbcClientsAction
err := json.Unmarshal(rawAction, &a)
if err == nil {
return a, nil
Expand All @@ -239,8 +239,8 @@ func UnmarshalMapToActionType(rawAction json.RawMessage, actionTypeString string
if err == nil {
return a, nil
}
case "main.waitUntilBlockAction":
var a waitUntilBlockAction
case "main.WaitUntilBlockAction":
var a WaitUntilBlockAction
err := json.Unmarshal(rawAction, &a)
if err == nil {
return a, nil
Expand All @@ -257,38 +257,38 @@ func UnmarshalMapToActionType(rawAction json.RawMessage, actionTypeString string
if err == nil {
return a, nil
}
case "main.lightClientEquivocationAttackAction":
var a lightClientEquivocationAttackAction
case "main.LightClientEquivocationAttackAction":
var a LightClientEquivocationAttackAction
err := json.Unmarshal(rawAction, &a)
if err == nil {
return a, nil
}
case "main.lightClientAmnesiaAttackAction":
var a lightClientAmnesiaAttackAction
case "main.LightClientAmnesiaAttackAction":
var a LightClientAmnesiaAttackAction
err := json.Unmarshal(rawAction, &a)
if err == nil {
return a, nil
}
case "main.lightClientLunaticAttackAction":
var a lightClientLunaticAttackAction
case "main.LightClientLunaticAttackAction":
var a LightClientLunaticAttackAction
err := json.Unmarshal(rawAction, &a)
if err == nil {
return a, nil
}
case "main.forkConsumerChainAction":
var a forkConsumerChainAction
case "main.ForkConsumerChainAction":
var a ForkConsumerChainAction
err := json.Unmarshal(rawAction, &a)
if err == nil {
return a, nil
}
case "main.startConsumerEvidenceDetectorAction":
var a startConsumerEvidenceDetectorAction
case "main.StartConsumerEvidenceDetectorAction":
var a StartConsumerEvidenceDetectorAction
err := json.Unmarshal(rawAction, &a)
if err == nil {
return a, nil
}
case "main.updateLightClientAction":
var a updateLightClientAction
case "main.UpdateLightClientAction":
var a UpdateLightClientAction
err := json.Unmarshal(rawAction, &a)
if err == nil {
return a, nil
Expand Down
Loading

0 comments on commit 8a5932d

Please sign in to comment.