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

Add port forwarding integration test #2623

Merged
merged 7 commits into from
Aug 12, 2019

Conversation

priyawadhwa
Copy link
Contributor

@priyawadhwa priyawadhwa commented Aug 9, 2019

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

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) {
Copy link
Contributor Author

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

@codecov
Copy link

codecov bot commented Aug 9, 2019

Codecov Report

Merging #2623 into master will not change coverage.
The diff coverage is n/a.

Impacted Files Coverage Δ
...kubernetes/portforward/port_forward_integration.go 0% <ø> (ø) ⬆️

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)
Copy link
Contributor

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

Copy link
Contributor Author

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.

case <-ctx.Done():
t.Fatalf("Timed out waiting for response from port %d", port)

default:
Copy link
Contributor

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

@tejal29 tejal29 merged commit 90d92e5 into GoogleContainerTools:master Aug 12, 2019
@priyawadhwa priyawadhwa deleted the integration branch August 12, 2019 22:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants