-
Notifications
You must be signed in to change notification settings - Fork 164
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
test: add tunnel tests #2535
test: add tunnel tests #2535
Conversation
✅ Deploy Preview for zarf-docs canceled.
|
The tunnel connect function is currently too difficult to test. It will require some refactoring to split out the logic from the functionality to increase code coverage. |
Name: "wrong-label", | ||
Namespace: "", | ||
Labels: map[string]string{ | ||
config.ZarfConnectLabelName: "wrong", |
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.
Shouldn't these error?
ti, err := c.checkForZarfConnectLabel(ctx, "good") | ||
require.NoError(t, err) | ||
require.Equal(t, k8s.SvcResource, ti.resourceType) | ||
require.Equal(t, "good-service", ti.resourceName) | ||
require.Equal(t, "good-namespace", ti.namespace) | ||
require.Equal(t, 9090, ti.remotePort) | ||
require.Equal(t, "foobar", ti.urlSuffix) |
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.
It looks like this test primarily covers the happy path. I noticed the missing-label and wrong-label test cases, and I assume you would like to test those error paths as well.
I think we can iterate over the svcs
and pass in svc.Name
as an argument to checkForZarfConnectLabel
Description
Adds tests to cluster tunnel.
Related Issue
Relates to #2512
Checklist before merging