]> ruderich.org/simon Gitweb - safcm/safcm.git/blobdiff - cmd/safcm/sync_sync_test.go
remote: show group/trigger in verbose log for commands
[safcm/safcm.git] / cmd / safcm / sync_sync_test.go
index b5e8ce242b01c5e793da5702c24fb942d8bb034a..f100f35125e125fa64884086698f4aac78448d3d 100644 (file)
@@ -59,6 +59,7 @@ func TestHostSyncReq(t *testing.T) {
                                Groups: []string{
                                        "all",
                                        "group",
+                                       "group3",
                                        "remove",
                                        "host1.example.org",
                                },
@@ -93,7 +94,7 @@ func TestHostSyncReq(t *testing.T) {
                                                Mode:      0644,
                                                Uid:       -1,
                                                Gid:       -1,
-                                               Data:      []byte("Welcome to Host ONE\n\n\n\n"),
+                                               Data:      []byte("Welcome to Host ONE\n\n\n\n\n\nall\n\n\nhost1.example.org\n\n\n\n"),
                                        },
                                        "/etc/rc.local": &safcm.File{
                                                OrigGroup: "group",
@@ -135,13 +136,19 @@ func TestHostSyncReq(t *testing.T) {
                                Services: []string{
                                        "unbound",
                                },
-                               Commands: []string{
-                                       "echo command one",
-                                       "echo -n command two",
+                               Commands: []*safcm.Command{
+                                       {
+                                               OrigGroup: "group",
+                                               Cmd: "echo command one",
+                                       },
+                                       {
+                                               OrigGroup: "group",
+                                               Cmd: "echo -n command two",
+                                       },
                                },
                        },
                        []string{
-                               "host1.example.org: <nil> 3 host groups: all group host1.example.org remove",
+                               "host1.example.org: <nil> 3 host groups: all group group3 host1.example.org remove",
                                "host1.example.org: <nil> 3 host group priorities (desc. order): host1.example.org",
                        },
                        nil,
@@ -157,6 +164,7 @@ func TestHostSyncReq(t *testing.T) {
                                Groups: []string{
                                        "all",
                                        "group",
+                                       "group3",
                                        "remove",
                                        "host1.example.org",
                                },
@@ -191,7 +199,7 @@ func TestHostSyncReq(t *testing.T) {
                                                Mode:      0644,
                                                Uid:       -1,
                                                Gid:       -1,
-                                               Data:      []byte("Welcome to Host ONE\n\n\n\n"),
+                                               Data:      []byte("Welcome to Host ONE\n\n\n\n\n\nall\n\n\nhost1.example.org\n\n\n\n"),
                                        },
                                        "/etc/rc.local": &safcm.File{
                                                OrigGroup: "group",
@@ -233,9 +241,15 @@ func TestHostSyncReq(t *testing.T) {
                                Services: []string{
                                        "unbound",
                                },
-                               Commands: []string{
-                                       "echo command one",
-                                       "echo -n command two",
+                               Commands: []*safcm.Command{
+                                       {
+                                               OrigGroup: "group",
+                                               Cmd: "echo command one",
+                                       },
+                                       {
+                                               OrigGroup: "group",
+                                               Cmd: "echo -n command two",
+                                       },
                                },
                        },
                        nil,