-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Metadata os param store addition (#1932)
* start migration of os params, remove empty param keeper * change os locator params to use module store * add test * add migrations * add upgrade handler * remove attributes params, fix upgrade handler, add tests * add change log * remove unneeded struct start time
- Loading branch information
1 parent
94add0f
commit 55a96da
Showing
13 changed files
with
110 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package keeper_test | ||
|
||
import ( | ||
"testing" | ||
"time" | ||
|
||
cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
"github.com/provenance-io/provenance/app" | ||
simapp "github.com/provenance-io/provenance/app" | ||
"github.com/provenance-io/provenance/x/metadata/types" | ||
"github.com/stretchr/testify/suite" | ||
) | ||
|
||
type OSLocatorParamTestSuite struct { | ||
suite.Suite | ||
|
||
app *app.App | ||
ctx sdk.Context | ||
} | ||
|
||
func (s *OSLocatorParamTestSuite) SetupTest() { | ||
s.app = simapp.Setup(s.T()) | ||
s.ctx = s.app.BaseApp.NewContextLegacy(false, cmtproto.Header{Time: time.Now()}) | ||
} | ||
|
||
func TestOSLocatorParamTestSuite(t *testing.T) { | ||
suite.Run(t, new(OSLocatorParamTestSuite)) | ||
} | ||
|
||
func (s *OSLocatorParamTestSuite) TestGetSetOSLocatorParams() { | ||
defaultParams := s.app.MetadataKeeper.GetOSLocatorParams(s.ctx) | ||
s.Require().Equal(int(types.DefaultMaxURILength), int(defaultParams.MaxUriLength), "GetOSLocatorParams() Default max URI length should match") | ||
|
||
defaultUriLength := s.app.MetadataKeeper.GetMaxURILength(s.ctx) | ||
s.Require().Equal(int(types.DefaultMaxURILength), int(defaultUriLength), "GetMaxURILength() Default max URI length should match") | ||
|
||
newMaxUriLength := uint32(2048) | ||
newParams := types.OSLocatorParams{ | ||
MaxUriLength: newMaxUriLength, | ||
} | ||
s.app.MetadataKeeper.SetOSLocatorParams(s.ctx, newParams) | ||
|
||
updatedParams := s.app.MetadataKeeper.GetOSLocatorParams(s.ctx) | ||
s.Require().Equal(int(newMaxUriLength), int(updatedParams.MaxUriLength), "GetOSLocatorParams() Updated max URI length should match") | ||
|
||
updatedUriLength := s.app.MetadataKeeper.GetMaxURILength(s.ctx) | ||
s.Require().Equal(int(newMaxUriLength), int(updatedUriLength), "GetMaxURILength() Updated max URI length should match") | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters