Skip to content

Commit

Permalink
reuse k6build environment across tests
Browse files Browse the repository at this point in the history
Signed-off-by: Pablo Chacin <[email protected]>
  • Loading branch information
pablochacin committed Jan 29, 2025
1 parent 77b23e2 commit 318f975
Showing 1 changed file with 6 additions and 16 deletions.
22 changes: 6 additions & 16 deletions cmd/state_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"github.com/stretchr/testify/require"
)

func Test_interal_state(t *testing.T) {
func Test_interal_state(t *testing.T) { //nolint:tparallel
t.Parallel()

env, err := testutils.NewTestEnv(testutils.TestEnvConfig{
Expand All @@ -22,19 +22,15 @@ func Test_interal_state(t *testing.T) {

t.Cleanup(env.Cleanup)

t.Run("Test_newState", func(t *testing.T) {
t.Parallel()

t.Run("Test_newState", func(t *testing.T) { //nolint:paralleltest
lvar := new(slog.LevelVar)

st := newState(lvar)

require.Same(t, lvar, st.levelVar)
})

t.Run("Test_persistentPreRunE", func(t *testing.T) {
t.Parallel()

t.Run("Test_persistentPreRunE", func(t *testing.T) { //nolint:paralleltest
st := &state{levelVar: new(slog.LevelVar)}

require.NoError(t, st.persistentPreRunE(nil, nil))
Expand All @@ -56,9 +52,7 @@ func Test_interal_state(t *testing.T) {
require.NoError(t, st.persistentPreRunE(nil, nil))
})

t.Run("Test_preRunE", func(t *testing.T) {
t.Parallel()

t.Run("Test_preRunE", func(t *testing.T) { //nolint:paralleltest
st := &state{
levelVar: new(slog.LevelVar),
Options: k6exec.Options{BuildServiceURL: env.BuildServiceURL()},
Expand Down Expand Up @@ -103,9 +97,7 @@ func Test_interal_state(t *testing.T) {
require.Error(t, st.preRunE(sub, []string{arg}))
})

t.Run("Test_runE", func(t *testing.T) {
t.Parallel()

t.Run("Test_runE", func(t *testing.T) { //nolint:paralleltest
st := &state{
levelVar: new(slog.LevelVar),
Options: k6exec.Options{BuildServiceURL: env.BuildServiceURL()},
Expand All @@ -122,9 +114,7 @@ func Test_interal_state(t *testing.T) {
require.NoError(t, err)
})

t.Run("Test_helpFunc", func(t *testing.T) {
t.Parallel()

t.Run("Test_helpFunc", func(t *testing.T) { //nolint:paralleltest
st := &state{
levelVar: new(slog.LevelVar),
Options: k6exec.Options{BuildServiceURL: env.BuildServiceURL()},
Expand Down

0 comments on commit 318f975

Please sign in to comment.