diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index c7199c4a..69bd005b 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -25,7 +25,7 @@ jobs: run: kind create cluster -n sshpipertest - name: E2E - run: docker-compose up --build --abort-on-container-exit + run: docker-compose up --build --abort-on-container-exit --exit-code-from testrunner working-directory: e2e env: COMPOSE_DOCKER_CLI_BUILD: "1" diff --git a/e2e/docker-compose.yml b/e2e/docker-compose.yml index d1ee2e80..43b1c48c 100644 --- a/e2e/docker-compose.yml +++ b/e2e/docker-compose.yml @@ -41,19 +41,20 @@ services: - bash - -c - | - # kind delete cluster -n sshpipertest && - (kind get kubeconfig -q -n sshpipertest || kind create cluster -n sshpipertest) && - docker network connect kind $$(hostname) && # self contain + # kind delete cluster -n sshpipertest + (kind get kubeconfig -q -n sshpipertest || kind create cluster -n sshpipertest) + docker network connect kind $$(hostname) # self contain docker network connect e2e_default sshpipertest-control-plane kind export kubeconfig -n sshpipertest --internal - kind load docker-image -n sshpipertest e2e_piper-imageonly && - kubectl wait --for=condition=ready pod -A --all --timeout=2m && - kubectl apply -f /kubernetes/crd.yaml && - kubectl apply -f /kubernetes/workload.yaml && - #kubectl set image deployment/sshpiper-deployment sshpiper=e2e_piper-imageonly && - kubectl delete pod -l app=sshpiper && + #kubectl delete po -l k8s-app=kube-dns -A + kind load docker-image -n sshpipertest e2e_piper-imageonly + kubectl wait --for=condition=ready pod -A --all --timeout=2m + kubectl apply -f /kubernetes/crd.yaml + kubectl apply -f /kubernetes/workload.yaml + #kubectl set image deployment/sshpiper-deployment sshpiper=e2e_piper-imageonly kubectl wait deployment --all --for condition=Available=True - kubectl port-forward service/sshpiper --pod-running-timeout=2m --address 0.0.0.0 2222:2222 + kubectl port-forward service/sshpiper --pod-running-timeout=2m --address 0.0.0.0 2222:2222 & + kubectl logs -f deployment/sshpiper-deployment privileged: true depends_on: - host-publickey diff --git a/e2e/main_test.go b/e2e/main_test.go index 7e257dea..f161236d 100644 --- a/e2e/main_test.go +++ b/e2e/main_test.go @@ -84,7 +84,9 @@ func waitForEndpointReadyWithTimeout(addr string, timeout time.Duration) { } func runCmd(cmd string, args ...string) (*exec.Cmd, io.Writer, io.Reader, error) { - c := exec.Command(cmd, args...) + newargs := append([]string{cmd}, args...) + newargs = append([]string{"-i0", "-o0", "-e0"}, newargs...) + c := exec.Command("stdbuf", newargs...) c.SysProcAttr = &syscall.SysProcAttr{Pdeathsig: syscall.SIGTERM} f, err := pty.Start(c) if err != nil { @@ -128,6 +130,8 @@ func enterPassword(stdin io.Writer, stdout io.Reader, password string) { log.Panic("timeout waiting for password prompt") return } + + time.Sleep(time.Second) // stdout has no data yet } }