Skip to content

Commit

Permalink
rm unnecessary fields in testing
Browse files Browse the repository at this point in the history
  • Loading branch information
charleenfei committed Jun 9, 2022
1 parent 4dc3a15 commit 30127d7
Showing 1 changed file with 1 addition and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func (suite *TendermintTestSuite) TestCheckSubstituteUpdateStateBasic() {
suite.Require().True(ok)
// change trusting period so that test should fail
substituteClientState.TrustingPeriod = time.Hour * 24 * 7

tmClientState := substituteClientState
tmClientState.ChainId = tmClientState.ChainId + "different chain"
},
Expand Down Expand Up @@ -71,48 +71,36 @@ func (suite *TendermintTestSuite) TestCheckSubstituteUpdateStateBasic() {
func (suite *TendermintTestSuite) TestCheckSubstituteAndUpdateState() {
testCases := []struct {
name string
AllowUpdateAfterExpiry bool
AllowUpdateAfterMisbehaviour bool
FreezeClient bool
ExpireClient bool
expPass bool
}{
{
name: "PASS: update checks are deprecated, client is frozen and expired",
AllowUpdateAfterExpiry: false,
AllowUpdateAfterMisbehaviour: false,
FreezeClient: true,
ExpireClient: true,
expPass: true,
},
{
name: "PASS: update checks are deprecated, not frozen or expired",
AllowUpdateAfterExpiry: false,
AllowUpdateAfterMisbehaviour: true,
FreezeClient: false,
ExpireClient: false,
expPass: true,
},
{
name: "PASS: update checks are deprecated, not frozen or expired",
AllowUpdateAfterExpiry: true,
AllowUpdateAfterMisbehaviour: false,
FreezeClient: false,
ExpireClient: false,
expPass: true,
},
{
name: "PASS: update checks are deprecated, client is frozen",
AllowUpdateAfterExpiry: true,
AllowUpdateAfterMisbehaviour: true,
FreezeClient: true,
ExpireClient: false,
expPass: true,
},
{
name: "PASS: update checks are deprecated, client is expired",
AllowUpdateAfterExpiry: true,
AllowUpdateAfterMisbehaviour: true,
FreezeClient: false,
ExpireClient: true,
expPass: true,
Expand All @@ -133,8 +121,6 @@ func (suite *TendermintTestSuite) TestCheckSubstituteAndUpdateState() {
subjectPath := ibctesting.NewPath(suite.chainA, suite.chainB)
suite.coordinator.SetupClients(subjectPath)
subjectClientState := suite.chainA.GetClientState(subjectPath.EndpointA.ClientID).(*types.ClientState)
subjectClientState.AllowUpdateAfterExpiry = tc.AllowUpdateAfterExpiry
subjectClientState.AllowUpdateAfterMisbehaviour = tc.AllowUpdateAfterMisbehaviour

// apply freezing or expiry as determined by the test case
if tc.FreezeClient {
Expand All @@ -155,8 +141,6 @@ func (suite *TendermintTestSuite) TestCheckSubstituteAndUpdateState() {
substitutePath := ibctesting.NewPath(suite.chainA, suite.chainB)
suite.coordinator.SetupClients(substitutePath)
substituteClientState := suite.chainA.GetClientState(substitutePath.EndpointA.ClientID).(*types.ClientState)
substituteClientState.AllowUpdateAfterExpiry = tc.AllowUpdateAfterExpiry
substituteClientState.AllowUpdateAfterMisbehaviour = tc.AllowUpdateAfterMisbehaviour
suite.chainA.App.GetIBCKeeper().ClientKeeper.SetClientState(suite.chainA.GetContext(), substitutePath.EndpointA.ClientID, substituteClientState)

// update substitute a few times
Expand Down

0 comments on commit 30127d7

Please sign in to comment.