Skip to content

Commit bfa72f1

Browse files
authored
Use PulumiHomeDir in programTestAsBenchmark to reuse plugins (#1834)
Fixes pulumi/pulumi#18233 We need to use the same PULUMI_HOME directory for each sub-run in a benchmark test so that we don't re-download plugins in each run. They should all be downloaded in the warmup run, and then reused in the actual benchmark runs.
1 parent 1f82711 commit bfa72f1

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

misc/test/performance_test.go

+6
Original file line numberDiff line numberDiff line change
@@ -219,11 +219,15 @@ func programTestAsBenchmark(
219219
bench traces.Benchmark,
220220
test integration.ProgramTestOptions,
221221
) {
222+
// Run all the tests with the same PULUMI_HOME so that plugins can be reused.
223+
pulumiHome := t.TempDir()
224+
222225
// Run preview only to make sure all needed plugins are
223226
// downloaded so that these downloads do not skew
224227
// measurements.
225228
t.Run("prewarm", func(t *testing.T) {
226229
prewarmOptions := test.With(integration.ProgramTestOptions{
230+
PulumiHomeDir: pulumiHome,
227231
RequireService: true,
228232
SkipRefresh: true,
229233
SkipEmptyPreviewUpdate: true,
@@ -240,6 +244,7 @@ func programTestAsBenchmark(
240244
// Run with --tracing to record measured data.
241245
t.Run("benchmark", func(t *testing.T) {
242246
finalOptions := test.With(bench.ProgramTestOptions()).With(integration.ProgramTestOptions{
247+
PulumiHomeDir: pulumiHome,
243248
RequireService: true,
244249
NoParallel: true,
245250
})
@@ -253,6 +258,7 @@ func programTestAsBenchmark(
253258
renamedBench := bench
254259
renamedBench.Name += "-filestate"
255260
finalOptions := test.With(renamedBench.ProgramTestOptions()).With(integration.ProgramTestOptions{
261+
PulumiHomeDir: pulumiHome,
256262
RequireService: false, // use filestate instead
257263
NoParallel: true,
258264
})

0 commit comments

Comments
 (0)