From 99868fa12206a49485889c1afe04e53b0ea987fd Mon Sep 17 00:00:00 2001 From: Ansgar Schulte <1299623+ansgarschulte@users.noreply.github.com> Date: Wed, 20 Mar 2024 12:31:26 +0100 Subject: [PATCH] test: add cloud start fail test --- extk6/run_cloud_test.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/extk6/run_cloud_test.go b/extk6/run_cloud_test.go index 21dff20..9c72454 100644 --- a/extk6/run_cloud_test.go +++ b/extk6/run_cloud_test.go @@ -2,7 +2,9 @@ package extk6 import ( "context" + "github.com/google/uuid" "github.com/steadybit/action-kit/go/action_kit_api/v2" + "github.com/steadybit/extension-k6/config" "github.com/steadybit/extension-kit/extutil" "github.com/stretchr/testify/require" "testing" @@ -33,3 +35,18 @@ func TestPrepareExtractsState(t *testing.T) { require.Nil(t, err) require.Equal(t, state.Command, []string([]string{"k6", "cloud", "test.js"})) } + +func TestFailedCommandStart(t *testing.T) { + // Given + action := K6LoadTestCloudAction{} + state := action.NewEmptyState() + state.Command = []string([]string{"k6-not-available", "cloud", "test.js"}) + state.ExecutionId = uuid.New() + config.Config.CloudApiToken = "test1234567890" + // When + result, err := action.Start(context.TODO(), &state) + + // Then + require.Nil(t, result) + require.Equal(t, err.Error(), "Failed to start command.") +}