summary refs log tree commit diff
path: root/src/core/tests/config
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/tests/config')
-rw-r--r--src/core/tests/config/global-dns-good.conf13
-rw-r--r--src/core/tests/config/global-dns-options.conf5
-rw-r--r--src/core/tests/config/nm-test-device.h3
-rw-r--r--src/core/tests/config/test-config.c22
4 files changed, 38 insertions, 5 deletions
diff --git a/src/core/tests/config/global-dns-good.conf b/src/core/tests/config/global-dns-good.conf
new file mode 100644
index 00000000..6265a611
--- /dev/null
+++ b/src/core/tests/config/global-dns-good.conf
@@ -0,0 +1,13 @@
+# Good configuration, since there is a default domain section
+
+[global-dns]
+searches=foo.com
+options=timeout:5
+
+[global-dns-domain-*]
+servers=4.5.6.7
+options=myoption1
+
+[global-dns-domain-test.com]
+servers=1.2.3.4
+options=myoption2
diff --git a/src/core/tests/config/global-dns-options.conf b/src/core/tests/config/global-dns-options.conf
new file mode 100644
index 00000000..0be17735
--- /dev/null
+++ b/src/core/tests/config/global-dns-options.conf
@@ -0,0 +1,5 @@
+# Good configuration, since there is no domain section
+
+[global-dns]
+searches=foo.com
+options=timeout:5
diff --git a/src/core/tests/config/nm-test-device.h b/src/core/tests/config/nm-test-device.h
index 638177a0..48a53bf4 100644
--- a/src/core/tests/config/nm-test-device.h
+++ b/src/core/tests/config/nm-test-device.h
@@ -9,7 +9,8 @@
 #include "devices/nm-device.h"
 
 #define NM_TYPE_TEST_DEVICE (nm_test_device_get_type())
-#define NM_TEST_DEVICE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), NM_TYPE_TEST_DEVICE, NMTestDevice))
+#define NM_TEST_DEVICE(obj) \
+    (_NM_G_TYPE_CHECK_INSTANCE_CAST((obj), NM_TYPE_TEST_DEVICE, NMTestDevice))
 #define NM_TEST_DEVICE_CLASS(klass) \
     (G_TYPE_CHECK_CLASS_CAST((klass), NM_TYPE_TEST_DEVICE, NMTestDeviceClass))
 #define NM_IS_TEST_DEVICE(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj), NM_TYPE_TEST_DEVICE))
diff --git a/src/core/tests/config/test-config.c b/src/core/tests/config/test-config.c
index 17a66b06..054b9003 100644
--- a/src/core/tests/config/test-config.c
+++ b/src/core/tests/config/test-config.c
@@ -370,7 +370,21 @@ test_config_global_dns(void)
 
     g_object_unref(config);
 
-    /* Check that a file without a default domain section gives a NULL configuration */
+    /* Check that a file with a default domain section gives a good configuration */
+    config =
+        setup_config(NULL, TEST_DIR "/global-dns-good.conf", "", NULL, "/no/such/dir", "", NULL);
+    dns = nm_config_data_get_global_dns_config(nm_config_get_data_orig(config));
+    g_assert(dns);
+    g_object_unref(config);
+
+    /* Check that a file with options but no domains gives a good configuration */
+    config =
+        setup_config(NULL, TEST_DIR "/global-dns-options.conf", "", NULL, "/no/such/dir", "", NULL);
+    dns = nm_config_data_get_global_dns_config(nm_config_get_data_orig(config));
+    g_assert(dns);
+    g_object_unref(config);
+
+    /* Check that a file with a domain domain, but without a default one gives a NULL configuration */
     config =
         setup_config(NULL, TEST_DIR "/global-dns-invalid.conf", "", NULL, "/no/such/dir", "", NULL);
     dns = nm_config_data_get_global_dns_config(nm_config_get_data_orig(config));
@@ -1103,9 +1117,9 @@ test_config_set_values(void)
     const char               *CONFIG_USER               = BUILD_DIR "/test-set-values-user.conf";
     const char               *CONFIG_INTERN             = BUILD_DIR "/test-set-values-intern.conf";
     const char               *atomic_section_prefixes[] = {
-                      "atomic-prefix-1.",
-                      "atomic-prefix-2.",
-                      NULL,
+        "atomic-prefix-1.",
+        "atomic-prefix-2.",
+        NULL,
     };
 
     g_assert(g_file_set_contents(CONFIG_USER, "", 0, NULL));