Fix test failures due to dependency on Settings global in client for telemetry

co-authored-by: kay <kay@zed.dev>
This commit is contained in:
Mikayla Maki 2023-01-10 16:38:07 -08:00
parent 37a4de1a84
commit a3da41bfad
2 changed files with 9 additions and 1 deletions

View file

@ -18,6 +18,7 @@ use rand::{
distributions::{Alphanumeric, DistString}, distributions::{Alphanumeric, DistString},
prelude::*, prelude::*,
}; };
use settings::Settings;
use std::{env, ffi::OsStr, path::PathBuf, sync::Arc}; use std::{env, ffi::OsStr, path::PathBuf, sync::Arc};
#[gpui::test(iterations = 100)] #[gpui::test(iterations = 100)]
@ -104,6 +105,8 @@ async fn test_random_collaboration(
cx.function_name.clone(), cx.function_name.clone(),
); );
client_cx.update(|cx| cx.set_global(Settings::test(cx)));
let op_start_signal = futures::channel::mpsc::unbounded(); let op_start_signal = futures::channel::mpsc::unbounded();
let client = server.create_client(&mut client_cx, &username).await; let client = server.create_client(&mut client_cx, &username).await;
user_ids.push(client.current_user_id(&client_cx)); user_ids.push(client.current_user_id(&client_cx));
@ -173,6 +176,7 @@ async fn test_random_collaboration(
available_users.push((removed_user_id, client.username.clone())); available_users.push((removed_user_id, client.username.clone()));
client_cx.update(|cx| { client_cx.update(|cx| {
cx.clear_globals(); cx.clear_globals();
cx.set_global(Settings::test(cx));
drop(client); drop(client);
}); });
@ -401,6 +405,7 @@ async fn test_random_collaboration(
for (client, mut cx) in clients { for (client, mut cx) in clients {
cx.update(|cx| { cx.update(|cx| {
cx.clear_globals(); cx.clear_globals();
cx.set_global(Settings::test(cx));
drop(client); drop(client);
}); });
} }

View file

@ -584,7 +584,10 @@ impl Settings {
lsp: Default::default(), lsp: Default::default(),
projects_online_by_default: true, projects_online_by_default: true,
theme: gpui::fonts::with_font_cache(cx.font_cache().clone(), Default::default), theme: gpui::fonts::with_font_cache(cx.font_cache().clone(), Default::default),
telemetry_defaults: Default::default(), telemetry_defaults: TelemetrySettings {
diagnostics: Some(true),
metrics: Some(true),
},
telemetry_overrides: Default::default(), telemetry_overrides: Default::default(),
staff_mode: false, staff_mode: false,
} }