From 2fbed4e12786293bf1a662c50522913a6ef7b6b7 Mon Sep 17 00:00:00 2001 From: Naoki Oketani Date: Wed, 18 Dec 2019 17:25:10 +0900 Subject: [PATCH] add integration test for skaffold run --port-forward --- integration/port_forward_test.go | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/integration/port_forward_test.go b/integration/port_forward_test.go index 51f1d1ce6a3..0305a2d1e4e 100644 --- a/integration/port_forward_test.go +++ b/integration/port_forward_test.go @@ -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) { + 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) + 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") }