-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Add port forwarding integration test #2623
Conversation
This tests makes sure that port forwarding works as expected. It then deletes all pods, and makes sure that port forwarding comes back upon the same port.
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/util" | ||
) | ||
|
||
func TestPortForward(t *testing.T) { |
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.
This test was copied and pasted from the deleted file white_box_test.go
ed8ff1f
to
7df1787
Compare
7df1787
to
12c47e3
Compare
Codecov Report
|
t.Fatalf("error deleting all pods: %v \n %s", err, string(output)) | ||
} | ||
// port forwarding should come up again on the same port | ||
assertResponseFromPort(t, localPort, constants.LeeroyAppResponse) |
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.
Can you run this test 100 times and make sure there are no flakes.
"INTEGRATION_TEST_ARGS="-test.run ^TestPortForwardDeletePod --test.count 100" make integration
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.
Good idea -- for some reason my laptop gets really slow when running tests, so I ran 20 (~20 min) and it passed against Minikube.
integration/dev_test.go
Outdated
case <-ctx.Done(): | ||
t.Fatalf("Timed out waiting for response from port %d", port) | ||
|
||
default: |
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.
you could also change this too
select {
case <-ctx.Done():
t.Fatalf("Timed out waiting for response from port %d", port)
case <- time.After(1* time.Sleep):
You can also create a timer and re-use (by resetting) the same one to avoid creating new channel time.After
This tests makes sure that port forwarding works as expected. It then
deletes all pods, and makes sure that port forwarding comes back
upon the same port.
First of a few tests for #2596