-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into dependabot/go_modules/x/upgrade/github.com/h…
…ashicorp/go-getter-1.7.7
- Loading branch information
Showing
33 changed files
with
591 additions
and
177 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
package coretesting | ||
|
||
import ( | ||
"context" | ||
|
||
appmodulev2 "cosmossdk.io/core/appmodule/v2" | ||
corecontext "cosmossdk.io/core/context" | ||
corelog "cosmossdk.io/core/log" | ||
"cosmossdk.io/core/router" | ||
"cosmossdk.io/core/store" | ||
) | ||
|
||
type TestEnvironmentConfig struct { | ||
ModuleName string | ||
Logger corelog.Logger | ||
MsgRouter router.Service | ||
QueryRouter router.Service | ||
} | ||
|
||
type TestEnvironment struct { | ||
appmodulev2.Environment | ||
|
||
testEventService TestEventService | ||
testHeaderService TestHeaderService | ||
} | ||
|
||
func NewTestEnvironment(cfg TestEnvironmentConfig) (TestContext, TestEnvironment) { | ||
ctx := Context() | ||
|
||
testEventService := NewTestEventService(ctx, cfg.ModuleName) | ||
testHeaderService := TestHeaderService{} | ||
|
||
env := TestEnvironment{ | ||
Environment: appmodulev2.Environment{ | ||
Logger: cfg.Logger, | ||
BranchService: nil, | ||
EventService: testEventService, | ||
GasService: TestGasService{}, | ||
HeaderService: testHeaderService, | ||
QueryRouterService: cfg.QueryRouter, | ||
MsgRouterService: cfg.MsgRouter, | ||
TransactionService: TestTransactionService{}, | ||
KVStoreService: KVStoreService(ctx, cfg.ModuleName), | ||
MemStoreService: nil, | ||
}, | ||
testEventService: testEventService, | ||
testHeaderService: testHeaderService, | ||
} | ||
|
||
// set internal context to point to environment | ||
ctx.Context = context.WithValue(ctx.Context, corecontext.EnvironmentContextKey, env.Environment) | ||
return ctx, env | ||
} | ||
|
||
func (env TestEnvironment) EventService() TestEventService { | ||
return env.testEventService | ||
} | ||
|
||
func (env TestEnvironment) KVStoreService() store.KVStoreService { | ||
return env.Environment.KVStoreService | ||
} | ||
|
||
func (env TestEnvironment) HeaderService() TestHeaderService { | ||
return env.testHeaderService | ||
} |
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,23 @@ | ||
package coretesting | ||
|
||
import ( | ||
"context" | ||
|
||
"cosmossdk.io/core/gas" | ||
) | ||
|
||
var _ gas.Service = &TestGasService{} | ||
|
||
type TestGasService struct{} | ||
|
||
func (m TestGasService) GasMeter(ctx context.Context) gas.Meter { | ||
dummy := unwrap(ctx) | ||
|
||
return dummy.gasMeter | ||
} | ||
|
||
func (m TestGasService) GasConfig(ctx context.Context) gas.GasConfig { | ||
dummy := unwrap(ctx) | ||
|
||
return dummy.gasConfig | ||
} |
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,15 @@ | ||
package coretesting | ||
|
||
import ( | ||
"context" | ||
|
||
"cosmossdk.io/core/header" | ||
) | ||
|
||
var _ header.Service = &TestHeaderService{} | ||
|
||
type TestHeaderService struct{} | ||
|
||
func (e TestHeaderService) HeaderInfo(ctx context.Context) header.Info { | ||
return unwrap(ctx).header | ||
} |
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,17 @@ | ||
package coretesting | ||
|
||
import ( | ||
"context" | ||
|
||
"cosmossdk.io/core/transaction" | ||
) | ||
|
||
var _ transaction.Service = &TestTransactionService{} | ||
|
||
type TestTransactionService struct{} | ||
|
||
func (m TestTransactionService) ExecMode(ctx context.Context) transaction.ExecMode { | ||
dummy := unwrap(ctx) | ||
|
||
return dummy.execMode | ||
} |
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
Oops, something went wrong.