Skip to content

Commit

Permalink
fix lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
pythonberg1997 committed Aug 9, 2023
1 parent 8f22e46 commit 1946302
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 21 deletions.
15 changes: 10 additions & 5 deletions e2e/tests/storage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,8 @@ func (s *StorageTestSuite) TestCreateGroup() {

// 4. UpdateGroupMember(add)
membersToAdd := []*storagetypes.MsgGroupMember{
{Member: member.GetAddr().String(), ExpirationTime: storagetypes.MaxTimeStamp}}
{Member: member.GetAddr().String()},
}
membersToDelete := []sdk.AccAddress{}
msgUpdateGroupMember := storagetypes.NewMsgUpdateGroupMember(owner.GetAddr(), owner.GetAddr(), groupName, membersToAdd, membersToDelete)
s.SendTxBlock(owner, msgUpdateGroupMember)
Expand All @@ -320,7 +321,8 @@ func (s *StorageTestSuite) TestCreateGroup() {
// 5. UpdateGroupMember(delete)
member2 := s.GenAndChargeAccounts(1, 1000000)[0]
membersToAdd = []*storagetypes.MsgGroupMember{
{Member: member2.GetAddr().String(), ExpirationTime: storagetypes.MaxTimeStamp}}
{Member: member2.GetAddr().String()},
}
membersToDelete = []sdk.AccAddress{member.GetAddr()}
msgUpdateGroupMember = storagetypes.NewMsgUpdateGroupMember(owner.GetAddr(), owner.GetAddr(), groupName, membersToAdd, membersToDelete)
s.SendTxBlock(owner, msgUpdateGroupMember)
Expand Down Expand Up @@ -351,7 +353,8 @@ func (s *StorageTestSuite) TestLeaveGroup() {
s.SendTxBlock(owner, msgCreateGroup)
s.T().Logf("CerateGroup success, owner: %s, group name: %s", owner.GetAddr().String(), groupName)
membersToAdd := []*storagetypes.MsgGroupMember{
{Member: member.GetAddr().String(), ExpirationTime: storagetypes.MaxTimeStamp}}
{Member: member.GetAddr().String()},
}
membersToDelete := []sdk.AccAddress{}
msgUpdateGroupMember := storagetypes.NewMsgUpdateGroupMember(owner.GetAddr(), owner.GetAddr(), groupName, membersToAdd, membersToDelete)
s.SendTxBlock(owner, msgUpdateGroupMember)
Expand Down Expand Up @@ -389,7 +392,8 @@ func (s *StorageTestSuite) TestLeaveGroup() {
// 4. UpdateGroupMember
member2 := s.GenAndChargeAccounts(1, 1000000)[0]
membersToAdd = []*storagetypes.MsgGroupMember{
{Member: member2.GetAddr().String(), ExpirationTime: storagetypes.MaxTimeStamp}}
{Member: member2.GetAddr().String()},
}
membersToDelete = []sdk.AccAddress{member.GetAddr()}
msgUpdateGroupMember = storagetypes.NewMsgUpdateGroupMember(owner.GetAddr(), owner.GetAddr(), groupName, membersToAdd, membersToDelete)
s.SendTxBlock(owner, msgUpdateGroupMember)
Expand Down Expand Up @@ -1561,7 +1565,8 @@ func (s *StorageTestSuite) TestCreateAndRenewGroup() {
expiration, err := time.Parse(time.RFC3339, "2022-12-31T23:59:59Z")
s.Require().NoError(err)
members := []*storagetypes.MsgGroupMember{
{Member: member.GetAddr().String(), ExpirationTime: expiration}}
{Member: member.GetAddr().String()},
}
msgUpdateGroupMember := storagetypes.NewMsgRenewGroupMember(owner.GetAddr(), owner.GetAddr(), testGroupName, members)
s.SendTxBlock(owner, msgUpdateGroupMember)

Expand Down
2 changes: 1 addition & 1 deletion x/permission/types/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ package types

import (
"fmt"
"math/big"
"time"

"cosmossdk.io/math"
sdk "github.com/cosmos/cosmos-sdk/types"

"github.com/bnb-chain/greenfield/types/resource"
"math/big"
)

const (
Expand Down
29 changes: 14 additions & 15 deletions x/storage/types/message_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,13 +249,12 @@ func TestMsgUpdateGroupMember_ValidateBasic(t *testing.T) {
Operator: sample.RandAccAddressHex(),
GroupOwner: sample.RandAccAddressHex(),
GroupName: testGroupName,
MembersToAdd: []*MsgGroupMember{{
Member: sample.RandAccAddressHex(),
ExpirationTime: MaxTimeStamp,
},
MembersToAdd: []*MsgGroupMember{
{
Member: sample.RandAccAddressHex(),
},
{
Member: sample.RandAccAddressHex(),
ExpirationTime: MaxTimeStamp,
Member: sample.RandAccAddressHex(),
},
},
MembersToDelete: []string{sample.RandAccAddressHex(), sample.RandAccAddressHex()},
Expand All @@ -275,7 +274,6 @@ func TestMsgUpdateGroupMember_ValidateBasic(t *testing.T) {
}

func TestMsgUpdateGroupExtra_ValidateBasic(t *testing.T) {

tests := []struct {
name string
msg MsgUpdateGroupExtra
Expand Down Expand Up @@ -325,8 +323,10 @@ func TestMsgPutPolicy_ValidateBasic(t *testing.T) {
Operator: sample.RandAccAddressHex(),
Resource: types2.NewBucketGRN(testBucketName).String(),
Principal: types.NewPrincipalWithAccount(sdk.MustAccAddressFromHex(sample.RandAccAddressHex())),
Statements: []*types.Statement{{Effect: types.EFFECT_ALLOW,
Actions: []types.ActionType{types.ACTION_DELETE_BUCKET}}},
Statements: []*types.Statement{{
Effect: types.EFFECT_ALLOW,
Actions: []types.ActionType{types.ACTION_DELETE_BUCKET},
}},
},
},
}
Expand Down Expand Up @@ -448,13 +448,12 @@ func TestMsgRenewGroupMember_ValidateBasic(t *testing.T) {
Operator: sample.RandAccAddressHex(),
GroupOwner: sample.RandAccAddressHex(),
GroupName: testGroupName,
Members: []*MsgGroupMember{{
Member: sample.RandAccAddressHex(),
ExpirationTime: MaxTimeStamp,
},
Members: []*MsgGroupMember{
{
Member: sample.RandAccAddressHex(),
},
{
Member: sample.RandAccAddressHex(),
ExpirationTime: MaxTimeStamp,
Member: sample.RandAccAddressHex(),
},
},
},
Expand Down

0 comments on commit 1946302

Please sign in to comment.