Skip to content

Commit

Permalink
fix test spec
Browse files Browse the repository at this point in the history
  • Loading branch information
kocubinski committed Sep 20, 2024
1 parent 6cfe75f commit 62f47d8
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 15 deletions.
4 changes: 2 additions & 2 deletions tests/integration/tx/aminojson/aminojson_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -341,8 +341,8 @@ func TestAminoJSON_LegacyParity(t *testing.T) {
dynamicBytes, err := aj.Marshal(fixture.DynamicMessage(t, tc.gogo))
require.NoError(t, err)

fmt.Printf("legacy: %s\n", string(legacyBytes))
fmt.Printf(" sut: %s\n", string(dynamicBytes))
t.Logf("legacy: %s\n", string(legacyBytes))
t.Logf(" sut: %s\n", string(dynamicBytes))
if tc.fails {
require.NotEqual(t, string(legacyBytes), string(dynamicBytes))
return
Expand Down
7 changes: 6 additions & 1 deletion tests/integration/tx/context_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"cosmossdk.io/depinject"
"cosmossdk.io/log"
_ "cosmossdk.io/x/accounts"
"cosmossdk.io/x/tx/signing"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
"github.com/cosmos/cosmos-sdk/tests/integration/tx/internal"
"github.com/cosmos/cosmos-sdk/tests/integration/tx/internal/pulsar/testpb"
Expand All @@ -14,6 +15,10 @@ import (
"github.com/stretchr/testify/require"
)

func ProvideCustomGetSigner() signing.CustomGetSigner {
return internal.TestRepeatedFieldsSigner
}

func TestDefineCustomGetSigners(t *testing.T) {
var interfaceRegistry codectypes.InterfaceRegistry
_, err := simtestutil.SetupAtGenesis(
Expand All @@ -26,7 +31,7 @@ func TestDefineCustomGetSigners(t *testing.T) {
configurator.ConsensusModule(),
),
depinject.Supply(log.NewNopLogger()),
depinject.Provide(internal.ProvideCustomGetSigner),
depinject.Provide(ProvideCustomGetSigner),
),
&interfaceRegistry,
)
Expand Down
20 changes: 9 additions & 11 deletions tests/integration/tx/internal/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,14 @@ import (
gogoproto "github.com/cosmos/gogoproto/proto"
)

func ProvideCustomGetSigner() signing.CustomGetSigner {
return signing.CustomGetSigner{
MsgType: proto.MessageName(&testpb.TestRepeatedFields{}),
Fn: func(msg proto.Message) ([][]byte, error) {
testMsg := msg.(*testpb.TestRepeatedFields)
// arbitrary logic
signer := testMsg.NullableDontOmitempty[1].Value
return [][]byte{[]byte(signer)}, nil
},
}
var TestRepeatedFieldsSigner = signing.CustomGetSigner{
MsgType: proto.MessageName(&testpb.TestRepeatedFields{}),
Fn: func(msg proto.Message) ([][]byte, error) {
testMsg := msg.(*testpb.TestRepeatedFields)
// arbitrary logic
signer := testMsg.NullableDontOmitempty[1].Value
return [][]byte{[]byte(signer)}, nil
},
}

type noOpAddressCodec struct{}
Expand Down Expand Up @@ -71,7 +69,7 @@ func NewSigningFixture(
t.Helper()
// set up transaction and signing infra
addressCodec, valAddressCodec := noOpAddressCodec{}, noOpAddressCodec{}
customGetSigners := []signing.CustomGetSigner{ProvideCustomGetSigner()}
customGetSigners := []signing.CustomGetSigner{TestRepeatedFieldsSigner}
interfaceRegistry, _, err := codec.ProvideInterfaceRegistry(
addressCodec,
valAddressCodec,
Expand Down
2 changes: 1 addition & 1 deletion x/auth/migrations/legacytx/stdtx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func TestStdSignBytes(t *testing.T) {
Amount: []*basev1beta1.Coin{{Denom: "atom", Amount: "150"}},
GasLimit: 100000,
}
msgStr := fmt.Sprintf(`{"type":"testpb/TestMsg","value":{"decField":"0","signers":["%s"]}}`, addr)
msgStr := fmt.Sprintf(`{"type":"testpb/TestMsg","value":{"decField":"0.000000000000000000","signers":["%s"]}}`, addr)
tests := []struct {
name string
args args
Expand Down

0 comments on commit 62f47d8

Please sign in to comment.