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

[tmpnet] Update URI and StakingAddress usage in support of kube #3665

Merged
merged 1 commit into from
Feb 3, 2025

Conversation

marun
Copy link
Contributor

@marun marun commented Jan 20, 2025

Why this should be merged

Previously, Node.URI and Node.StakingAddress fields contained values for a local process and were always locally accessible. Nodes running in kubernetes may be running remotely, though, and only be accessible if e.g. a local port is forwarded to the port of a node's pod. To ensure compatibility with forwarded URIs and StakingAddresses, callers that aren't guaranteed to be running locally to a node are updated to access these values via functions that can ensure a remote endpoint is forwarded if the target node isn't running locally.

How this was tested

CI

Need to be documented in RELEASES.md?

N/A

TODO

@marun marun added the testing This primarily focuses on testing label Jan 20, 2025
@marun marun self-assigned this Jan 20, 2025
@maru-ava maru-ava assigned maru-ava and unassigned marun Jan 22, 2025
Base automatically changed from tmpnet-remove-save-port to master January 27, 2025 18:42
@maru-ava maru-ava marked this pull request as ready for review January 27, 2025 18:46
func GetLocalURI(tc tests.TestContext, node *tmpnet.Node) string {
uri, cancel, err := node.GetLocalURI(tc.DefaultContext())
require.NoError(tc, err)
tc.DeferCleanup(cancel)
Copy link
Contributor

Choose a reason for hiding this comment

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

why not just invoke defer cancel() ?

Copy link
Contributor

Choose a reason for hiding this comment

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

defer would call it on function exit and then the caller wouldn't be able to use the URI. DeferCleanup ensures it gets called when the test has completed and the caller doesn't need the URI anymore.

Previously, Node.URI and Node.StakingAddress fields contained values
for a local process and were always locally accessible. Nodes running
in kubernetes may be running remotely, though, and only be accessible
if e.g. a local port is forwarded to the port of a node's pod. To
ensure compatibility with forwarded URIs and StakingAddresses, callers
that aren't guaranteed to be running locally to a node are updated to
access these values via functions that can ensure a remote endpoint is
forwarded if the target node isn't running locally.
@maru-ava
Copy link
Contributor

maru-ava commented Feb 3, 2025

Rebased

@maru-ava maru-ava added this pull request to the merge queue Feb 3, 2025
Merged via the queue into master with commit 2641b53 Feb 3, 2025
22 checks passed
@maru-ava maru-ava deleted the local-addresses branch February 3, 2025 18:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
testing This primarily focuses on testing
Projects
Status: Done ✅
Development

Successfully merging this pull request may close these issues.

5 participants