Skip to content
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

feat: use proxy instead of port forwards #3505

Merged
merged 15 commits into from
Jun 18, 2024

Conversation

smuu
Copy link
Member

@smuu smuu commented May 27, 2024

Overview

This pull request removes the need for port-forwarding. Instead, it facilitates the reverse proxy that is available in the scope.

I will comment in code to explain the changes.

@staheri14 Feel free to merge this as well to your branch

func waitForHeight(testnet *testnet.Testnet, node *testnet.Node, height int64, period time.Duration) error {
func waitForHeight(ctx context.Context, client *http.HTTP, height int64, period time.Duration) error {
Copy link
Member Author

Choose a reason for hiding this comment

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

Changes it back to how it was done before.

Comment on lines -55 to -56
if !errors.Is(err, context.DeadlineExceeded) {
return fmt.Errorf("expected context.DeadlineExceeded, got %w", err)
Copy link
Member Author

Choose a reason for hiding this comment

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

I don't understand this. It failed me, as the error returned is not context.DeadlineExceeded. Commented it out for now.

Copy link
Collaborator

Choose a reason for hiding this comment

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

+1 on not understanding this. I created #3380 which we can close if we end up deleting these lines.

Copy link
Contributor

Choose a reason for hiding this comment

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

What error did you get? Was it context cancelled?

Copy link
Contributor

Choose a reason for hiding this comment

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

This should always return an error

Copy link
Contributor

Choose a reason for hiding this comment

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

cc @smuu (just so we don't forget this)

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't get any error when running txsim.
When having the code to expect context.DeadlineExceeded, the test fails with this specified error.

Copy link
Member Author

@smuu smuu Jun 6, 2024

Choose a reason for hiding this comment

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

@cmwaters What was the logic behind you adding this check?

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm confused because the txsim should always return an error because it's lifecycle is managed by the context you provide so either you cancel it or it hits a deadline

Comment on lines 270 to 280
err, rpcProxyHost := n.Instance.AddHost(rpcPort)
if err != nil {
return err
}
n.rpcProxyHost = rpcProxyHost

err, grpcProxyHost := n.Instance.AddHost(grpcPort)
if err != nil {
return err
}
n.grpcProxyHost = grpcProxyHost
Copy link
Member Author

Choose a reason for hiding this comment

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

This returns a host to reach the RPC/gRPC endpoint via the reverse proxy without relying on port-forwards.

return n.forwardPorts()
}

func (n *Node) forwardPorts() error {
Copy link
Member Author

Choose a reason for hiding this comment

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

We don't need to forward ports anymore.

return nil
}

func (n *Node) ForwardBitTwisterPort() error {
Copy link
Member Author

Choose a reason for hiding this comment

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

This is not needed. When using instance.EnableBittwister this is done under the hood.

return nil
}

func DockerImageName(version string) string {
return fmt.Sprintf("%s:%s", dockerSrcURL, version)
}

func (n *Node) GetHeight(executor *knuu.Executor) (int64, error) {
Copy link
Member Author

Choose a reason for hiding this comment

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

Not needed anymore.

@@ -20,20 +20,12 @@ import (
type Testnet struct {
seed int64
nodes []*Node
executor *knuu.Executor
Copy link
Member Author

Choose a reason for hiding this comment

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

The Executor is not needed anymore.

Comment on lines +329 to +333
if i == 9 {
return fmt.Errorf("node %s status response: %w", node.Name, err)
}
time.Sleep(time.Second)
continue
Copy link
Member Author

Choose a reason for hiding this comment

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

There are scenarios where the reverse proxy still needs to be ready. This does not fail now when the status requests return a non 2xx return code.

Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a way where the reverse proxy can tell us when it's ready? Or a way where we don't need to rely on sleeping

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

When Knuu is initialized with proxy enabled, the deploy and check service for proxy is done internally and they are blocking, so once knuu is initialized, the proxy should be ready. There should be no need for sleep and wait.

here: https://github.com/celestiaorg/knuu/blob/4e6dcf097463fd9a58c40d2d7c7c9065ac94d9cc/pkg/traefik/traefik.go#L177-L178

Copy link
Member Author

Choose a reason for hiding this comment

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

The deployment of the proxy is blocking until deplopyed.
But when doing some testing I observed that the proxy takes some time to apply the config for a certain Instance.
When creating a forward for an Instance using the proxy, it makes a custom resource in Kubernetes, which is then picked up by the proxy.
Sometimes, we use the proxy host before the proxy applies this configuration.

Copy link
Member

Choose a reason for hiding this comment

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

oh I see, so we probably can add something to the AddHost func to check that. or have a callback func if that's needed.

Copy link
Member

Choose a reason for hiding this comment

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

would you mind to create an issue for it to keep tracking of it in its own issue?

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

Created issue in knuu: celestiaorg/knuu#423

Copy link
Member Author

Choose a reason for hiding this comment

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

This was a workaround and is not needed anymore.

Signed-off-by: Smuu <[email protected]>
@smuu smuu marked this pull request as ready for review May 28, 2024 07:37
@smuu smuu requested a review from a team as a code owner May 28, 2024 07:37
@smuu smuu requested review from rach-id and evan-forbes and removed request for a team May 28, 2024 07:37
Copy link
Contributor

coderabbitai bot commented May 28, 2024

Walkthrough

The changes primarily involve refactoring the test/e2e directory's codebase. These updates include modifying method signatures, decoupling dependencies, enhancing error handling, and simplifying configurations. Additionally, memory request and limit values were increased, while changes to network and node management improved flexibility and execution flow. Some features were marked non-functional due to dependency issues and potential future updates.

Changes

File(s) Change Summary
test/e2e/benchmark/benchmark.go Removed logic for forwarding bit twister port; now sets latency and jitter parameters if specified in the manifest.
test/e2e/check_upgrades.go Updated waitForHeight to accept context.Context and http.HTTP client for flexibility and decoupling.
test/e2e/simple.go Refactored txsim creation, adjusted test sequence, removed unused imports, and enhanced error/timing handling.
test/e2e/testnet/defaults.go Doubled memory request and limit values in DefaultResources struct.
test/e2e/testnet/node.go Replaced port-based addresses with host-based addresses for RPC, GRPC, and tracing.
test/e2e/minor_version_compatibility.go Refactored logic flow, removed unused imports, updated node synchronization and error handling.
test/e2e/major_upgrade_v2.go Revised MajorUpgradeToV2 setup, transaction client creation, error handling, and height waiting mechanism.
test/e2e/testnet/testnet.go Removed executor field and methods, commented out GRPCEndpoints, improved error handling.
go.mod Updated dependencies to newer versions.
test/e2e/testnet/txsimNode.go Added //nolint:staticcheck directive.

Sequence Diagram(s)

Generating sequence diagrams is not necessary for these changes as they mainly involve refactoring and configuration adjustments without introducing new features or complex control flows.


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?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

‼️ IMPORTANT
Auto-reply has been disabled for this repository in the CodeRabbit settings. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.

  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@smuu smuu requested a review from staheri14 May 28, 2024 07:46
go.mod Outdated Show resolved Hide resolved
Copy link
Member

@rach-id rach-id left a comment

Choose a reason for hiding this comment

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

Overall LGTM 🎉

Left some comments to understand more.

test/e2e/check_upgrades.go Outdated Show resolved Hide resolved
test/e2e/simple.go Outdated Show resolved Hide resolved
test/e2e/testnet/node.go Outdated Show resolved Hide resolved
test/e2e/testnet/node.go Outdated Show resolved Hide resolved
test/e2e/testnet/node.go Outdated Show resolved Hide resolved
test/e2e/testnet/testnet.go Show resolved Hide resolved
evan-forbes
evan-forbes previously approved these changes May 28, 2024
Copy link
Member

@evan-forbes evan-forbes left a comment

Choose a reason for hiding this comment

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

lgtm! second some of the nits from Rachid and Nina

@celestia-bot celestia-bot requested review from a team and ramin and removed request for a team May 30, 2024 06:35
rach-id
rach-id previously approved these changes May 30, 2024
Signed-off-by: Smuu <[email protected]>
@smuu
Copy link
Member Author

smuu commented May 30, 2024

This PR now uses the release v0.14.0, and all conflicts are resolved.
Feel free to merge this PR.

cmwaters
cmwaters previously approved these changes May 31, 2024
Copy link
Contributor

@cmwaters cmwaters left a comment

Choose a reason for hiding this comment

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

Thanks @smuu! I have a few comments but these can also be addressed in a follow up PR as to not be blocking

@cmwaters cmwaters requested a review from rootulp June 4, 2024 07:47
@smuu
Copy link
Member Author

smuu commented Jun 15, 2024

Looks like the linter is complaining about a bunch of deprecated methods in knuu. Do you mind updating them @smuu and then updating the branch? 🙏

@cmwaters This would mean a major rewrite of your usage of knuu. We paused that for now, as the repo has so many PRs open that is touching the e2e tests.
Using the new structure would blow this PR.

I propose to ignore the deprecation warning in this PR, get all the knuu-related PRs merged, and then create a PR to move to the new structure.

@cmwaters
Copy link
Contributor

Okay, I will disable staticcheck on these files for now

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 8

Outside diff range and nitpick comments (2)
test/e2e/minor_version_compatibility.go (1)

Line range hint 38-90: Consider refactoring to reduce the complexity of the MinorVersionCompatibility function.

-	for i := 0; i < len(versions)*2; i++ {
-		if i%numNodes == 0 {
-			continue
-		}
-		client, err := testNet.Node(i % numNodes).Client()
-		testnet.NoError("failed to get client", err)
-
-		heightBefore, err := getHeight(ctx, client, time.Second)
-		testnet.NoError("failed to get height", err)
-
-		newVersion := versions.Random(r).String()
-		logger.Println("Upgrading node", "node", i%numNodes+1, "version", newVersion)
-		testnet.NoError("failed to upgrade node", testNet.Node(i%numNodes).Upgrade(newVersion))
-		time.Sleep(10 * time.Second)
-		testnet.NoError("failed to wait for height", waitForHeight(ctx, client, heightBefore+2, 30*time.Second))
-	}
+	for i := 1; i < len(versions)*2; i++ {
+		if i%numNodes != 0 {
+			client, err := testNet.Node(i % numNodes).Client()
+			testnet.NoError("failed to get client", err)
+
+			heightBefore, err := getHeight(ctx, client, time.Second)
+			testnet.NoError("failed to get height", err)
+
+			newVersion := versions.Random(r).String()
+			logger.Println("Upgrading node", "node", i%numNodes+1, "version", newVersion)
+			testnet.NoError("failed to upgrade node", testNet.Node(i%numNodes).Upgrade(newVersion))
+			time.Sleep(10 * time.Second)
+			testnet.NoError("failed to wait for height", waitForHeight(ctx, client, heightBefore+2, 30*time.Second))
+		}
+	}
test/e2e/testnet/testnet.go (1)

Line range hint 330-346: The retry logic in the Start method uses a fixed sleep of 1 second which might not be optimal in all situations.

Consider using exponential backoff or configurable delay intervals for better performance and adaptability.

Comment on lines +272 to +279
// FIXME: This does not work currently with the reverse proxy
// func (t *Testnet) GRPCEndpoints() []string {
// grpcEndpoints := make([]string, len(t.nodes))
// for idx, node := range t.nodes {
// grpcEndpoints[idx] = node.AddressGRPC()
// }
// return grpcEndpoints
// }
Copy link
Contributor

Choose a reason for hiding this comment

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

The commented-out function GRPCEndpoints due to reverse proxy issues might need a revisit or proper documentation on why it's disabled.

Consider documenting or revisiting the necessity of this function in the context of reverse proxy adjustments.

@@ -399,7 +395,7 @@
if err != nil {
log.Err(err).
Str("name", txsim.Name).
Msg("txsim failed to stop")
Msg("failed to wait for txsim to stop")
Copy link
Contributor

Choose a reason for hiding this comment

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

Ensure proper error handling in the cleanup process for txsim.

It's crucial to handle errors robustly during cleanup to prevent resource leaks or incomplete cleanup operations.

@@ -1,3 +1,4 @@
//nolint:staticcheck
Copy link
Contributor

Choose a reason for hiding this comment

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

Tip

Codebase Verification

The extended context search did not reveal any comments explaining the reason for disabling the static check linting. This suggests that the reasons for using //nolint:staticcheck are not documented in the code.

  • test/e2e/minor_version_compatibility.go
  • test/e2e/major_upgrade_v2.go
  • test/e2e/testnet/txsimNode.go
  • test/e2e/testnet/node.go
  • test/e2e/benchmark/benchmark.go
  • test/e2e/testnet/testnet.go

None of these files contain comments explaining the use of //nolint:staticcheck.

Analysis chain

Ensure the static check linting is appropriately disabled for valid reasons.


To ensure that the static check linting is disabled for valid reasons, we need to verify if there are any comments or explanations in the surrounding code that justify the use of //nolint:staticcheck. Since the initial context did not provide sufficient information, we should extend the search context.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify that the static check linting is disabled for valid reasons.

# Test: Search for the static check linting disable comments. Expect: Comments explaining the reason.
rg --type go $'//nolint:staticcheck' -C 5

Length of output: 1524



Script:

#!/bin/bash
# Description: Verify if there are explanations for disabling static check linting by extending the context.

# Test: Search for the static check linting disable comments with extended context to find any explanations.
rg --type go $'//nolint:staticcheck' -C 10

Length of output: 3017

@@ -1,19 +1,17 @@
//nolint:staticcheck
Copy link
Contributor

Choose a reason for hiding this comment

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

Tip

Codebase Verification

The search did not find any comments in the file explaining the reason for disabling the static check.

  • Ensure to add a comment explaining why the //nolint:staticcheck directive is necessary.
Analysis chain

Ensure that the static check is disabled for a valid reason.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the reason for disabling static checks.

# Test: Search for explanations in code comments. Expect: Comment explaining the reason.
rg --type go '//nolint:staticcheck' -A 1 test/e2e/major_upgrade_v2.go

Length of output: 103



Script:

#!/bin/bash
# Description: Search for any comments in the file that might explain the reason for disabling the static check.

# Test: Search for all comments in the file. Expect: Any comment that provides an explanation.
rg --type go '^\\s*//' test/e2e/major_upgrade_v2.go

Length of output: 53

@@ -1,8 +1,8 @@
//nolint:staticcheck
Copy link
Contributor

Choose a reason for hiding this comment

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

Tip

Codebase Verification

The search results indicate multiple instances of the //nolint:staticcheck directive across various files in the codebase, but none of them provide an explanation or justification for disabling the static check.

  • test/e2e/minor_version_compatibility.go
  • test/util/malicious/test_app.go
  • test/e2e/major_upgrade_v2.go
  • test/e2e/testnet/txsimNode.go
  • test/e2e/testnet/testnet.go
  • test/e2e/testnet/node.go
  • test/e2e/benchmark/benchmark.go
  • cmd/celestia-appd/cmd/root.go

None of these instances include comments explaining the reason for disabling the static check.

Analysis chain

Ensure that the static check is disabled for a valid reason.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the reason for disabling static checks.

# Test: Search for explanations in code comments. Expect: Comment explaining the reason.
rg --type go '//nolint:staticcheck' -A 1 test/e2e/minor_version_compatibility.go

Length of output: 114



Script:

#!/bin/bash
# Description: Search for project-wide documentation or comments explaining the use of `//nolint:staticcheck`.

# Search for any comments in the codebase that mention `staticcheck`.
rg --type go 'staticcheck' -A 3

Length of output: 1535

@@ -1,3 +1,4 @@
//nolint:staticcheck
Copy link
Contributor

Choose a reason for hiding this comment

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

Tip

Codebase Verification

There is no comment explaining the reason for disabling the static check in the surrounding lines of the //nolint:staticcheck directive.

  • test/e2e/benchmark/benchmark.go:1

Please ensure that the static check is disabled for a valid reason and add a comment explaining why it is necessary.

Analysis chain

Ensure that the static check is disabled for a valid reason.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the reason for disabling static checks.

# Test: Search for explanations in code comments. Expect: Comment explaining the reason.
rg --type go '//nolint:staticcheck' -A 1 test/e2e/benchmark/benchmark.go

Length of output: 106



Script:

#!/bin/bash
# Description: Search for any comments in the surrounding lines of the nolint directive to find an explanation.

# Test: Search for comments in the first 10 lines of the file to find any explanation for disabling static checks.
rg --type go '^//.*' -A 10 test/e2e/benchmark/benchmark.go

Length of output: 1315

Comment on lines +247 to +257
// This returns the proxy host that can be used to communicate with the node
func (n Node) AddressRPC() string {
return fmt.Sprintf("http://127.0.0.1:%d", n.rpcProxyPort)
return n.rpcProxyHost
}

// AddressGRPC returns a GRPC endpoint address for the node. This returns the
// local proxy port that can be used to communicate with the node
func (n Node) AddressGRPC() string {
return fmt.Sprintf("127.0.0.1:%d", n.grpcProxyPort)
}
// FIXME: This does not work currently with the reverse proxy
// // AddressGRPC returns a GRPC endpoint address for the node.
// // This returns the proxy host that can be used to communicate with the node
// func (n Node) AddressGRPC() string {
// return n.grpcProxyHost
// }
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider removing commented-out code if it is no longer needed.

- // FIXME: This does not work currently with the reverse proxy
- // // AddressGRPC returns a GRPC endpoint address for the node.
- // // This returns the proxy host that can be used to communicate with the node
- // func (n Node) AddressGRPC() string {
- // 	return n.grpcProxyHost
- // }
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. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// This returns the proxy host that can be used to communicate with the node
func (n Node) AddressRPC() string {
return fmt.Sprintf("http://127.0.0.1:%d", n.rpcProxyPort)
return n.rpcProxyHost
}
// AddressGRPC returns a GRPC endpoint address for the node. This returns the
// local proxy port that can be used to communicate with the node
func (n Node) AddressGRPC() string {
return fmt.Sprintf("127.0.0.1:%d", n.grpcProxyPort)
}
// FIXME: This does not work currently with the reverse proxy
// // AddressGRPC returns a GRPC endpoint address for the node.
// // This returns the proxy host that can be used to communicate with the node
// func (n Node) AddressGRPC() string {
// return n.grpcProxyHost
// }
// This returns the proxy host that can be used to communicate with the node
func (n Node) AddressRPC() string {
return n.rpcProxyHost
}

@@ -1,8 +1,7 @@
//nolint:staticcheck
Copy link
Contributor

Choose a reason for hiding this comment

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

Tip

Codebase Verification

The //nolint:staticcheck comment in test/e2e/testnet/node.go lacks an accompanying explanation. Additionally, the analysis of the code did not reveal any obvious reasons for disabling static checks, such as unused variables or deprecated functions.

  • File: test/e2e/testnet/node.go
  • Lines: 1-1

Please provide an explanation for disabling static checks or ensure that the static check is disabled for a valid reason.

Analysis chain

Ensure that the static check is disabled for a valid reason.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the reason for disabling static checks.

# Test: Search for explanations in code comments. Expect: Comment explaining the reason.
rg --type go '//nolint:staticcheck' -A 1 test/e2e/testnet/node.go

Length of output: 102



Script:

#!/bin/bash
# Search for all comments in the file to find any explanations for disabling static checks
rg --type go '^//' test/e2e/testnet/node.go

# Analyze the code in the file to identify potential static check issues
ast-grep --lang go --pattern $'package $_\n$$$' test/e2e/testnet/node.go

Length of output: 1538



Script:

#!/bin/bash
# Analyze the code in the file to identify potential static check issues with a corrected AST-grep pattern
ast-grep --lang go --pattern $'package $_ { $$$ }' test/e2e/testnet/node.go

Length of output: 517



Script:

#!/bin/bash
# Analyze the code in the file to identify potential static check issues with a more specific AST-grep pattern
ast-grep --lang go --pattern $'$_ := $_' test/e2e/testnet/node.go
ast-grep --lang go --pattern $'$_ = $_' test/e2e/testnet/node.go
ast-grep --lang go --pattern $'func $_($_) $_ { $$$ }' test/e2e/testnet/node.go

Length of output: 4654

Copy link
Contributor

@staheri14 staheri14 left a comment

Choose a reason for hiding this comment

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

Thanks @smuu! I ran all the e2e tests and confirm that they work:

  • E2ESimple ✅
  • MinorVersionCompatibility ✅
  • MajorUpgradeToV2 ✅

The only concern I have is that I keep requiring creating a new namespace for each test (as suggested by @mojtaba-esk in this comment) due to this error

2024/06/17 12:20:09 failed to create testnet: cannot initialize knuu: cannot deploy Traefik: error creating Traefik deployment: deployments.apps "traefik-deployment" already exists

Could it be related to the changes introduced in this PR? Does it also happen to other reviewers?

logger.Println("Creating txsim")
endpoints, err := testNet.RemoteGRPCEndpoints()
testnet.NoError("failed to get remote gRPC endpoints", err)
err = testNet.CreateTxClient("txsim", testnet.TxsimVersion, 1, "100-2000", 100, testnet.DefaultResources, endpoints[0])
Copy link
Contributor

Choose a reason for hiding this comment

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

[Not to be addressed in this PR yet relevant]: testnet.TxsimVersion is currently a hardcoded version of txsim. While it works fine for benchmark tests, I believe that for e2e tests, especially considering our plan to add this capability, we need to ensure that we always use the latest version of txsim. We already have an issue for this: #3288.

@celestia-bot celestia-bot requested a review from a team June 18, 2024 11:02
Copy link
Member

@evan-forbes evan-forbes left a comment

Choose a reason for hiding this comment

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

@smuu can we link any issues to re-enable reverse proxy (or whatever mechanism enables us to access grpc via the node assessing the tests) for posterity?

thanks!

Copy link
Contributor

@cmwaters cmwaters left a comment

Choose a reason for hiding this comment

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

👍 thanks @smuu this is super helpful

@cmwaters
Copy link
Contributor

@evan-forbes will the local machine running the tests ever need access to a nodes grpc? (Can't we use rpc or grpc gateway instead)

@smuu
Copy link
Member Author

smuu commented Jun 18, 2024

Thanks @smuu! I ran all the e2e tests and confirm that they work:

* E2ESimple ✅

* MinorVersionCompatibility ✅

* MajorUpgradeToV2 ✅

The only concern I have is that I keep requiring creating a new namespace for each test (as suggested by @mojtaba-esk in this comment) due to this error

2024/06/17 12:20:09 failed to create testnet: cannot initialize knuu: cannot deploy Traefik: error creating Traefik deployment: deployments.apps "traefik-deployment" already exists

Could it be related to the changes introduced in this PR? Does it also happen to other reviewers?

@staheri14 How are you running the tests?

It's the default now for knuu to have a namespace per test run.

@smuu
Copy link
Member Author

smuu commented Jun 18, 2024

@smuu can we link any issues to re-enable reverse proxy (or whatever mechanism enables us to access grpc via the node assessing the tests) for posterity?

thanks!

To my understanding out reverse proxy can proxy gRPC connections.
The issue I see is the gRPC client as it appends the port 443 even though we already have a port and a path assigned. (Ref.: #3505 (comment)) Your RPC client is handling it as I would expect.
So in my view, we would need to create an issue in celestia-app repo to fix that.

@smuu
Copy link
Member Author

smuu commented Jun 18, 2024

@evan-forbes @cmwaters, as I don't have permission to merge, feel free to merge this when you feel the PR is ready.

@cmwaters cmwaters merged commit 115ef3a into celestiaorg:main Jun 18, 2024
32 checks passed
@cmwaters
Copy link
Contributor

Created this issue: #3580

@cmwaters
Copy link
Contributor

@staheri14, I'm also seeing the namespace problem appear in our CI tests:

test-e2e2024/06/18 13:12:01 === RUN MinorVersionCompatibility
time="2024-06-18T13:12:01Z" level=info msg="Initializing knuu with scope: runMinorVersionCompatibility_20240618_131201"
time="2024-06-18T13:12:01Z" level=info msg="The .env file does not exist, continuing without loading environment variables."
test-e2e2024/06/18 13:12:01 Running minor version compatibility test versions v1.0.0	v1.1.0	v1.10.0	v1.10.1	v1.11.0	v1.2.0	v1.3.0	v1.4.0	v1.5.0	v1.6.0	v1.7.0	v1.8.0	v1.9.0	v2.0.0-rc0	v2.0.0-rc1
time="2024-06-18T13:12:01Z" level=info msg="LOG_LEVEL: info" file="knuu/knuu.go:264"
2024/06/18 13:22:01 failed to create testnet: cannot initialize knuu: cannot deploy Traefik: waiting for deployment traefik-deployment to be ready

Going to create an issue.

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.

8 participants