]> ruderich.org/simon Gitweb - safcm/safcm.git/blobdiff - cmd/safcm/sync_sync_test.go
safcm: group_order: higher priority for listed groups over remaining groups
[safcm/safcm.git] / cmd / safcm / sync_sync_test.go
index e96fe140ae612a6a08f2429388c2d333fced2191..a5f65811e0d82297f642f01dcf027dd175ff9da3 100644 (file)
@@ -428,6 +428,39 @@ func TestHostSyncReq(t *testing.T) {
                        },
                        nil,
                },
+
+               {
+                       "group_order (single group)",
+                       "project-group_order-single",
+                       "host1.example.org",
+                       nil,
+                       safcm.LogDebug3,
+                       safcm.MsgSyncReq{
+                               Groups: []string{"all", "group-b", "group-a", "host1.example.org"},
+                               Files: map[string]*safcm.File{
+                                       "/": {
+                                               Path:      "/",
+                                               Mode:      fs.ModeDir | 0755,
+                                               Uid:       -1,
+                                               Gid:       -1,
+                                               OrigGroup: "group-a",
+                                       },
+                                       "/file.txt": {
+                                               Path:      "/file.txt",
+                                               Mode:      0644,
+                                               Uid:       -1,
+                                               Gid:       -1,
+                                               Data:      []byte("file.txt: from group-a\n"),
+                                               OrigGroup: "group-a",
+                                       },
+                               },
+                       },
+                       []string{
+                               "host1.example.org: <nil> 3 host groups: all group-a group-b host1.example.org",
+                               "host1.example.org: <nil> 3 host group priorities (desc. order): host1.example.org group-a",
+                       },
+                       nil,
+               },
        }
 
        for _, tc := range tests {