@@ -604,6 +604,7 @@ modulemd_defaults_test_prioritizer (DefaultsFixture *fixture,
604604 g_autofree gchar * yaml_override_path = NULL ;
605605 g_autoptr (GPtrArray ) base_objects = NULL ;
606606 g_autoptr (GPtrArray ) override_objects = NULL ;
607+ g_autoptr (GPtrArray ) override_nodejs_objects = NULL ;
607608 g_autoptr (GPtrArray ) merged_objects = NULL ;
608609 g_autoptr (ModulemdPrioritizer ) prioritizer = NULL ;
609610 g_autoptr (GError ) error = NULL ;
@@ -620,6 +621,18 @@ modulemd_defaults_test_prioritizer (DefaultsFixture *fixture,
620621 g_assert_nonnull (base_objects );
621622 g_assert_cmpint (base_objects -> len , = = , 7 );
622623
624+
625+ yaml_override_path =
626+ g_strdup_printf ("%s/test_data/defaults/overriding-nodejs.yaml" ,
627+ g_getenv ("MESON_SOURCE_ROOT" ));
628+ g_assert_nonnull (yaml_override_path );
629+
630+ override_nodejs_objects =
631+ modulemd_objects_from_file (yaml_override_path , & error );
632+ g_clear_pointer (& yaml_override_path , g_free );
633+ g_assert_nonnull (override_nodejs_objects );
634+ g_assert_cmpint (override_nodejs_objects -> len , = = , 1 );
635+
623636 yaml_override_path = g_strdup_printf (
624637 "%s/test_data/defaults/overriding.yaml" , g_getenv ("MESON_SOURCE_ROOT" ));
625638 g_assert_nonnull (yaml_override_path );
@@ -661,6 +674,48 @@ modulemd_defaults_test_prioritizer (DefaultsFixture *fixture,
661674 g_assert_true (result );
662675
663676
677+ /*
678+ * Test that importing the nodejs overrides at the same priority level fails.
679+ *
680+ * This YAML has a conflicting default stream which should be ignored and set
681+ * to "no default stream".
682+ */
683+
684+ result = modulemd_prioritizer_add (
685+ prioritizer , override_nodejs_objects , prio , & error );
686+ g_assert_true (result );
687+
688+ merged_objects = modulemd_prioritizer_resolve (prioritizer , & error );
689+ g_assert_nonnull (merged_objects );
690+ g_assert_cmpint (merged_objects -> len , = = , 3 );
691+
692+ for (gint i = 0 ; i < merged_objects -> len ; i ++ )
693+ {
694+ if (MODULEMD_IS_DEFAULTS (g_ptr_array_index (merged_objects , i )))
695+ {
696+ defaults = g_ptr_array_index (merged_objects , i );
697+ if (!g_strcmp0 (modulemd_defaults_peek_module_name (defaults ),
698+ "nodejs" ))
699+ {
700+ g_assert_null (modulemd_defaults_peek_default_stream (defaults ));
701+ }
702+ }
703+ }
704+
705+ g_clear_pointer (& merged_objects , g_ptr_array_unref );
706+
707+
708+ /* Start over and test profile conflicts */
709+ g_clear_pointer (& prioritizer , g_object_unref );
710+ prioritizer = modulemd_prioritizer_new ();
711+ result = modulemd_prioritizer_add (prioritizer , base_objects , prio , & error );
712+ if (!result )
713+ {
714+ fprintf (stderr , "Merge error: %s" , error -> message );
715+ }
716+ g_assert_true (result );
717+
718+
664719 /*
665720 * Test that importing the overrides at the same priority level fails.
666721 *
@@ -673,7 +728,7 @@ modulemd_defaults_test_prioritizer (DefaultsFixture *fixture,
673728 g_assert_cmpstr (
674729 g_quark_to_string (error -> domain ), = = , "modulemd-defaults-error-quark" );
675730 g_assert_cmpint (
676- error -> code , = = , MODULEMD_DEFAULTS_ERROR_CONFLICTING_STREAMS );
731+ error -> code , = = , MODULEMD_DEFAULTS_ERROR_CONFLICTING_PROFILES );
677732 g_clear_pointer (& error , g_error_free );
678733
679734 /* The object's internal state is undefined after an error, so delete it */
@@ -989,7 +1044,7 @@ modulemd_defaults_test_index_prioritizer (DefaultsFixture *fixture,
9891044 g_assert_cmpstr (
9901045 g_quark_to_string (error -> domain ), = = , "modulemd-defaults-error-quark" );
9911046 g_assert_cmpint (
992- error -> code , = = , MODULEMD_DEFAULTS_ERROR_CONFLICTING_STREAMS );
1047+ error -> code , = = , MODULEMD_DEFAULTS_ERROR_CONFLICTING_PROFILES );
9931048 g_clear_pointer (& error , g_error_free );
9941049
9951050 /* The object's internal state is undefined after an error, so delete it */
@@ -1140,6 +1195,11 @@ modulemd_regressions_issue44 (DefaultsFixture *fixture,
11401195
11411196 /* Add another almost-identical document, except with a conflicting default
11421197 * stream set.
1198+ *
1199+ * NOTE: when this was written (for issue 44 on GitHub), this was meant to be
1200+ * a hard error. As of 1.8.1 we expect this to just result in having no
1201+ * default stream for this module. This test has been slightly modified so
1202+ * that the expected result is now a pass.
11431203 */
11441204 yaml_conflicting_path = g_strdup_printf (
11451205 "%s/test_data/defaults/issue44-2.yaml" , g_getenv ("MESON_SOURCE_ROOT" ));
@@ -1151,7 +1211,7 @@ modulemd_regressions_issue44 (DefaultsFixture *fixture,
11511211
11521212 result =
11531213 modulemd_prioritizer_add (prioritizer , conflicting_objects , 0 , & error );
1154- g_assert_false (result );
1214+ g_assert_true (result );
11551215}
11561216
11571217
0 commit comments