X-Git-Url: https://ruderich.org/simon/gitweb/?a=blobdiff_plain;f=cmd%2Fsafcm%2Fsync_sync_test.go;h=a5f65811e0d82297f642f01dcf027dd175ff9da3;hb=20686d0d25d7d22f577fc80df31c192b6a88d318;hp=cf24d59801562f72641e4fc808074d2a5750e03b;hpb=4473e968425319e6beae558643bb047a6b01c17a;p=safcm%2Fsafcm.git diff --git a/cmd/safcm/sync_sync_test.go b/cmd/safcm/sync_sync_test.go index cf24d59..a5f6581 100644 --- a/cmd/safcm/sync_sync_test.go +++ b/cmd/safcm/sync_sync_test.go @@ -136,9 +136,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", + }, }, }, []string{ @@ -235,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, @@ -416,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: 3 host groups: all group-a group-b host1.example.org", + "host1.example.org: 3 host group priorities (desc. order): host1.example.org group-a", + }, + nil, + }, } for _, tc := range tests {