Skip to content

Commit ab0c881

Browse files
committed
integration test testing
see if waiting longer allows the server to reload
1 parent cc6d06b commit ab0c881

File tree

3 files changed

+21
-4
lines changed

3 files changed

+21
-4
lines changed

.travis.yml

+1
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ jobs:
5656
directories:
5757
- $HOME/.cache/go-build
5858
- $HOME/.gradle
59+
- $HOME/.m2
5960
- os: linux
6061
name: "diag/Linux unit"
6162
script:

Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ integration-in-kind: skaffold-builder
183183
-v /tmp/docker-config:/root/.docker/config.json \
184184
-v $(CURDIR)/hack/maven/settings.xml:/root/.m2/settings.xml \
185185
-e KUBECONFIG=/tmp/kind-config \
186+
-e INTEGRATION_TEST_ARGS="-run=TestDevAutoSync" \
186187
gcr.io/$(GCP_PROJECT)/skaffold-builder \
187188
sh -c ' \
188189
kind get clusters | grep -q kind || TERM=dumb kind create cluster --image=kindest/node:v1.13.12@sha256:ad1dd06aca2b85601f882ba1df4fdc03d5a57b304652d0e81476580310ba6289; \

integration/sync_test.go

+19-4
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ limitations under the License.
1717
package integration
1818

1919
import (
20+
"bufio"
2021
"context"
22+
"fmt"
2123
"io/ioutil"
2224
"os"
2325
"os/exec"
@@ -113,10 +115,21 @@ func TestDevAutoSync(t *testing.T) {
113115
ns, client, deleteNs := SetupNamespace(t)
114116
defer deleteNs()
115117

116-
stop := skaffold.Dev("--trigger", "notify").WithProfiles(test.profiles).InDir(dir).InNs(ns.Name).RunBackground(t)
117-
defer stop()
118+
devOut, cancel := skaffold.Dev("--trigger", "notify").WithProfiles(test.profiles).InDir(dir).InNs(ns.Name).RunBackgroundOutput(t)
119+
defer cancel()
120+
121+
go func() {
122+
scanner := bufio.NewScanner(devOut)
123+
scanner.Split(bufio.ScanLines)
124+
for scanner.Scan() {
125+
fmt.Println("STDOUT:" + scanner.Text());
126+
}
127+
}()
118128

119129
client.WaitForPodsReady("test-file-sync")
130+
// give the server a chance to warm up, integration tests in KIND have a tendency to fail if
131+
// this doesn't happen, I can't recreate this in any other environment
132+
// time.Sleep(time.Second * 5)
120133

121134
// direct file sync (this file is an existing file checked in for this testdata)
122135
directFile := "direct-file"
@@ -142,9 +155,11 @@ func TestDevAutoSync(t *testing.T) {
142155
if err := ioutil.WriteFile(generatedFileSrc, []byte(newContents), 0644); err != nil {
143156
t.Fatalf("Failed to write new contents to file %s", generatedFileSrc)
144157
}
145-
defer func() { ioutil.WriteFile(generatedFileSrc, oldContents, 0644) }()
158+
defer func() {
159+
ioutil.WriteFile(generatedFileSrc, oldContents, 0644)
160+
}()
146161
}
147-
err = wait.PollImmediate(time.Millisecond*500, 1*time.Minute, func() (bool, error) {
162+
err = wait.PollImmediate(time.Millisecond*500, 3*time.Minute, func() (bool, error) {
148163
// distroless debug only has wget, not curl
149164
out, _ := exec.Command("kubectl", "exec", "test-file-sync", "-n", ns.Name, "--", "wget", "localhost:8080/", "-q", "-O", "-").Output()
150165
return string(out) == test.uniqueStr, nil

0 commit comments

Comments
 (0)