Skip to content

Commit

Permalink
Minor test fixes + lint warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
bermuell committed Oct 5, 2023
1 parent 8326811 commit ea77c6e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
1 change: 0 additions & 1 deletion app/consumer/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ type (
// Migration of consumer genesis content as it is exported from a provider version v2
// to a version readable by current consumer (version v3).
func migrateFromV2(jsonRaw []byte, ctx client.Context) (json.RawMessage, error) {

// v2 uses deprecated fields of GenesisState type
oldConsumerGenesis := consumerTypes.GenesisState{}
err := ctx.Codec.UnmarshalJSON(jsonRaw, &oldConsumerGenesis)
Expand Down
16 changes: 8 additions & 8 deletions app/consumer/genesis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,20 @@ package app_test
import (
"bytes"
"context"
"fmt"
"io/fs"
"os"
"path/filepath"
"testing"
"time"

"github.com/spf13/cobra"
"github.com/stretchr/testify/require"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/x/auth/types"

app "github.com/cosmos/interchain-security/v3/app/consumer"
consumerTypes "github.com/cosmos/interchain-security/v3/x/ccv/consumer/types"
"github.com/spf13/cobra"
"github.com/stretchr/testify/require"
)

// Testdata mapping consumer genesis exports to a provider module version as
Expand Down Expand Up @@ -171,11 +173,12 @@ func getGenesisTransformCmd(t *testing.T) *cobra.Command {
// consumer genesis json format used by current consumer implementation.
func TestConsumerGenesisTransformationV2(t *testing.T) {
version := "v2"
filePath := os.TempDir() + "testdata.json"
filePath := filepath.Join(t.TempDir(), "oldConsumerGenesis.json")

err := os.WriteFile(
filePath,
[]byte(consumerGenesisStates[version]),
fs.FileMode(0644))
fs.FileMode(0o644))
require.NoError(t, err)
defer os.Remove(filePath)

Expand All @@ -191,10 +194,7 @@ func TestConsumerGenesisTransformationV2(t *testing.T) {
consumerGenesis := consumerTypes.GenesisState{}

bz := output.Bytes()
fmt.Println(string(bz))
// err = consumerGenesis.Unmarshal(output.Bytes())
ctx := client.GetClientContextFromCmd(cmd)

err = ctx.Codec.UnmarshalJSON(bz, &consumerGenesis)
require.NoError(t, err, "Error unmarshalling transformed genesis state :%s", err)

Expand Down

0 comments on commit ea77c6e

Please sign in to comment.