commit bf4c9a1fffda48c7516d6b729d07375410ecfa0d
parent 23250dec3d6d7eefbb3db16fbde8b32211f6b43f
Author: Alex Franchuk <afranchuk@mozilla.com>
Date: Tue, 7 Oct 2025 02:45:19 +0000
Bug 1973820 p4 - Fix Nimbus test which was relying on state from other tests r=cpeterson
The Nimbus test was accidentally relying on the prior state of
`foo.enabled` in one assertion. There was also another separate part of
the test which I've distinguished with a comment for clarity.
This patch stack changes gtests to run as separate processes per test
suite, so since the `foo.enabled` value was being set in the
`NimbusFeaturesGet` test suite and the assertion in question is in the
`NimbusFeaturesUpdate` test suite, the assertion now fails. For what
it's worth, it might make more sense for all of these tests to be under
a single `NimbusFeatures` suite, however either way the tests should not
rely on each other.
Differential Revision: https://phabricator.services.mozilla.com/D255176
Diffstat:
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/toolkit/components/nimbus/test/gtest/NimbusFeatures_GetTest.cpp b/toolkit/components/nimbus/test/gtest/NimbusFeatures_GetTest.cpp
@@ -157,13 +157,18 @@ TEST(NimbusFeaturesUpdate, Errors)
ASSERT_EQ(NimbusFeatures::GetInt("foo"_ns, "value"_ns, 0), 24);
// Verify updating foo.enabled doesn't call FooValueUpdated.
- ASSERT_TRUE(NimbusFeatures::GetBool("foo"_ns, "enabled"_ns, false));
+ gPrefUpdate = false;
ASSERT_EQ(Preferences::SetBool("nimbus.syncdatastore.foo.enabled", false,
PrefValueKind::User),
NS_OK);
ASSERT_FALSE(NimbusFeatures::GetBool("foo"_ns, "enabled"_ns, true));
- gPrefUpdate = false;
+ ASSERT_EQ(Preferences::SetBool("nimbus.syncdatastore.foo.enabled", true,
+ PrefValueKind::User),
+ NS_OK);
+ ASSERT_TRUE(NimbusFeatures::GetBool("foo"_ns, "enabled"_ns, false));
+ ASSERT_FALSE(gPrefUpdate);
+ // Verify updating bar.value calls BarRolloutValueUpdated
ASSERT_EQ(Preferences::SetInt("nimbus.syncdefaultsstore.bar.value", 25,
PrefValueKind::User),
NS_OK);