]> ruderich.org/simon Gitweb - safcm/safcm.git/blobdiff - cmd/safcm-remote/sync/commands_test.go
remote: go fmt
[safcm/safcm.git] / cmd / safcm-remote / sync / commands_test.go
index ba7f4a2e89ec47e16fec11f88f41aad4577a2617..9de9bd5bd72ca7e0c41074d8b2b39c3fb0f4000c 100644 (file)
@@ -67,7 +67,8 @@ func TestSyncCommands(t *testing.T) {
                                },
                                Commands: []*safcm.Command{
                                        {
-                                               Cmd: "echo; env | grep SAFCM_",
+                                               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,7 +110,8 @@ func TestSyncCommands(t *testing.T) {
                                },
                                Commands: []*safcm.Command{
                                        {
-                                               Cmd: "echo; env | grep SAFCM_",
+                                               OrigGroup: "group",
+                                               Cmd:       "echo; env | grep SAFCM_",
                                        },
                                },
                        },
@@ -140,7 +142,8 @@ func TestSyncCommands(t *testing.T) {
                                },
                                Commands: []*safcm.Command{
                                        {
-                                               Cmd: "echo hi; false",
+                                               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,7 +186,8 @@ func TestSyncCommands(t *testing.T) {
                                },
                                Commands: []*safcm.Command{
                                        {
-                                               Cmd: "echo hi; false",
+                                               OrigGroup: "group",
+                                               Cmd:       "echo hi; false",
                                        },
                                },
                        },
@@ -214,13 +218,17 @@ func TestSyncCommands(t *testing.T) {
                                },
                                Commands: []*safcm.Command{
                                        {
-                                               Cmd: "echo first",
+                                               OrigGroup: "group1",
+                                               Cmd:       "echo first",
                                        }, {
-                                               Cmd: "echo second",
+                                               OrigGroup: "group2",
+                                               Cmd:       "echo second",
                                        }, {
-                                               Cmd: "false",
+                                               OrigGroup: "group3",
+                                               Cmd:       "false",
                                        }, {
-                                               Cmd: "echo third",
+                                               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,7 +341,8 @@ func TestSyncCommands(t *testing.T) {
                                },
                                Commands: []*safcm.Command{
                                        {
-                                               Cmd: "echo; env | grep SAFCM_",
+                                               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,7 +460,8 @@ func TestSyncCommands(t *testing.T) {
                                },
                                Commands: []*safcm.Command{
                                        {
-                                               Cmd: "echo; env | grep SAFCM_",
+                                               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{