X-Git-Url: https://ruderich.org/simon/gitweb/?a=blobdiff_plain;f=cmd%2Fsafcm-remote%2Fsync%2Fcommands_test.go;h=0bd0949b020b922976744ea9f85e3beacf381cee;hb=fd97e8019e2ab166d9475ed59782c86247d8430b;hp=1c534188eae0439e6c3eda15acd816aa11376e30;hpb=6015bd22c34e8287b43b462facd5ad491296c8c2;p=safcm%2Fsafcm.git diff --git a/cmd/safcm-remote/sync/commands_test.go b/cmd/safcm-remote/sync/commands_test.go index 1c53418..0bd0949 100644 --- a/cmd/safcm-remote/sync/commands_test.go +++ b/cmd/safcm-remote/sync/commands_test.go @@ -54,7 +54,7 @@ func TestSyncCommands(t *testing.T) { }{ // NOTE: Also update MsgSyncResp in safcm test cases when - // changing anything here! + // changing the MsgSyncResp struct! { "successful command", @@ -68,7 +68,7 @@ func TestSyncCommands(t *testing.T) { Commands: []*safcm.Command{ { OrigGroup: "group", - Cmd: "echo; env | grep SAFCM_", + Cmd: "echo; env | grep SAFCM_", }, }, }, @@ -85,8 +85,8 @@ func TestSyncCommands(t *testing.T) { Env: env, }}, []string{ - `3: sync remote: commands: running "/bin/sh" "-c" "echo; env | grep SAFCM_" (group)`, - "5: sync remote: commands: command output:\nfake stdout/stderr", + `3: commands: running "/bin/sh" "-c" "echo; env | grep SAFCM_" (group)`, + "5: commands: command output:\nfake stdout/stderr", }, safcm.MsgSyncResp{ CommandChanges: []safcm.CommandChange{ @@ -111,7 +111,7 @@ func TestSyncCommands(t *testing.T) { Commands: []*safcm.Command{ { OrigGroup: "group", - Cmd: "echo; env | grep SAFCM_", + Cmd: "echo; env | grep SAFCM_", }, }, }, @@ -143,7 +143,7 @@ func TestSyncCommands(t *testing.T) { Commands: []*safcm.Command{ { OrigGroup: "group", - Cmd: "echo hi; false", + Cmd: "echo hi; false", }, }, }, @@ -160,8 +160,8 @@ func TestSyncCommands(t *testing.T) { Env: env, }}, []string{ - `3: sync remote: commands: running "/bin/sh" "-c" "echo hi; false" (group)`, - "5: sync remote: commands: command output:\nfake stdout/stderr", + `3: commands: running "/bin/sh" "-c" "echo hi; false" (group)`, + "5: commands: command output:\nfake stdout/stderr", }, safcm.MsgSyncResp{ CommandChanges: []safcm.CommandChange{ @@ -187,7 +187,7 @@ func TestSyncCommands(t *testing.T) { Commands: []*safcm.Command{ { OrigGroup: "group", - Cmd: "echo hi; false", + Cmd: "echo hi; false", }, }, }, @@ -219,16 +219,16 @@ func TestSyncCommands(t *testing.T) { Commands: []*safcm.Command{ { OrigGroup: "group1", - Cmd: "echo first", + Cmd: "echo first", }, { OrigGroup: "group2", - Cmd: "echo second", + Cmd: "echo second", }, { OrigGroup: "group3", - Cmd: "false", + Cmd: "false", }, { OrigGroup: "group4", - Cmd: "echo third", + Cmd: "echo third", }, }, }, @@ -271,11 +271,11 @@ func TestSyncCommands(t *testing.T) { Env: env, }}, []string{ - `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" (group2)`, - "5: sync remote: commands: command output:\nfake stdout/stderr second", - `3: sync remote: commands: running "/bin/sh" "-c" "false" (group3)`, + `3: commands: running "/bin/sh" "-c" "echo first" (group1)`, + "5: commands: command output:\nfake stdout/stderr first", + `3: commands: running "/bin/sh" "-c" "echo second" (group2)`, + "5: commands: command output:\nfake stdout/stderr second", + `3: commands: running "/bin/sh" "-c" "false" (group3)`, }, safcm.MsgSyncResp{ CommandChanges: []safcm.CommandChange{ @@ -342,7 +342,7 @@ func TestSyncCommands(t *testing.T) { Commands: []*safcm.Command{ { OrigGroup: "group", - Cmd: "echo; env | grep SAFCM_", + Cmd: "echo; env | grep SAFCM_", }, }, }, @@ -388,12 +388,12 @@ func TestSyncCommands(t *testing.T) { Env: env, }}, []string{ - `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" ("dir")`, - "5: sync remote: commands: command output:\nfake stdout/stderr dir", - `3: sync remote: commands: running "/bin/sh" "-c" "echo; env | grep SAFCM_" (group)`, - "5: sync remote: commands: command output:\nfake stdout/stderr", + `3: commands: running "/bin/sh" "-c" "echo trigger ." (".")`, + "5: commands: command output:\nfake stdout/stderr .", + `3: commands: running "/bin/sh" "-c" "echo trigger dir" ("dir")`, + "5: commands: command output:\nfake stdout/stderr dir", + `3: commands: running "/bin/sh" "-c" "echo; env | grep SAFCM_" (group)`, + "5: commands: command output:\nfake stdout/stderr", }, safcm.MsgSyncResp{ CommandChanges: []safcm.CommandChange{ @@ -461,7 +461,7 @@ func TestSyncCommands(t *testing.T) { Commands: []*safcm.Command{ { OrigGroup: "group", - Cmd: "echo; env | grep SAFCM_", + Cmd: "echo; env | grep SAFCM_", }, }, }, @@ -497,10 +497,10 @@ func TestSyncCommands(t *testing.T) { Env: env, }}, []string{ - `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" ("dir")`, - "5: sync remote: commands: command output:\nfake stdout/stderr dir", + `3: commands: running "/bin/sh" "-c" "echo trigger ." (".")`, + "5: commands: command output:\nfake stdout/stderr .", + `3: commands: running "/bin/sh" "-c" "false" ("dir")`, + "5: commands: command output:\nfake stdout/stderr dir", }, safcm.MsgSyncResp{ CommandChanges: []safcm.CommandChange{