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-forward to skaffold run #3263

Merged
merged 3 commits into from
Dec 20, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions integration/port_forward_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,28 @@ func TestPortForward(t *testing.T) {
portforward.WhiteBoxPortForwardCycle(t, kubectlCLI, ns.Name)
}

// TestPortForwardDeletePod tests that port forwarding works
func TestRunPortForwardDeletePod(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: this is not deleting so we can remove the Delete from the name

if testing.Short() || RunOnGCP() {
t.Skip("skipping kind integration test")
}

ns, _, deleteNs := SetupNamespace(t)
defer deleteNs()

stop := skaffold.Run("--port-forward").InDir("examples/microservices").InNs(ns.Name).RunBackground(t)
Copy link
Contributor

@balopat balopat Dec 18, 2019

Choose a reason for hiding this comment

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

you'll need to add some more flags to enable the API server: e.g. --rpc-port 50051 --enable-rpc=true - but I'd rather you use a random port like in the other test. - this is why the integration test is failing!

defer stop()

_, entries, shutdown := apiEvents(t, "50051")
defer shutdown()

address, localPort := getLocalPortFromPortForwardEvent(t, entries, "leeroy-app", "service", ns.Name)
assertResponseFromPort(t, address, localPort, constants.LeeroyAppResponse)
}

// TestDevPortForwardDeletePod tests that port forwarding works
// as expected. Then, the test force deletes a pod,
// and tests that the pod eventually comes up at the same port again.
func TestPortForwardDeletePod(t *testing.T) {
func TestDevPortForwardDeletePod(t *testing.T) {
if testing.Short() || RunOnGCP() {
t.Skip("skipping kind integration test")
}
Expand Down