mirror of
https://github.com/safedep/pmg.git
synced 2026-08-03 07:24:09 +02:00
fix: Decouple cloud sync from telemetry (#343)
This commit is contained in:
@@ -83,6 +83,15 @@ func TestMaybeSpawnBackgroundSyncSpawnsByDefault(t *testing.T) {
|
||||
assert.NotEmpty(t, rec.calls[0].name, "spawned name should be a resolved binary path")
|
||||
}
|
||||
|
||||
func TestMaybeSpawnBackgroundSyncIgnoresTelemetryDisabled(t *testing.T) {
|
||||
rec := withMockSpawner(t)
|
||||
cfg := newAutoSyncConfig(t)
|
||||
cfg.Config.DisableTelemetry = true
|
||||
|
||||
MaybeSpawnBackgroundSync(cfg)
|
||||
assert.Equal(t, 1, rec.callCount())
|
||||
}
|
||||
|
||||
func TestMaybeSpawnBackgroundSyncShortCircuits(t *testing.T) {
|
||||
t.Run("nil config", func(t *testing.T) {
|
||||
rec := withMockSpawner(t)
|
||||
@@ -108,15 +117,6 @@ func TestMaybeSpawnBackgroundSyncShortCircuits(t *testing.T) {
|
||||
assert.Equal(t, 0, rec.callCount())
|
||||
})
|
||||
|
||||
t.Run("telemetry disabled via config", func(t *testing.T) {
|
||||
rec := withMockSpawner(t)
|
||||
cfg := newAutoSyncConfig(t)
|
||||
cfg.Config.DisableTelemetry = true
|
||||
|
||||
MaybeSpawnBackgroundSync(cfg)
|
||||
assert.Equal(t, 0, rec.callCount())
|
||||
})
|
||||
|
||||
t.Run("we are the sync-background child", func(t *testing.T) {
|
||||
rec := withMockSpawner(t)
|
||||
cfg := newAutoSyncConfig(t)
|
||||
|
||||
Reference in New Issue
Block a user