X-Git-Url: https://ruderich.org/simon/gitweb/?p=safcm%2Fsafcm.git;a=blobdiff_plain;f=cmd%2Fsafcm-remote%2Fsync%2Fcommands_test.go;h=1c534188eae0439e6c3eda15acd816aa11376e30;hp=ba7f4a2e89ec47e16fec11f88f41aad4577a2617;hb=6015bd22c34e8287b43b462facd5ad491296c8c2;hpb=1934f1ab83306dff45310d5b45e2a99c97e28c35 diff --git a/cmd/safcm-remote/sync/commands_test.go b/cmd/safcm-remote/sync/commands_test.go index ba7f4a2..1c53418 100644 --- a/cmd/safcm-remote/sync/commands_test.go +++ b/cmd/safcm-remote/sync/commands_test.go @@ -67,6 +67,7 @@ func TestSyncCommands(t *testing.T) { }, Commands: []*safcm.Command{ { + OrigGroup: "group", Cmd: "echo; env | grep SAFCM_", }, }, @@ -84,7 +85,7 @@ func TestSyncCommands(t *testing.T) { Env: env, }}, []string{ - `3: sync remote: commands: running "/bin/sh" "-c" "echo; env | grep SAFCM_"`, + `3: sync remote: commands: running "/bin/sh" "-c" "echo; env | grep SAFCM_" (group)`, "5: sync remote: commands: command output:\nfake stdout/stderr", }, safcm.MsgSyncResp{ @@ -109,6 +110,7 @@ func TestSyncCommands(t *testing.T) { }, Commands: []*safcm.Command{ { + OrigGroup: "group", Cmd: "echo; env | grep SAFCM_", }, }, @@ -140,6 +142,7 @@ func TestSyncCommands(t *testing.T) { }, Commands: []*safcm.Command{ { + OrigGroup: "group", Cmd: "echo hi; false", }, }, @@ -157,7 +160,7 @@ func TestSyncCommands(t *testing.T) { Env: env, }}, []string{ - `3: sync remote: commands: running "/bin/sh" "-c" "echo hi; false"`, + `3: sync remote: commands: running "/bin/sh" "-c" "echo hi; false" (group)`, "5: sync remote: commands: command output:\nfake stdout/stderr", }, safcm.MsgSyncResp{ @@ -183,6 +186,7 @@ func TestSyncCommands(t *testing.T) { }, Commands: []*safcm.Command{ { + OrigGroup: "group", Cmd: "echo hi; false", }, }, @@ -214,12 +218,16 @@ func TestSyncCommands(t *testing.T) { }, Commands: []*safcm.Command{ { + OrigGroup: "group1", Cmd: "echo first", }, { + OrigGroup: "group2", Cmd: "echo second", }, { + OrigGroup: "group3", Cmd: "false", }, { + OrigGroup: "group4", Cmd: "echo third", }, }, @@ -263,11 +271,11 @@ func TestSyncCommands(t *testing.T) { Env: env, }}, []string{ - `3: sync remote: commands: running "/bin/sh" "-c" "echo first"`, + `3: sync remote: commands: running "/bin/sh" "-c" "echo first" (group1)`, "5: sync remote: commands: command output:\nfake stdout/stderr first", - `3: sync remote: commands: running "/bin/sh" "-c" "echo second"`, + `3: sync remote: commands: running "/bin/sh" "-c" "echo second" (group2)`, "5: sync remote: commands: command output:\nfake stdout/stderr second", - `3: sync remote: commands: running "/bin/sh" "-c" "false"`, + `3: sync remote: commands: running "/bin/sh" "-c" "false" (group3)`, }, safcm.MsgSyncResp{ CommandChanges: []safcm.CommandChange{ @@ -333,6 +341,7 @@ func TestSyncCommands(t *testing.T) { }, Commands: []*safcm.Command{ { + OrigGroup: "group", Cmd: "echo; env | grep SAFCM_", }, }, @@ -379,11 +388,11 @@ func TestSyncCommands(t *testing.T) { Env: env, }}, []string{ - `3: sync remote: commands: running "/bin/sh" "-c" "echo trigger ."`, + `3: sync remote: commands: running "/bin/sh" "-c" "echo trigger ." (".")`, "5: sync remote: commands: command output:\nfake stdout/stderr .", - `3: sync remote: commands: running "/bin/sh" "-c" "echo trigger dir"`, + `3: sync remote: commands: running "/bin/sh" "-c" "echo trigger dir" ("dir")`, "5: sync remote: commands: command output:\nfake stdout/stderr dir", - `3: sync remote: commands: running "/bin/sh" "-c" "echo; env | grep SAFCM_"`, + `3: sync remote: commands: running "/bin/sh" "-c" "echo; env | grep SAFCM_" (group)`, "5: sync remote: commands: command output:\nfake stdout/stderr", }, safcm.MsgSyncResp{ @@ -451,6 +460,7 @@ func TestSyncCommands(t *testing.T) { }, Commands: []*safcm.Command{ { + OrigGroup: "group", Cmd: "echo; env | grep SAFCM_", }, }, @@ -487,9 +497,9 @@ func TestSyncCommands(t *testing.T) { Env: env, }}, []string{ - `3: sync remote: commands: running "/bin/sh" "-c" "echo trigger ."`, + `3: sync remote: commands: running "/bin/sh" "-c" "echo trigger ." (".")`, "5: sync remote: commands: command output:\nfake stdout/stderr .", - `3: sync remote: commands: running "/bin/sh" "-c" "false"`, + `3: sync remote: commands: running "/bin/sh" "-c" "false" ("dir")`, "5: sync remote: commands: command output:\nfake stdout/stderr dir", }, safcm.MsgSyncResp{