Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
krehermann committed Dec 9, 2024
1 parent 670c0b3 commit 38e01a5
Showing 1 changed file with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions core/cmd/shell_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,15 @@ func TestSetupSolanaRelayer(t *testing.T) {
require.Len(t, relayers, nEnabledChains)
// make sure registry has the plugin
require.Len(t, reg.List(), nEnabledChains)

// test idempotency
r2, err := rf.NewSolana(cfg)
require.NoError(t, err)
require.NotNil(t, r2)
require.Equal(t, len(relayers), len(r2))
for id, r := range relayers {
require.Equal(t, r.Name(), r2[id].Name())
}
})

// test that duplicate enabled chains is an error when
Expand Down Expand Up @@ -472,13 +481,6 @@ func TestSetupSolanaRelayer(t *testing.T) {
require.Contains(t, err.Error(), "failed to parse Solana env file")
})

t.Run("plugin already registered", func(t *testing.T) {
t.Setenv("CL_SOLANA_CMD", "phony_solana_cmd")

_, err := rf.NewSolana(cfg)
require.Error(t, err)
require.Contains(t, err.Error(), "failed to create Solana LOOP command")
})
}

func TestSetupStarkNetRelayer(t *testing.T) {
Expand Down Expand Up @@ -548,6 +550,15 @@ func TestSetupStarkNetRelayer(t *testing.T) {
require.Len(t, relayers, nEnabledChains)
// make sure registry has the plugin
require.Len(t, reg.List(), nEnabledChains)

// test idempotency
r2, err := rf.NewStarkNet(ks, tConfig.StarknetConfigs())
require.NoError(t, err)
require.NotNil(t, r2)
require.Equal(t, len(relayers), len(r2))
for id, r := range relayers {
require.Equal(t, r.Name(), r2[id].Name())
}
})

// test that duplicate enabled chains is an error when
Expand Down Expand Up @@ -590,14 +601,6 @@ func TestSetupStarkNetRelayer(t *testing.T) {
require.Error(t, err)
require.Contains(t, err.Error(), "failed to parse Starknet env file")
})

t.Run("plugin already registered", func(t *testing.T) {
t.Setenv("CL_STARKNET_CMD", "phony_starknet_cmd")

_, err := rf.NewStarkNet(ks, tConfig.StarknetConfigs())
require.Error(t, err)
require.Contains(t, err.Error(), "failed to create StarkNet LOOP command")
})
}

// flagSetApplyFromAction applies the flags from action to the flagSet.
Expand Down

0 comments on commit 38e01a5

Please sign in to comment.