@@ -17,7 +17,9 @@ limitations under the License.
17
17
package integration
18
18
19
19
import (
20
+ "bufio"
20
21
"context"
22
+ "fmt"
21
23
"io/ioutil"
22
24
"os"
23
25
"os/exec"
@@ -113,10 +115,21 @@ func TestDevAutoSync(t *testing.T) {
113
115
ns , client , deleteNs := SetupNamespace (t )
114
116
defer deleteNs ()
115
117
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
+ }()
118
128
119
129
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)
120
133
121
134
// direct file sync (this file is an existing file checked in for this testdata)
122
135
directFile := "direct-file"
@@ -142,9 +155,11 @@ func TestDevAutoSync(t *testing.T) {
142
155
if err := ioutil .WriteFile (generatedFileSrc , []byte (newContents ), 0644 ); err != nil {
143
156
t .Fatalf ("Failed to write new contents to file %s" , generatedFileSrc )
144
157
}
145
- defer func () { ioutil .WriteFile (generatedFileSrc , oldContents , 0644 ) }()
158
+ defer func () {
159
+ ioutil .WriteFile (generatedFileSrc , oldContents , 0644 )
160
+ }()
146
161
}
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 ) {
148
163
// distroless debug only has wget, not curl
149
164
out , _ := exec .Command ("kubectl" , "exec" , "test-file-sync" , "-n" , ns .Name , "--" , "wget" , "localhost:8080/" , "-q" , "-O" , "-" ).Output ()
150
165
return string (out ) == test .uniqueStr , nil
0 commit comments