Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove useless nodes from test XML #464

Merged
merged 3 commits into from
Mar 15, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 32 additions & 35 deletions integration_test/third_party_apps_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -452,45 +452,42 @@ func TestThirdPartyApps(t *testing.T) {
// Execute tests
for _, tc := range tests {
tc := tc // https://golang.org/doc/faq#closures_and_goroutines
t.Run(tc.platform, func(t *testing.T) {
t.Run(tc.platform+"/"+tc.app, func(t *testing.T) {
t.Parallel()
t.Run(tc.app, func(t *testing.T) {
t.Parallel()

if tc.skipReason != "" {
t.Skip(tc.skipReason)
}
if tc.skipReason != "" {
t.Skip(tc.skipReason)
}

ctx, cancel := context.WithTimeout(context.Background(), gce.SuggestedTimeout)
defer cancel()

var err error
for attempt := 1; attempt <= 4; attempt++ {
logger := gce.SetupLogger(t)
logger.ToMainLog().Println("Calling SetupVM(). For details, see VM_initialization.txt.")
vm := gce.SetupVM(ctx, t, logger.ToFile("VM_initialization.txt"), gce.VMOptions{Platform: tc.platform, MachineType: agents.RecommendedMachineType(tc.platform)})
logger.ToMainLog().Printf("VM is ready: %#v", vm)

var retryable bool
retryable, err = runSingleTest(ctx, logger, vm, agentType, tc.app)
log.Printf("Attempt %v of %s test of %s finished with err=%v, retryable=%v", attempt, tc.platform, tc.app, err, retryable)
if err == nil {
return
}
agents.RunOpsAgentDiagnostics(ctx, logger, vm)
if !retryable {
t.Fatalf("Non-retryable error: %v", err)
}
// If we got here, we're going to retry runSingleTest(). The VM we spawned
// won't be deleted until the end of t.Run(), (SetupVM() registers it for cleanup
// at the end of t.Run()), so to avoid accumulating too many idle VMs while we
// do our retries, we preemptively delete the VM now.
if deleteErr := gce.DeleteInstance(logger.ToMainLog(), vm); deleteErr != nil {
t.Errorf("Deleting VM %v failed: %v", vm.Name, deleteErr)
}
ctx, cancel := context.WithTimeout(context.Background(), gce.SuggestedTimeout)
defer cancel()

var err error
for attempt := 1; attempt <= 4; attempt++ {
logger := gce.SetupLogger(t)
logger.ToMainLog().Println("Calling SetupVM(). For details, see VM_initialization.txt.")
vm := gce.SetupVM(ctx, t, logger.ToFile("VM_initialization.txt"), gce.VMOptions{Platform: tc.platform, MachineType: agents.RecommendedMachineType(tc.platform)})
logger.ToMainLog().Printf("VM is ready: %#v", vm)

var retryable bool
retryable, err = runSingleTest(ctx, logger, vm, agentType, tc.app)
log.Printf("Attempt %v of %s test of %s finished with err=%v, retryable=%v", attempt, tc.platform, tc.app, err, retryable)
if err == nil {
return
}
agents.RunOpsAgentDiagnostics(ctx, logger, vm)
if !retryable {
t.Fatalf("Non-retryable error: %v", err)
}
t.Errorf("Final attempt failed: %v", err)
})
// If we got here, we're going to retry runSingleTest(). The VM we spawned
// won't be deleted until the end of t.Run(), (SetupVM() registers it for cleanup
// at the end of t.Run()), so to avoid accumulating too many idle VMs while we
// do our retries, we preemptively delete the VM now.
if deleteErr := gce.DeleteInstance(logger.ToMainLog(), vm); deleteErr != nil {
t.Errorf("Deleting VM %v failed: %v", vm.Name, deleteErr)
}
}
t.Errorf("Final attempt failed: %v", err)
})
}
}