profiler: simplify integration test
@@ -199,6 +199,10 @@ func TestAgentIntegration(t *testing.T) {
ComputeService: computeService,
}
+ // Determine go version used by current test run
+ goVersion := strings.TrimPrefix(runtime.Version(), "go")
+ goVersionName := strings.Replace(goVersion, ".", "", -1)
+
testcases := []goGCETestCase{
{
InstanceConfig: proftest.InstanceConfig{
@@ -216,36 +220,12 @@ func TestAgentIntegration(t *testing.T) {
InstanceConfig: proftest.InstanceConfig{
ProjectID: projectID,
Zone: zone,
- Name: fmt.Sprintf("profiler-test-go111-%s", runID),
- MachineType: "n1-standard-1",
- },
- name: fmt.Sprintf("profiler-test-go111-%s-gce", runID),
- wantProfileTypes: []string{"CPU", "HEAP", "THREADS", "CONTENTION", "HEAP_ALLOC"},
- goVersion: "1.11",
- mutexProfiling: true,
- },
- {
- InstanceConfig: proftest.InstanceConfig{
- ProjectID: projectID,
- Zone: zone,
- Name: fmt.Sprintf("profiler-test-go110-%s", runID),
- MachineType: "n1-standard-1",
- },
- name: fmt.Sprintf("profiler-test-go110-%s-gce", runID),
- wantProfileTypes: []string{"CPU", "HEAP", "THREADS", "CONTENTION", "HEAP_ALLOC"},
- goVersion: "1.10",
- mutexProfiling: true,
- },
- {
- InstanceConfig: proftest.InstanceConfig{
- ProjectID: projectID,
- Zone: zone,
- Name: fmt.Sprintf("profiler-test-go19-%s", runID),
+ Name: fmt.Sprintf("profiler-test-go%s-%s", goVersionName, runID),
MachineType: "n1-standard-1",
},
- name: fmt.Sprintf("profiler-test-go19-%s-gce", runID),
+ name: fmt.Sprintf("profiler-test-go%s-%s-gce", goVersionName, runID),
wantProfileTypes: []string{"CPU", "HEAP", "THREADS", "CONTENTION", "HEAP_ALLOC"},
- goVersion: "1.9",
+ goVersion: goVersion,
mutexProfiling: true,
},
}
@@ -284,7 +264,7 @@ func TestAgentIntegration(t *testing.T) {
continue
}
if err := pr.HasFunction("busywork"); err != nil {
- t.Error(err)
+ t.Errorf("HasFunction(%s, %s, %s, %s, %s) got error: %v", tc.ProjectID, tc.name, startTime, endTime, pType, err)
}
}
})
