Skip to content

Commit

Permalink
test: add cloud start fail test
Browse files Browse the repository at this point in the history
  • Loading branch information
ansgarschulte committed Mar 20, 2024
1 parent 16a67e0 commit 99868fa
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions extk6/run_cloud_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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.")
}

0 comments on commit 99868fa

Please sign in to comment.