Skip to content

test: fix integration tests#5

Merged
chatton merged 12 commits intosdk-v0.50.xfrom
cian/fix-integration-tests
Apr 9, 2025
Merged

test: fix integration tests#5
chatton merged 12 commits intosdk-v0.50.xfrom
cian/fix-integration-tests

Conversation

@chatton
Copy link
Collaborator

@chatton chatton commented Apr 8, 2025

This PR updates the integration tests so they all pass

There was just a single test that is skipped and will be addressed in a follow up.

The main gotcha I ran into was with regards to fx.Replace(sw.BlockFetcher(), this ensures that the same BlockFetcher instance is returned from the fx dependency injection library.

This didn't matter before because there was a single grpc connection used to communicate with the app and with comet, now they are separated, so the issue was that a different Fetcher instance was being returned but was wired up pointing at the app grpc endpoint.

Added TODOs for open questions.

Linting will be fixed later, was having issues running it locally.

@chatton chatton force-pushed the cian/fix-integration-tests branch from ca165e5 to f5554dc Compare April 8, 2025 14:54
@chatton chatton marked this pull request as ready for review April 8, 2025 15:25
@chatton chatton requested a review from damiannolan April 8, 2025 15:25
Copy link

@damiannolan damiannolan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

)

// NewCometGRPCConn creates a new gRPC client connection with retry interceptors and connectivity checks.
func NewCometGRPCConn(endpoint string) (*grpc.ClientConn, error) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would maybe suggest going with the naming convention of "core" rather than "comet" for this and the package naming. Or just pkg naming core.NewCometGRPCConn

sw := swamp.NewSwamp(t, swamp.WithBlockTime(time.Second))
// start a bridge node
bridge := sw.NewBridgeNode()
bridge := sw.NewBridgeNode(fx.Replace(sw.Fetcher()))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any idea what a swamp is and why this needs to replace a "swamp fetcher"? 😂

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah that was the main gotcha in this PR, the Fetcher is a BlockFetcher, which maybe it should be renamed to, which uses an underlying comet/core grpc connection.

The problem is that unless it is replaced, a new instance is returned which does not use the correct gRPC connection and things blow up.

There may be a nicer way to do this, but we can refactor the fx.Replace if we have a cleaner way!

// spin up 3 pruning FNs, connect
// spin up 1 LN that syncs historic blobs
func TestArchivalBlobSync(t *testing.T) {
t.Skip("FIXME(chatton): error with fx.Replace")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wanna maybe add another todo in a comment so they can all be grepped by the same string

switch tp {
case node.Bridge:
host, port, err := net.SplitHostPort(s.ClientContext.GRPCClient.Target())
host, port, err := net.SplitHostPort(s.ClientContext.GRPCClient.Target()) // TODO(chatton) should this be comet address or app address?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to assume its comet/core.
what is it configured to right now? if tests are passing maybe its configured correctly?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right now it is configured to the app gRPC endpoint, since tests are passing I also assume it is fine, but I want this to show up in the final diff to ensure that is correct.

Comment on lines +123 to +124
ca.stakingCli = stakingtypes.NewQueryClient(ca.appConn)
ca.feeGrantCli = feegrant.NewQueryClient(ca.appConn)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so these don't work with the coreConn?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the tests pass with both, but actually I don't see any usages of the calling functions that use these underlying clis. I will add another TODO here to verify this with the node team.

chatton and others added 3 commits April 9, 2025 08:25
@chatton
Copy link
Collaborator Author

chatton commented Apr 9, 2025

In a follow up, I think we can use named fx providers to specify 2 different grpc connections. And remove the replace statements.

@chatton chatton merged commit 1dc043e into sdk-v0.50.x Apr 9, 2025
24 of 28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants