Skip to content

Commit

Permalink
test: add cloud prepare test
Browse files Browse the repository at this point in the history
  • Loading branch information
ansgarschulte committed Mar 20, 2024
1 parent 2bea242 commit 16a67e0
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions extk6/run_cloud_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package extk6

import (
"context"
"github.com/steadybit/action-kit/go/action_kit_api/v2"
"github.com/steadybit/extension-kit/extutil"
"github.com/stretchr/testify/require"
"testing"
)

func TestPrepareExtractsState(t *testing.T) {
// Given
request := extutil.JsonMangle(action_kit_api.PrepareActionRequestBody{
Config: map[string]interface{}{
"duration": 1000 * 60,
"notify": true,
"file": "test.js",
},
Target: nil,
ExecutionContext: extutil.Ptr(action_kit_api.ExecutionContext{
ExperimentUri: extutil.Ptr("<uri-to-experiment>"),
ExecutionUri: extutil.Ptr("<uri-to-execution>"),
}),
})
action := K6LoadTestCloudAction{}
state := action.NewEmptyState()

// When
result, err := action.Prepare(context.TODO(), &state, request)

// Then
require.Nil(t, result)
require.Nil(t, err)
require.Equal(t, state.Command, []string([]string{"k6", "cloud", "test.js"}))
}

0 comments on commit 16a67e0

Please sign in to comment.