]> ruderich.org/simon Gitweb - safcm/safcm.git/blobdiff - cmd/safcm/config/groups_test.go
config: rename group_order to group_priority
[safcm/safcm.git] / cmd / safcm / config / groups_test.go
index 57176079bc0782ebfc0a76fb2f59bc84d0a27391..63c26836d92de66969904d643d77d7c9ae9a8222 100644 (file)
@@ -55,7 +55,7 @@ func TestLoadGroups(t *testing.T) {
                {
                        "../testdata/project",
                        &Config{
-                               GroupOrder: []string{
+                               GroupPriority: []string{
                                        "detected_linux",
                                        "detected_freebsd",
                                },
@@ -105,38 +105,38 @@ func TestLoadGroups(t *testing.T) {
                {
                        "../testdata/project",
                        &Config{
-                               GroupOrder: []string{
+                               GroupPriority: []string{
                                        "detected_freebsd",
                                        "does-not-exist",
                                },
                        },
                        hosts,
                        nil,
-                       fmt.Errorf("config.yaml: group_order: group \"does-not-exist\" does not exist"),
+                       fmt.Errorf("config.yaml: group_priority: group \"does-not-exist\" does not exist"),
                },
                {
                        "../testdata/project",
                        &Config{
-                               GroupOrder: []string{
+                               GroupPriority: []string{
                                        "detected_freebsd",
                                        "special:group",
                                },
                        },
                        hosts,
                        nil,
-                       fmt.Errorf("config.yaml: group_order: invalid group name \"special:group\""),
+                       fmt.Errorf("config.yaml: group_priority: invalid group name \"special:group\""),
                },
                {
                        "../testdata/project",
                        &Config{
-                               GroupOrder: []string{
+                               GroupPriority: []string{
                                        "detected_freebsd",
                                        "group:remove",
                                },
                        },
                        hosts,
                        nil,
-                       fmt.Errorf("config.yaml: group_order: invalid group name \"group:remove\""),
+                       fmt.Errorf("config.yaml: group_priority: invalid group name \"group:remove\""),
                },
 
                {
@@ -160,6 +160,13 @@ func TestLoadGroups(t *testing.T) {
                        nil,
                        fmt.Errorf("groups.yaml: group \"host2\": conflict with existing host"),
                },
+               {
+                       "../testdata/group-invalid-conflict-remove",
+                       &Config{},
+                       hosts,
+                       nil,
+                       fmt.Errorf("groups.yaml: group \"host2:remove\": conflict with existing host"),
+               },
                {
                        "../testdata/group-invalid-detected",
                        &Config{},
@@ -179,7 +186,7 @@ func TestLoadGroups(t *testing.T) {
                        &Config{},
                        &Hosts{},
                        nil,
-                       fmt.Errorf("groups.yaml: group \"1group2\": group \"does-not-exist\" not found"),
+                       fmt.Errorf("groups.yaml: group \"1group2\": member \"does-not-exist\" not found"),
                },
                {
                        "../testdata/group-invalid-name",