Skip to content

Commit

Permalink
Prewarm benchmarks (pulumi#1271)
Browse files Browse the repository at this point in the history
  • Loading branch information
t0yv0 authored Sep 2, 2022
1 parent a9d20fc commit 15f0857
Showing 1 changed file with 41 additions and 14 deletions.
55 changes: 41 additions & 14 deletions misc/test/performance_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build Performance || all
// +build Performance all

package test
Expand Down Expand Up @@ -36,8 +37,8 @@ func TestAccAwsGoS3Folder(t *testing.T) {
})
},
}
test := getAWSBase(t).With(opts).With(benchmark.ProgramTestOptions())
integration.ProgramTest(t, &test)
test := getAWSBase(t).With(opts)
programTestAsBenchmark(t, benchmark, test)
}

func TestAccAwsCsS3Folder(t *testing.T) {
Expand All @@ -52,8 +53,8 @@ func TestAccAwsCsS3Folder(t *testing.T) {
})
},
}
test := getAWSBase(t).With(opts).With(benchmark.ProgramTestOptions())
integration.ProgramTest(t, &test)
test := getAWSBase(t).With(opts)
programTestAsBenchmark(t, benchmark, test)
}

func TestAccAwsFsS3Folder(t *testing.T) {
Expand All @@ -68,8 +69,8 @@ func TestAccAwsFsS3Folder(t *testing.T) {
})
},
}
test := getAWSBase(t).With(opts).With(benchmark.ProgramTestOptions())
integration.ProgramTest(t, &test)
test := getAWSBase(t).With(opts)
programTestAsBenchmark(t, benchmark, test)
}

func TestAccAwsJsS3Folder(t *testing.T) {
Expand All @@ -82,8 +83,8 @@ func TestAccAwsJsS3Folder(t *testing.T) {
})
},
}
test := getAWSBase(t).With(opts).With(benchmark.ProgramTestOptions())
integration.ProgramTest(t, &test)
test := getAWSBase(t).With(opts)
programTestAsBenchmark(t, benchmark, test)
}

func TestAccAwsTsS3Folder(t *testing.T) {
Expand All @@ -96,8 +97,8 @@ func TestAccAwsTsS3Folder(t *testing.T) {
})
},
}
test := getAWSBase(t).With(opts).With(benchmark.ProgramTestOptions())
integration.ProgramTest(t, &test)
test := getAWSBase(t).With(opts)
programTestAsBenchmark(t, benchmark, test)
}

func TestAccAwsPyS3Folder(t *testing.T) {
Expand All @@ -110,8 +111,8 @@ func TestAccAwsPyS3Folder(t *testing.T) {
})
},
}
test := getAWSBase(t).With(opts).With(benchmark.ProgramTestOptions())
integration.ProgramTest(t, &test)
test := getAWSBase(t).With(opts)
programTestAsBenchmark(t, benchmark, test)
}

type manyResourcesConfig struct {
Expand Down Expand Up @@ -166,8 +167,8 @@ func TestManyResources(t *testing.T) {
assert.Equal(t, float64(cfg.payloadBytes), stack.Outputs["ResourcePayloadBytes"])
},
}
test := getBaseOptions(t).With(opts).With(cfg.bench.ProgramTestOptions())
integration.ProgramTest(t, &test)
test := getBaseOptions(t).With(opts)
programTestAsBenchmark(t, cfg.bench, test)
}

for _, cfg := range configurations {
Expand All @@ -177,6 +178,32 @@ func TestManyResources(t *testing.T) {
}
}

func programTestAsBenchmark(
t *testing.T,
bench traces.Benchmark,
test integration.ProgramTestOptions) {

// Run preview only to make sure all needed plugins are
// downloaded so that these downloads do not skew
// measurements.
t.Run("prewarm", func(t *testing.T) {
prewarmOptions := test.With(integration.ProgramTestOptions{
SkipRefresh: true,
SkipEmptyPreviewUpdate: true,
SkipExportImport: true,
SkipUpdate: true,
})
prewarmOptions.ExtraRuntimeValidation = nil
integration.ProgramTest(t, &prewarmOptions)
})

// Run with --tracing to record measured data.
t.Run("benchmark", func(t *testing.T) {
finalOptions := test.With(bench.ProgramTestOptions())
integration.ProgramTest(t, &finalOptions)
})
}

func TestMain(m *testing.M) {
code := m.Run()

Expand Down

0 comments on commit 15f0857

Please sign in to comment.