Skip to content

Commit

Permalink
fix: get mm tests working again with provisioning
Browse files Browse the repository at this point in the history
  • Loading branch information
MasterPtato committed Apr 18, 2024
1 parent 6f118b4 commit 7c51e9b
Show file tree
Hide file tree
Showing 10 changed files with 37 additions and 19 deletions.
3 changes: 3 additions & 0 deletions lib/bolt/core/src/dep/cargo/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,9 @@ pub async fn build_tests<'a, T: AsRef<str>>(
for test in build_call.packages {
cmd.args(&["--package", test.as_ref()]);
}
if std::env::var("CARGO_TARGET_DIR").is_err() {
cmd.env("CARGO_TARGET_DIR", ctx.cargo_target_dir());
}
let mut child = cmd.spawn()?;

// Capture stdout
Expand Down
2 changes: 2 additions & 0 deletions svc/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion svc/api/internal-monolith/src/route/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ define_router! {
mounts: [
{
path: api_traefik_provider::route::Router,
prefix: "route",
prefix: "traefik-provider",
},
{
path: api_provision::route::Router,
Expand Down
8 changes: 4 additions & 4 deletions svc/pkg/cluster/ops/server-list/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ pub async fn handle(
[ctx, Server]
"
SELECT d.cluster_id, s.server_id
FROM servers AS s
JOIN datacenters AS d
FROM db_cluster.servers AS s
JOIN db_cluster.datacenters AS d
ON s.datacenter_id = d.datacenter_id
WHERE
d.cluster_id = ANY($1) AND
Expand All @@ -39,8 +39,8 @@ pub async fn handle(
[ctx, Server]
"
SELECT d.cluster_id, s.server_id
FROM servers AS s
JOIN datacenters AS d
FROM db_cluster.servers AS s
JOIN db_cluster.datacenters AS d
ON s.datacenter_id = d.datacenter_id
WHERE
d.cluster_id = ANY($1) AND
Expand Down
5 changes: 2 additions & 3 deletions svc/pkg/faker/ops/game/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,11 @@ async fn handle(
let version_id = unwrap_ref!(version_create_res.version_id).as_uuid();
version_ids.push(version_id.into());

let namespace_name_ids = vec!["prod".to_owned(), "staging".to_owned()];
for name_id in &namespace_name_ids {
for name_id in ["prod", "staging"] {
let ns_create_res = op!([ctx] faker_game_namespace {
game_id: game_create_res.game_id,
version_id: version_create_res.version_id,
override_name_id: name_id.clone(),
override_name_id: name_id.to_owned(),
..Default::default()
})
.await?;
Expand Down
1 change: 0 additions & 1 deletion svc/pkg/faker/types/game.proto
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ message Request {
// Will not create the default namespaces and versions.
bool skip_namespaces_and_versions = 1;


// The default team ID to set as the game's dev team.
optional rivet.common.Uuid dev_team_id = 2;
}
Expand Down
1 change: 1 addition & 0 deletions svc/pkg/load-test/standalone/mm-sustain/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ reqwest = "0.11"

faker-game = { path = "../../../faker/ops/game" }
faker-team = { path = "../../../faker/ops/team" }
faker-game-namespace = { path = "../../../faker/ops/game-namespace" }
faker-game-version = { path = "../../../faker/ops/game-version" }
faker-region = { path = "../../../faker/ops/region" }
faker-build = { path = "../../../faker/ops/build" }
Expand Down
24 changes: 17 additions & 7 deletions svc/pkg/load-test/standalone/mm-sustain/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ pub async fn run_from_env(_ts: i64) -> GlobalResult<()> {

// Game
let game_res = op!([ctx] faker_game {
skip_namespaces_and_versions: true,
..Default::default()
})
.await?;
let namespace_id = unwrap!(game_res.namespace_ids.first()).clone().as_uuid();

let build_res = op!([ctx] faker_build {
game_id: game_res.game_id,
Expand Down Expand Up @@ -115,21 +115,31 @@ pub async fn run_from_env(_ts: i64) -> GlobalResult<()> {
.lobby_groups;
let lobby_group_id = unwrap!(lobby_groups[0].lobby_group_id.as_ref()).as_uuid();

op!([ctx] game_namespace_version_set {
namespace_id: Some(namespace_id.into()),
let ns_create_res = op!([ctx] faker_game_namespace {
game_id: game_res.game_id,
version_id: game_version_res.version_id,
override_name_id: "prod".to_owned(),
..Default::default()
})
.await?;
.await
.unwrap();
let namespace_id = ns_create_res.namespace_id.unwrap().as_uuid();

let parallel_workers = 4;
let mut handles = Vec::new();

let parallel_workers = 1;
for i in 0..parallel_workers {
tokio::spawn(run_lobby_worker(
handles.push(tokio::spawn(run_lobby_worker(
ctx.clone(),
i,
namespace_id,
region_id,
lobby_group_id,
));
)));
}

for handle in handles {
handle.await?;
}

Ok(())
Expand Down
1 change: 1 addition & 0 deletions svc/pkg/mm/worker/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ chirp-worker = { path = "../../../../lib/chirp/worker" }

faker-build = { path = "../../faker/ops/build" }
faker-game = { path = "../../faker/ops/game" }
faker-game-namespace = { path = "../../faker/ops/game-namespace" }
faker-game-version = { path = "../../faker/ops/game-version" }
faker-mm-lobby = { path = "../../faker/ops/mm-lobby" }
faker-region = { path = "../../faker/ops/region" }
Expand Down
9 changes: 6 additions & 3 deletions svc/pkg/mm/worker/tests/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ impl Setup {
let region_id = region_res.region_id.as_ref().unwrap().as_uuid();

let game_res = op!([ctx] faker_game {
skip_namespaces_and_versions: true,
..Default::default()
})
.await
.unwrap();
let namespace_id = game_res.namespace_ids.first().unwrap().clone().as_uuid();

let build_res = op!([ctx] faker_build {
game_id: game_res.game_id,
Expand Down Expand Up @@ -209,12 +209,15 @@ impl Setup {
.unwrap()
.lobby_groups;

op!([ctx] game_namespace_version_set {
namespace_id: Some(namespace_id.into()),
let ns_create_res = op!([ctx] faker_game_namespace {
game_id: game_res.game_id,
version_id: game_version_res.version_id,
override_name_id: "prod".to_owned(),
..Default::default()
})
.await
.unwrap();
let namespace_id = ns_create_res.namespace_id.unwrap().as_uuid();

Setup {
namespace_id,
Expand Down

0 comments on commit 7c51e9b

Please sign in to comment.