-
Notifications
You must be signed in to change notification settings - Fork 3.9k
feat(core): add coretest package #20487
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
# Conflicts: # orm/go.sum # server/v2/stf/go.sum
Important Review skippedReview was skipped due to path filters Files ignored due to path filters (26)
You can disable this status message by setting the WalkthroughThe updates introduce a Changes
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
Review details
Configuration used: .coderabbit.yml
Review profile: CHILL
Files ignored due to path filters (4)
core/go.mod
is excluded by!**/*.mod
core/go.sum
is excluded by!**/*.sum
runtime/v2/go.mod
is excluded by!**/*.mod
runtime/v2/go.sum
is excluded by!**/*.sum
Files selected for processing (5)
- core/coretesting/context.go (1 hunks)
- core/coretesting/memdb.go (1 hunks)
- core/coretesting/memdb_test.go (1 hunks)
- core/coretesting/services_test.go (1 hunks)
- core/coretesting/store.go (1 hunks)
Additional context used
Path-based instructions (5)
core/coretesting/store.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.core/coretesting/services_test.go (2)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.
Pattern
**/*_test.go
: "Assess the unit test code assessing sufficient code coverage for the changes associated in the pull request"core/coretesting/context.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.core/coretesting/memdb_test.go (2)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.
Pattern
**/*_test.go
: "Assess the unit test code assessing sufficient code coverage for the changes associated in the pull request"core/coretesting/memdb.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.
Additional comments not posted (9)
core/coretesting/services_test.go (3)
14-19
: Test case checks for panic on invalid context.Consider revisiting this test if the implementation of
OpenKVStore
is changed to handle errors instead of panicking.
21-28
: Properly tests key-value operations inKVStoreService
.
30-34
: Test verifies module name storage inKVStoreService
.core/coretesting/context.go (1)
11-15
: FunctionContext
correctly initializes adummyCtx
.core/coretesting/memdb_test.go (2)
11-23
: Tests cover basic operations (Set
,Get
,Delete
) ofmemDB
.
24-58
: Comprehensive tests for both normal and reverse iterators inmemDB
.core/coretesting/memdb.go (3)
21-100
:memDB
type and its methods are well-defined and appropriate for in-memory database operations.
102-116
:item
type andbyKeys
function are correctly implemented for key comparison in B-tree.
118-253
:memIterator
type and its methods provide robust iterator functionality formemDB
.
core/coretesting/store.go
Outdated
func KVStoreService(ctx context.Context, moduleName string) store.KVStoreService { | ||
unwrap(ctx).stores[moduleName] = newMemDB() | ||
return kvStoreService{ | ||
moduleName: moduleName, | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Potential panic risk in KVStoreService
.
Consider handling the error when the context is not of type dummyCtx
gracefully instead of panicking. This will improve the robustness of the code.
- unwrap(ctx).stores[moduleName] = newMemDB()
+ dummy, ok := unwrap(ctx)
+ if !ok {
+ return nil, fmt.Errorf("invalid context type")
+ }
+ dummy.stores[moduleName] = newMemDB()
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
func KVStoreService(ctx context.Context, moduleName string) store.KVStoreService { | |
unwrap(ctx).stores[moduleName] = newMemDB() | |
return kvStoreService{ | |
moduleName: moduleName, | |
} | |
} | |
func KVStoreService(ctx context.Context, moduleName string) store.KVStoreService { | |
dummy, ok := unwrap(ctx) | |
if !ok { | |
return nil, fmt.Errorf("invalid context type") | |
} | |
dummy.stores[moduleName] = newMemDB() | |
return kvStoreService{ | |
moduleName: moduleName, | |
} | |
} |
core/coretesting/store.go
Outdated
func (k kvStoreService) OpenKVStore(ctx context.Context) store.KVStore { | ||
kv, ok := unwrap(ctx).stores[k.moduleName] | ||
if !ok { | ||
panic(fmt.Sprintf("KVStoreService %s not found", k.moduleName)) | ||
} | ||
return kv | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace panic with error handling in OpenKVStore
.
Using panic
can lead to abrupt termination of the application. Consider returning an error to allow the caller to handle the situation more gracefully.
- panic(fmt.Sprintf("KVStoreService %s not found", k.moduleName))
+ return nil, fmt.Errorf("KVStoreService %s not found", k.moduleName)
Committable suggestion was skipped due low confidence.
core/coretesting/context.go
Outdated
func unwrap(ctx context.Context) *dummyCtx { | ||
dummy, ok := ctx.(*dummyCtx) | ||
if !ok { | ||
panic(fmt.Sprintf("invalid context.Context, wanted dummy got: %T", ctx)) | ||
} | ||
return dummy | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider handling type assertion failure gracefully in unwrap
.
Panicking on a type assertion failure can cause abrupt application termination. It's better to return an error and let the caller handle it.
- panic(fmt.Sprintf("invalid context.Context, wanted dummy got: %T", ctx))
+ return nil, fmt.Errorf("invalid context.Context, wanted dummy got: %T", ctx)
Committable suggestion was skipped due low confidence.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think test or testing is a better name. Will wait for others to post thoughts before approving. We can discuss on the team call today
The reason why we don't use the MemDB from |
not attached to name, it's just that it is bound to be imported as :
so I'd just call it "coretest" or "coretesting" up to you to avoid neededing to manually rename it in every file which is imported |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: .coderabbit.yml
Review profile: CHILL
Files ignored due to path filters (2)
collections/go.mod
is excluded by!**/*.mod
collections/go.sum
is excluded by!**/*.sum
Files selected for processing (5)
- collections/indexed_map_test.go (3 hunks)
- collections/lookup_map_test.go (1 hunks)
- collections/triple_test.go (2 hunks)
- core/coretesting/memdb.go (1 hunks)
- core/coretesting/memdb_test.go (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- core/coretesting/memdb_test.go
Additional context used
Path-based instructions (4)
collections/lookup_map_test.go (2)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.
Pattern
**/*_test.go
: "Assess the unit test code assessing sufficient code coverage for the changes associated in the pull request"collections/triple_test.go (2)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.
Pattern
**/*_test.go
: "Assess the unit test code assessing sufficient code coverage for the changes associated in the pull request"collections/indexed_map_test.go (2)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.
Pattern
**/*_test.go
: "Assess the unit test code assessing sufficient code coverage for the changes associated in the pull request"core/coretesting/memdb.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.
Additional comments not posted (9)
collections/lookup_map_test.go (2)
6-6
: Import ofcoretesting
aligns with the PR's goal to facilitate easier testing.
13-14
: The use ofcoretesting.Context()
andcoretesting.KVStoreService(ctx, "test")
is a good practice as it simplifies the setup for testing by providing a standardized context and KV store service. This should enhance test consistency and maintainability.collections/triple_test.go (2)
6-6
: Import ofcoretesting
aligns with the PR's goal to facilitate easier testing.
22-23
: The use ofcoretesting.Context()
andcoretesting.KVStoreService(ctx, "test")
is a good practice as it simplifies the setup for testing by providing a standardized context and KV store service. This should enhance test consistency and maintainability.collections/indexed_map_test.go (2)
6-6
: Import ofcoretesting
aligns with the PR's goal to facilitate easier testing.
48-50
: The use ofcoretesting.Context()
andcoretesting.KVStoreService(ctx, "test")
is a good practice as it simplifies the setup for testing by providing a standardized context and KV store service. This should enhance test consistency and maintainability.core/coretesting/memdb.go (3)
1-1
: The package declaration is correct and appropriately namespaced undercoretesting
.
3-9
: Proper imports are used, including the newtidwall/btree
dependency which is central to the functionality of the in-memory database.
17-17
: Implementation of thememDB
struct and its methods correctly adheres to thestore.KVStore
interface. The use ofbtree.BTreeG
for efficient key-value storage and operations is a good choice given the performance characteristics of B-trees.Also applies to: 19-19, 21-24, 26-34, 36-39, 41-45, 47-51, 53-60, 62-70, 74-100, 102-253
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: .coderabbit.yml
Review profile: CHILL
Files ignored due to path filters (2)
collections/go.mod
is excluded by!**/*.mod
collections/go.sum
is excluded by!**/*.sum
Files selected for processing (2)
- collections/collections_test.go (1 hunks)
- collections/indexes/indexes_test.go (1 hunks)
Files skipped from review due to trivial changes (1)
- collections/collections_test.go
Additional context used
Path-based instructions (1)
collections/indexes/indexes_test.go (2)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.
Pattern
**/*_test.go
: "Assess the unit test code assessing sufficient code coverage for the changes associated in the pull request"
Additional comments not posted (1)
collections/indexes/indexes_test.go (1)
11-13
: The refactoring ofdeps()
to usecoretesting
for context and KV store service initialization looks good.Verification successful
The refactoring of
deps()
to usecoretesting
for context and KV store service initialization looks good. The usage ofcoretesting.Context()
andcoretesting.KVStoreService(ctx, "test")
is consistent across multiple test files.
collections/lookup_map_test.go
collections/triple_test.go
collections/collections_test.go
collections/indexed_map_test.go
collections/indexes/indexes_test.go
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the integration of `coretesting.Context()` and `coretesting.KVStoreService(ctx, "test")` with the rest of the codebase. # Test: Search for the usage of `coretesting.Context()` and `coretesting.KVStoreService(ctx, "test")` in other test files. rg --type go $'coretesting.Context()\ncoretesting.KVStoreService'Length of output: 257
Script:
#!/bin/bash # Description: Verify the integration of `coretesting.Context()` and `coretesting.KVStoreService(ctx, "test")` with the rest of the codebase. # Test: Search for the usage of `coretesting.Context()` in other test files. rg --multiline --type go 'coretesting.Context()' # Test: Search for the usage of `coretesting.KVStoreService(ctx, "test")` in other test files. rg --multiline --type go 'coretesting.KVStoreService(ctx, "test")'Length of output: 524
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally like the direction of this.
In the long run coretesting
should probably be sufficient for running unit tests of your module with all dependencies on external module mocked via gomock
. So in coretesting
we'd have a mock of everthing in core
(either custom like the store stuff here or generated with gomock
) plus a basic test module manager/router system.
for me, |
An alternative is having the directory as |
Some concerns surfaced from discussion in team call:
Can we consider moving this to another go.mod or creating (like @aaronc suggests) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
Review details
Configuration used: .coderabbit.yml
Review profile: CHILL
Files ignored due to path filters (27)
client/v2/go.mod
is excluded by!**/*.mod
collections/go.mod
is excluded by!**/*.mod
collections/go.sum
is excluded by!**/*.sum
go.mod
is excluded by!**/*.mod
server/v2/cometbft/go.mod
is excluded by!**/*.mod
simapp/go.mod
is excluded by!**/*.mod
tests/go.mod
is excluded by!**/*.mod
x/accounts/defaults/lockup/go.mod
is excluded by!**/*.mod
x/accounts/go.mod
is excluded by!**/*.mod
x/auth/go.mod
is excluded by!**/*.mod
x/authz/go.mod
is excluded by!**/*.mod
x/bank/go.mod
is excluded by!**/*.mod
x/circuit/go.mod
is excluded by!**/*.mod
x/consensus/go.mod
is excluded by!**/*.mod
x/distribution/go.mod
is excluded by!**/*.mod
x/epochs/go.mod
is excluded by!**/*.mod
x/evidence/go.mod
is excluded by!**/*.mod
x/feegrant/go.mod
is excluded by!**/*.mod
x/gov/go.mod
is excluded by!**/*.mod
x/group/go.mod
is excluded by!**/*.mod
x/mint/go.mod
is excluded by!**/*.mod
x/nft/go.mod
is excluded by!**/*.mod
x/params/go.mod
is excluded by!**/*.mod
x/protocolpool/go.mod
is excluded by!**/*.mod
x/slashing/go.mod
is excluded by!**/*.mod
x/staking/go.mod
is excluded by!**/*.mod
x/upgrade/go.mod
is excluded by!**/*.mod
Files selected for processing (1)
- x/accounts/genesis_test.go (2 hunks)
Additional context used
Path-based instructions (1)
x/accounts/genesis_test.go (2)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.
Pattern
**/*_test.go
: "Assess the unit test code assessing sufficient code coverage for the changes associated in the pull request"
Learnings (1)
x/accounts/genesis_test.go (1)
User: likhita-809 PR: cosmos/cosmos-sdk#18471 File: x/protocolpool/keeper/genesis.go:12-51 Timestamp: 2023-11-22T12:32:39.368Z Learning: - The user `likhita-809` has confirmed the changes suggested in the previous interaction. - The file in question is `x/protocolpool/keeper/genesis.go` from a Cosmos SDK module. - The changes involve optimizing the `InitGenesis` function by removing redundant code and ensuring proper handling of start times for budget proposals.
golangci-lint
x/accounts/genesis_test.go
9-9: use of internal package cosmossdk.io/x/accounts/internal/implementation not allowed (typecheck)
Additional comments not posted (2)
x/accounts/genesis_test.go (2)
38-41
: Ensure consistent error handling innewKeeper
as previously noted.
14-17
: Ensure consistent error handling innewKeeper
.Verification successful
Ensure consistent error handling in
newKeeper
.The extracted code segments show that the
newKeeper
function is used in multiple test files, and error handling appears to be consistent across these usages. Specifically, errors are checked usingrequire.NoError(t, err)
after thenewKeeper
function is called.
x/accounts/msg_server_test.go
x/accounts/keeper_test.go
x/accounts/query_server_test.go
x/accounts/genesis_test.go
x/accounts/utils_test.go
The error handling in these files is consistent with the pattern observed in the
genesis_test.go
file.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that `newKeeper` function handles errors consistently across the codebase. # Test: Search for the function usage. Expect: Consistent error handling. rg --type go $'newKeeper'Length of output: 1043
Script:
#!/bin/bash # Extract relevant code segments around the `newKeeper` calls in each file to verify error handling. # Extract 5 lines before and after the `newKeeper` call in each file. rg --type go -A 5 -B 5 'newKeeper' x/accounts/utils_test.go x/accounts/query_server_test.go x/accounts/keeper_test.go x/accounts/genesis_test.go x/accounts/msg_server_test.goLength of output: 5864
_, addr1, err := k.Init(ctx, testAccountType, []byte("sender"), &types.Empty{}, nil) | ||
require.NoError(t, err) | ||
_, err = k.Execute(ctx, addr1, []byte("sender"), &types.UInt64Value{Value: 10}, nil) | ||
require.NoError(t, err) | ||
|
||
// we set counter to 20 | ||
_, addr2, err := k.Init(ctx, "test", []byte("sender"), &types.Empty{}, nil) | ||
_, addr2, err := k.Init(ctx, testAccountType, []byte("sender"), &types.Empty{}, nil) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refactor repeated code for account initialization and execution.
- _, addr1, err := k.Init(ctx, testAccountType, []byte("sender"), &types.Empty{}, nil)
- require.NoError(t, err)
- _, err = k.Execute(ctx, addr1, []byte("sender"), &types.UInt64Value{Value: 10}, nil)
- require.NoError(t, err)
- _, addr2, err := k.Init(ctx, testAccountType, []byte("sender"), &types.Empty{}, nil)
- require.NoError(t, err)
- _, err = k.Execute(ctx, addr2, []byte("sender"), &types.UInt64Value{Value: 20}, nil)
- require.NoError(t, err)
+ for i, value := range []uint64{10, 20} {
+ _, addr, err := k.Init(ctx, testAccountType, []byte("sender"), &types.Empty{}, nil)
+ require.NoError(t, err)
+ _, err = k.Execute(ctx, addr, []byte("sender"), &types.UInt64Value{Value: value}, nil)
+ require.NoError(t, err)
+ if i == 0 {
+ addr1 = addr
+ } else {
+ addr2 = addr
+ }
+ }
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
_, addr1, err := k.Init(ctx, testAccountType, []byte("sender"), &types.Empty{}, nil) | |
require.NoError(t, err) | |
_, err = k.Execute(ctx, addr1, []byte("sender"), &types.UInt64Value{Value: 10}, nil) | |
require.NoError(t, err) | |
// we set counter to 20 | |
_, addr2, err := k.Init(ctx, "test", []byte("sender"), &types.Empty{}, nil) | |
_, addr2, err := k.Init(ctx, testAccountType, []byte("sender"), &types.Empty{}, nil) | |
for i, value := range []uint64{10, 20} { | |
_, addr, err := k.Init(ctx, testAccountType, []byte("sender"), &types.Empty{}, nil) | |
require.NoError(t, err) | |
_, err = k.Execute(ctx, addr, []byte("sender"), &types.UInt64Value{Value: value}, nil) | |
require.NoError(t, err) | |
if i == 0 { | |
addr1 = addr | |
} else { | |
addr2 = addr | |
} | |
} |
@@ -6,26 +6,26 @@ | |||
"github.com/cosmos/gogoproto/types" | |||
"github.com/stretchr/testify/require" | |||
|
|||
"cosmossdk.io/collections/colltest" | |||
"cosmossdk.io/x/accounts/internal/implementation" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use of internal package not allowed.
- import "cosmossdk.io/x/accounts/internal/implementation"
+ // Consider refactoring to avoid using internal packages directly.
Committable suggestion was skipped due to low confidence.
Tools
golangci-lint
9-9: use of internal package cosmossdk.io/x/accounts/internal/implementation not allowed (typecheck)
can we make sure codecov is above 70% and its added to the go.work.example file |
codecov is at +80%, added to go work! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: .coderabbit.yml
Review profile: CHILL
Files selected for processing (2)
- core/testing/context.go (1 hunks)
- go.work.example (1 hunks)
Files skipped from review due to trivial changes (1)
- go.work.example
Additional context used
Path-based instructions (1)
core/testing/context.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.
golangci-lint
core/testing/context.go
24-24: func
unwrap
is unused (unused)
Additional comments not posted (3)
core/testing/context.go (3)
11-18
: The implementation ofContext()
function looks good and adheres to the intended functionality of creating a dummy context for testing.
20-22
: ThedummyCtx
struct is well-defined and supports the functionality required for testing with dummy contexts.
24-31
: The functionunwrap
is currently marked as unused. If this function is intended for future use or external use not visible in this context, please ensure it is appropriately documented or utilized to avoid confusion.Verification successful
The
unwrap
function incore/testing/context.go
is indeed used in other parts of the codebase, specifically incore/testing/store.go
andcore/testing/services_test.go
. This confirms that the function is not unused.
core/testing/store.go:11
core/testing/store.go:22
core/testing/services_test.go:32
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the usage of the `unwrap` function in the codebase. # Test: Search for the function usage. Expect: At least one occurrence. rg --type go $'unwrap'Length of output: 101398
Script:
#!/bin/bash # Description: Verify the exact usage of the `unwrap` function in relevant files. # Test: Search for the `unwrap` function calls in specific files. rg --type go --word-regexp --line-number 'unwrap' core/testing/store.go core/testing/services_test.go core/testing/context.goLength of output: 407
Tools
golangci-lint
24-24: func
unwrap
is unused (unused)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ref #20487 (comment)
@julienrbrt I've addressed your review, lmk if all is fine. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Outside diff range and nitpick comments (1)
core/testing/CHANGELOG.md (1)
Line range hint
39-39
: Reduce multiple consecutive blank lines to a single blank line.- ## [Unreleased] - + ## [Unreleased]
Review details
Configuration used: .coderabbit.yml
Review profile: CHILL
Files selected for processing (5)
- .github/dependabot.yml (1 hunks)
- .github/pr_labeler.yml (1 hunks)
- .github/workflows/test.yml (1 hunks)
- core/testing/CHANGELOG.md (1 hunks)
- core/testing/sonar-project.properties (1 hunks)
Files skipped from review due to trivial changes (2)
- .github/pr_labeler.yml
- core/testing/sonar-project.properties
Additional context used
Path-based instructions (1)
core/testing/CHANGELOG.md (1)
Pattern
**/*.md
: "Assess the documentation for misspellings, grammatical errors, missing documentation and correctness"
Markdownlint
core/testing/CHANGELOG.md
39-39: Expected: 1; Actual: 2 (MD012, no-multiple-blanks)
Multiple consecutive blank lines
Additional comments not posted (1)
.github/dependabot.yml (1)
64-72
: The new dependabot configuration for/core/testing
is correctly set up.
test-coretesting: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version: "1.20" | ||
check-latest: true | ||
cache: true | ||
cache-dependency-path: core/testing/go.sum | ||
- uses: technote-space/[email protected] | ||
id: git_diff | ||
with: | ||
PATTERNS: | | ||
core/testing/**/*.go | ||
core/testing/go.mod | ||
core/testing/go.sum | ||
- name: tests | ||
if: env.GIT_DIFF | ||
run: | | ||
cd core/testing | ||
go test -mod=readonly -timeout 30m -coverprofile=coverage.out -covermode=atomic -tags='norace ledger test_ledger_mock' ./... | ||
- name: sonarcloud | ||
if: ${{ env.GIT_DIFF && !github.event.pull_request.draft && env.SONAR_TOKEN != null }} | ||
uses: SonarSource/sonarcloud-github-action@master | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | ||
with: | ||
projectBaseDir: core/testing/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tip
Codebase Verification
The Go version used in the test-coretesting
job is 1.20
, while all other test jobs use 1.22
. To maintain consistency and avoid potential discrepancies during runtime, please update the Go version in the test-coretesting
job to 1.22
.
- File:
.github/workflows/test.yml
- Lines: 342-345
- Current Configuration:
- uses: actions/setup-go@v5 with: go-version: "1.20" check-latest: true cache: true cache-dependency-path: core/testing/go.sum
Category:
Analysis chain
The configuration for the test-coretesting
job appears well-integrated with the existing workflow structure. However, ensure that the Go version (1.20
) used here aligns with the versions used in other test jobs, which are mostly 1.22
. This consistency is crucial for avoiding potential discrepancies during runtime due to version differences.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify Go version consistency across all test jobs.
# Test: Search for Go version settings in test jobs. Expect: Consistent version across all jobs.
rg --type yaml 'go-version: "1.22"' .github/workflows/test.yml
Length of output: 1021
Some consensus tests are failing due to other changes. It seems to be from the tx validator or @julienrbrt |
Yes, it's missing a x/tx replace there |
probably a merge conflict that I did not resolve correctly, should be fixed now. |
Description
This change adds a new package to core, called coretest.
It adds the tidwall dependency, which is an extrmely light weight one as it can be seen from the go.sum.
The purpose of this PR is to make testing of modules fully depending on core easier.
This will also help in removing some dependencies of the SDK.
Author Checklist
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.
I have...
!
in the type prefix if API or client breaking changeCHANGELOG.md
Reviewers Checklist
All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.
Please see Pull Request Reviewer section in the contributing guide for more information on how to review a pull request.
I have...
Summary by CodeRabbit
New Features
Refactor
Tests
Chores