Skip to content

Commit 28ff7f1

Browse files
committed
test: confirm variables with space still arrives
1 parent d2f878b commit 28ff7f1

2 files changed

Lines changed: 10 additions & 7 deletions

File tree

internal/hooks/hook_executor_default_test.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ func Test_Hook_Execute_Default_Protocol(t *testing.T) {
6060
opts: HookExecOpts{
6161
Hook: HookScript{Name: "happypath", Command: "echo {}"},
6262
Env: map[string]string{
63-
"BATMAN": "robin hood",
63+
"BATMAN": "robin",
64+
"WHOAMI": "lumpy space princess",
6465
"YIN": "yang",
6566
},
6667
Exec: &MockExec{
@@ -74,7 +75,8 @@ func Test_Hook_Execute_Default_Protocol(t *testing.T) {
7475
response, err := executor.Execute(ctx, opts)
7576
require.Equal(t, "test output", response)
7677
require.Equal(t, nil, err)
77-
require.Contains(t, opts.Exec.(*MockExec).mockCommand.Env, `BATMAN=robin hood`)
78+
require.Contains(t, opts.Exec.(*MockExec).mockCommand.Env, `BATMAN=robin`)
79+
require.Contains(t, opts.Exec.(*MockExec).mockCommand.Env, `WHOAMI=lumpy space princess`)
7880
require.Contains(t, opts.Exec.(*MockExec).mockCommand.Env, `YIN=yang`)
7981
},
8082
},

internal/hooks/hook_executor_v2_test.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ func Test_Hook_Execute_V2_Protocol(t *testing.T) {
5555
opts: HookExecOpts{
5656
Hook: HookScript{Name: "happypath", Command: "echo {}"},
5757
Env: map[string]string{
58-
"BATMAN": "robin hood",
58+
"BATMAN": "robin",
59+
"WHOAMI": "lumpy space princess",
5960
"YIN": "yang",
6061
},
6162
Exec: &MockExec{
@@ -68,17 +69,17 @@ func Test_Hook_Execute_V2_Protocol(t *testing.T) {
6869
check: func(t *testing.T, response string, err error, mockExec ExecInterface) {
6970
require.Equal(t, `{"message": "hello world"}`, response)
7071
require.Equal(t, nil, err)
71-
require.Contains(t, mockExec.(*MockExec).mockCommand.Env, `BATMAN=robin hood`)
72+
require.Contains(t, mockExec.(*MockExec).mockCommand.Env, `BATMAN=robin`)
73+
require.Contains(t, mockExec.(*MockExec).mockCommand.Env, `WHOAMI=lumpy space princess`)
7274
require.Contains(t, mockExec.(*MockExec).mockCommand.Env, `YIN=yang`)
7375
},
7476
},
7577
"successful execution with payload > 64kb": {
7678
opts: HookExecOpts{
7779
Hook: HookScript{Name: "happypath", Command: "echo {}"},
7880
Env: map[string]string{
79-
"batman": "robin",
80-
"BATMAN": "robin",
81-
"YIN": "yang",
81+
"BATMAN": "robin",
82+
"YIN": "yang",
8283
},
8384
Exec: &MockExec{
8485
mockCommand: &MockCommand{

0 commit comments

Comments
 (0)