]> ruderich.org/simon Gitweb - safcm/safcm.git/blobdiff - cmd/safcm-remote/sync/commands_test.go
safcm: use Command struct instead of string to run commands
[safcm/safcm.git] / cmd / safcm-remote / sync / commands_test.go
index 142a2542a931d4191d56f0b5be641da6a2b00cd7..ba7f4a2e89ec47e16fec11f88f41aad4577a2617 100644 (file)
@@ -65,8 +65,10 @@ func TestSyncCommands(t *testing.T) {
                                        "group2",
                                        "host.example.org",
                                },
-                               Commands: []string{
-                                       "echo; env | grep SAFCM_",
+                               Commands: []*safcm.Command{
+                                       {
+                                               Cmd: "echo; env | grep SAFCM_",
+                                       },
                                },
                        },
                        nil,
@@ -105,8 +107,10 @@ func TestSyncCommands(t *testing.T) {
                                        "group2",
                                        "host.example.org",
                                },
-                               Commands: []string{
-                                       "echo; env | grep SAFCM_",
+                               Commands: []*safcm.Command{
+                                       {
+                                               Cmd: "echo; env | grep SAFCM_",
+                                       },
                                },
                        },
                        nil,
@@ -134,8 +138,10 @@ func TestSyncCommands(t *testing.T) {
                                        "group2",
                                        "host.example.org",
                                },
-                               Commands: []string{
-                                       "echo hi; false",
+                               Commands: []*safcm.Command{
+                                       {
+                                               Cmd: "echo hi; false",
+                                       },
                                },
                        },
                        nil,
@@ -175,8 +181,10 @@ func TestSyncCommands(t *testing.T) {
                                        "group2",
                                        "host.example.org",
                                },
-                               Commands: []string{
-                                       "echo hi; false",
+                               Commands: []*safcm.Command{
+                                       {
+                                               Cmd: "echo hi; false",
+                                       },
                                },
                        },
                        nil,
@@ -204,11 +212,16 @@ func TestSyncCommands(t *testing.T) {
                                        "group2",
                                        "host.example.org",
                                },
-                               Commands: []string{
-                                       "echo first",
-                                       "echo second",
-                                       "false",
-                                       "echo third",
+                               Commands: []*safcm.Command{
+                                       {
+                                               Cmd: "echo first",
+                                       }, {
+                                               Cmd: "echo second",
+                                       }, {
+                                               Cmd: "false",
+                                       }, {
+                                               Cmd: "echo third",
+                                       },
                                },
                        },
                        nil,
@@ -318,8 +331,10 @@ func TestSyncCommands(t *testing.T) {
                                                },
                                        },
                                },
-                               Commands: []string{
-                                       "echo; env | grep SAFCM_",
+                               Commands: []*safcm.Command{
+                                       {
+                                               Cmd: "echo; env | grep SAFCM_",
+                                       },
                                },
                        },
                        []string{
@@ -434,8 +449,10 @@ func TestSyncCommands(t *testing.T) {
                                                },
                                        },
                                },
-                               Commands: []string{
-                                       "echo; env | grep SAFCM_",
+                               Commands: []*safcm.Command{
+                                       {
+                                               Cmd: "echo; env | grep SAFCM_",
+                                       },
                                },
                        },
                        []string{