@@ -18,6 +18,7 @@ import (
18
18
"sigs.k8s.io/e2e-framework/pkg/envconf"
19
19
"sigs.k8s.io/e2e-framework/pkg/features"
20
20
21
+ "github.com/gitpod-io/gitpod/common-go/log"
21
22
csapi "github.com/gitpod-io/gitpod/content-service/api"
22
23
gitpod "github.com/gitpod-io/gitpod/gitpod-protocol"
23
24
agent "github.com/gitpod-io/gitpod/test/pkg/agent/workspace/api"
@@ -223,7 +224,7 @@ func TestOpenWorkspaceFromPrebuild(t *testing.T) {
223
224
},
224
225
}
225
226
226
- ctx , cancel := context .WithTimeout (context .Background (), time .Duration (15 * len (tests ))* time .Minute )
227
+ ctx , cancel := context .WithTimeout (context .Background (), time .Duration (10 * len (tests ))* time .Minute )
227
228
defer cancel ()
228
229
229
230
for _ , test := range tests {
@@ -238,7 +239,7 @@ func TestOpenWorkspaceFromPrebuild(t *testing.T) {
238
239
req .Type = wsmanapi .WorkspaceType_PREBUILD
239
240
req .Spec .Envvars = append (req .Spec .Envvars , & wsmanapi.EnvironmentVariable {
240
241
Name : "GITPOD_TASKS" ,
241
- Value : fmt . Sprintf ( `[{ "init": %q }]` , initTask ) ,
242
+ Value : `[{ "init": "echo \"some output\" > someFile; sleep 20; exit 1;" }]` ,
242
243
})
243
244
req .Spec .FeatureFlags = test .FF
244
245
req .Spec .Initializer = & csapi.WorkspaceInitializer {
@@ -352,53 +353,60 @@ func TestOpenWorkspaceFromPrebuild(t *testing.T) {
352
353
checkPrebuildLog = true
353
354
break
354
355
}
356
+ log .Infof ("[%d] retry..." , i )
355
357
time .Sleep (6 * time .Second )
356
358
}
357
359
358
360
if ! checkPrebuildLog {
359
- // somehow, the prebuild log message '🤙 This task ran as a workspace prebuild' does not exists
360
- // we fall back to check the the init task message within the /workspace/.gitpod/prebuild-log-* or not
361
- t .Logf ("cannot found the prebuild message %s in %s, err:%v, exitCode:%d, stdout:%s" , prebuildLog , prebuildLogPath , err , resp .ExitCode , resp .Stdout )
362
-
363
- // check the init task message exists
364
- var checkInitTaskMsg bool
365
- err = rsa .Call ("WorkspaceAgent.Exec" , & agent.ExecRequest {
366
- Dir : prebuildLogPath ,
367
- Command : "bash" ,
368
- Args : []string {
369
- "-c" ,
370
- fmt .Sprintf ("grep %q *" , initTask ),
371
- },
372
- }, & resp )
373
- if err == nil && resp .ExitCode == 0 && strings .Trim (resp .Stdout , " \t \n " ) != "" {
374
- checkInitTaskMsg = true
375
- }
361
+ t .Fatalf ("cannot found the prebuild message %s in %s, err:%v, exitCode:%d, stdout:%s" , prebuildLog , prebuildLogPath , err , resp .ExitCode , resp .Stdout )
362
+ }
376
363
377
- if ! checkInitTaskMsg {
378
- t .Logf ("cannot found the init task message %s in %s, err:%v, exitCode:%d, stdout:%s" , initTask , prebuildLogPath , err , resp .ExitCode , resp .Stdout )
379
-
380
- // somehow, the init task message does not exist within the /workspace/.gitpod/prebuild-log-*
381
- // we fall back to check the file exists or not
382
- var ls agent.ListDirResponse
383
- err = rsa .Call ("WorkspaceAgent.ListDir" , & agent.ListDirRequest {
384
- Dir : test .WorkspaceRoot ,
385
- }, & ls )
386
- if err != nil {
387
- t .Fatal (err )
364
+ /*
365
+ if !checkPrebuildLog {
366
+ // somehow, the prebuild log message '🤙 This task ran as a workspace prebuild' does not exists
367
+ // we fall back to check the the init task message within the /workspace/.gitpod/prebuild-log-* or not
368
+ t.Logf("cannot found the prebuild message %s in %s, err:%v, exitCode:%d, stdout:%s", prebuildLog, prebuildLogPath, err, resp.ExitCode, resp.Stdout)
369
+
370
+ // check the init task message exists
371
+ var checkInitTaskMsg bool
372
+ err = rsa.Call("WorkspaceAgent.Exec", &agent.ExecRequest{
373
+ Dir: prebuildLogPath,
374
+ Command: "bash",
375
+ Args: []string{
376
+ "-c",
377
+ fmt.Sprintf("grep %q *", initTask),
378
+ },
379
+ }, &resp)
380
+ if err == nil && resp.ExitCode == 0 && strings.Trim(resp.Stdout, " \t\n") != "" {
381
+ checkInitTaskMsg = true
388
382
}
389
383
390
- var found bool
391
- for _ , f := range ls .Files {
392
- if filepath .Base (f ) == "someFile" {
393
- found = true
394
- break
384
+ if !checkInitTaskMsg {
385
+ t.Logf("cannot found the init task message %s in %s, err:%v, exitCode:%d, stdout:%s", initTask, prebuildLogPath, err, resp.ExitCode, resp.Stdout)
386
+
387
+ // somehow, the init task message does not exist within the /workspace/.gitpod/prebuild-log-*
388
+ // we fall back to check the file exists or not
389
+ var ls agent.ListDirResponse
390
+ err = rsa.Call("WorkspaceAgent.ListDir", &agent.ListDirRequest{
391
+ Dir: test.WorkspaceRoot,
392
+ }, &ls)
393
+ if err != nil {
394
+ t.Fatal(err)
395
+ }
396
+
397
+ var found bool
398
+ for _, f := range ls.Files {
399
+ if filepath.Base(f) == "someFile" {
400
+ found = true
401
+ break
402
+ }
403
+ }
404
+ if !found {
405
+ t.Fatal("did not find someFile from previous workspace instance")
395
406
}
396
- }
397
- if ! found {
398
- t .Fatal ("did not find someFile from previous workspace instance" )
399
407
}
400
408
}
401
- }
409
+ */
402
410
403
411
// write file foobar.txt and stop the workspace
404
412
err = rsa .Call ("WorkspaceAgent.WriteFile" , & agent.WriteFileRequest {
0 commit comments