From cf685c9fa014afa27d3236a45f3794a96d3126f1 Mon Sep 17 00:00:00 2001 From: babusrithar Date: Fri, 24 Nov 2023 11:30:46 +0530 Subject: [PATCH] roachtest : add --use-spot option This options enables use of SpotVM to run tests, If the provider does not support spotVM, it will be ignored --- pkg/cmd/roachtest/roachtestflags/flags.go | 6 ++++++ pkg/cmd/roachtest/test_runner.go | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/pkg/cmd/roachtest/roachtestflags/flags.go b/pkg/cmd/roachtest/roachtestflags/flags.go index 4398ff46ccc8..bbe2bb050829 100644 --- a/pkg/cmd/roachtest/roachtestflags/flags.go +++ b/pkg/cmd/roachtest/roachtestflags/flags.go @@ -304,6 +304,12 @@ var ( run at least one test per prefix.`, }) + UseSpotVM bool + _ = registerRunFlag(&UseSpotVM, FlagInfo{ + Name: "use-spot", + Usage: `Use SpotVM to run tests, If the provider does not support spotVM, it will be ignored`, + }) + GlobalSeed int64 = randutil.NewPseudoSeed() _ = registerRunFlag(&GlobalSeed, FlagInfo{ Name: "global-seed", diff --git a/pkg/cmd/roachtest/test_runner.go b/pkg/cmd/roachtest/test_runner.go index 1f1c4da0d0ed..8c22b4e16152 100644 --- a/pkg/cmd/roachtest/test_runner.go +++ b/pkg/cmd/roachtest/test_runner.go @@ -648,6 +648,10 @@ func (r *testRunner) runWorker( } } + if roachtestflags.UseSpotVM { + testToRun.spec.Cluster.UseSpotVMs = true + } + // Verify that required native libraries are available. // // TODO(radu): the arch is not guaranteed and another arch can be selected