Skip to content

Commit

Permalink
Add sync ping registration prior to resetGlean calls
Browse files Browse the repository at this point in the history
This is weird to do in other test classes calling resetGlean, but it's an unfortunate side effect of the new collection enabled mechanisms that'll be fixed up with https://bugzilla.mozilla.org/show_bug.cgi?id=1935001
  • Loading branch information
travis79 authored and rvandermeulen committed Dec 12, 2024
1 parent 7152bc0 commit f111809
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,18 @@ import XCTest

class NimbusTests: XCTestCase {
override func setUp() {
// Due to recent changes in how upload enabled works, we need to register the custom
// Sync pings before they can collect data in tests, even here in Nimbus unfortunately.
// See https://bugzilla.mozilla.org/show_bug.cgi?id=1935001 for more info.
Glean.shared.registerPings(GleanMetrics.Pings.shared.sync)
Glean.shared.registerPings(GleanMetrics.Pings.shared.historySync)
Glean.shared.registerPings(GleanMetrics.Pings.shared.bookmarksSync)
Glean.shared.registerPings(GleanMetrics.Pings.shared.loginsSync)
Glean.shared.registerPings(GleanMetrics.Pings.shared.creditcardsSync)
Glean.shared.registerPings(GleanMetrics.Pings.shared.addressesSync)
Glean.shared.registerPings(GleanMetrics.Pings.shared.tabsSync)

Glean.shared.resetGlean(clearStores: true)
Glean.shared.enableTestingMode()
}

func emptyExperimentJSON() -> String {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ class SyncManagerTelemetryTests: XCTestCase {
super.setUp()

// Due to recent changes in how upload enabled works, we need to register the custom
// Sync pings before they can be submitted properly.
// Sync pings before they can collect data in tests.
// See https://bugzilla.mozilla.org/show_bug.cgi?id=1935001 for more info.
Glean.shared.registerPings(GleanMetrics.Pings.shared.sync)
Glean.shared.registerPings(GleanMetrics.Pings.shared.historySync)
Glean.shared.registerPings(GleanMetrics.Pings.shared.bookmarksSync)
Expand Down

0 comments on commit f111809

Please sign in to comment.