Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion cmd/stroppy/commands/help/topic_envs.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,18 @@ CONFIG FILE ALTERNATIVE

DEBUG: TRACING ENV RESOLUTION

To see which env vars are applied and where they came from:
Normal run logs show -e/config env entries that were applied:

stroppy run tpcc/tx -e load_workers=8

INFO script_runner Applied script env {"source":"cli","env":["LOAD_WORKERS=8"]}

If an applied env key is not declared by the workload's ENV() calls, Stroppy
warns so typos are visible:

WARN script_runner Script env is not declared by workload {"keys":["LOAD_WROKERS"]}

To inspect skipped env entries and precedence decisions:

LOG_LEVEL=debug stroppy run <script>

Expand Down
21 changes: 21 additions & 0 deletions cmd/stroppy/commands/k6signals_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import (

"github.com/stretchr/testify/require"
"go.k6.io/k6/cmd/state"

"github.com/stroppy-io/stroppy/internal/runner"
)

func sendInt(t *testing.T) {
Expand Down Expand Up @@ -69,3 +71,22 @@ func TestInterceptMiddleware(_ *testing.T) {
// SignalStop should not panic and should clean up.
gs.SignalStop(ch)
}

func TestK6SubcommandScopesExitCapture(t *testing.T) {
called := false
gs := &state.GlobalState{OSExit: func(int) { called = true }}

K6Subcommand(gs)
gs.OSExit(1)
require.True(t, called)

called = false

stop := runner.BeginK6ExitCapture()
defer stop()

gs = &state.GlobalState{OSExit: func(int) { called = true }}
K6Subcommand(gs)
gs.OSExit(1)
require.False(t, called)
}
5 changes: 4 additions & 1 deletion cmd/stroppy/commands/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,10 @@ func Root() *cobra.Command {

func K6Subcommand(gs *state.GlobalState) *cobra.Command {
inteceptInteruptSignals(gs)
gs.OSExit = runner.OSExit // handles exit code

if runner.K6ExitCaptureEnabled() {
gs.OSExit = runner.OSExit
}

return rootCmd
}
Expand Down
Loading
Loading