diff --git a/benchmark/README.md b/benchmark/README.md index aa5ef10a..a92013f9 100644 --- a/benchmark/README.md +++ b/benchmark/README.md @@ -5,7 +5,7 @@ Tart comes with a Golang-based benchmarking utility that allows one to easily co Currently, only Flexible I/O tester workloads are supported. To run them, [install Golang](https://go.dev/) and run the following command from this (`benchmark/`) directory: ```shell -go run cmd/main.go fio +go run cmd/main.go fio --image ghcr.io/cirruslabs/macos-sonoma-base:latest ``` You can also enable the debugging output to diagnose issues: diff --git a/benchmark/internal/command/fio/fio.go b/benchmark/internal/command/fio/fio.go index 98a8ae78..aae969f2 100644 --- a/benchmark/internal/command/fio/fio.go +++ b/benchmark/internal/command/fio/fio.go @@ -15,6 +15,7 @@ import ( ) var debug bool +var image string func NewCommand() *cobra.Command { cmd := &cobra.Command{ @@ -24,6 +25,7 @@ func NewCommand() *cobra.Command { } cmd.Flags().BoolVar(&debug, "debug", false, "enable debug logging") + cmd.Flags().StringVar(&image, "image", "ghcr.io/cirruslabs/macos-sonoma-base:latest", "image to use for testing") return cmd } @@ -111,7 +113,7 @@ func initializeExecutors(ctx context.Context, logger *zap.Logger) ([]executor.Ex logger.Info("initializing Tart executor") - tart, err := tart.New(ctx, logger) + tart, err := tart.New(ctx, image, logger) if err != nil { return nil, err } diff --git a/benchmark/internal/executor/tart/tart.go b/benchmark/internal/executor/tart/tart.go index 4ebb0fc0..de35d55b 100644 --- a/benchmark/internal/executor/tart/tart.go +++ b/benchmark/internal/executor/tart/tart.go @@ -14,8 +14,6 @@ import ( "time" ) -const baseImage = "ghcr.io/cirruslabs/macos-sonoma-base:latest" - type Tart struct { vmRunCancel context.CancelFunc vmName string @@ -23,17 +21,17 @@ type Tart struct { logger *zap.Logger } -func New(ctx context.Context, logger *zap.Logger) (*Tart, error) { +func New(ctx context.Context, image string, logger *zap.Logger) (*Tart, error) { tart := &Tart{ vmName: fmt.Sprintf("tart-benchmark-%s", uuid.NewString()), logger: logger, } - if err := Cmd(ctx, tart.logger, "pull", baseImage); err != nil { + if err := Cmd(ctx, tart.logger, "pull", image); err != nil { return nil, err } - if err := Cmd(ctx, tart.logger, "clone", baseImage, tart.vmName); err != nil { + if err := Cmd(ctx, tart.logger, "clone", image, tart.vmName); err != nil { return nil, err } diff --git a/benchmark/internal/executor/tart/tart_test.go b/benchmark/internal/executor/tart/tart_test.go index 46b2136a..d11c4ab8 100644 --- a/benchmark/internal/executor/tart/tart_test.go +++ b/benchmark/internal/executor/tart/tart_test.go @@ -11,7 +11,7 @@ import ( func TestTart(t *testing.T) { ctx := context.Background() - tart, err := tart.New(ctx, zap.NewNop()) + tart, err := tart.New(ctx, "ghcr.io/cirruslabs/macos-sonoma-base:latest", zap.NewNop()) require.NoError(t, err) output, err := tart.Run(ctx, "echo \"this is a test\"")