Fix city generation retries and remove city-wide economy mechanics
This commit is contained in:
1 parent
85df37c26e
commit
63f0c72ff3
21 files changed
+252
-585
No files matched your search
@@ -102,14 +102,26 @@ async fn isolated_typescript_worker_exports_city_and_opens_room_without_network(
|
||||
)
|
||||
.unwrap();
|
||||
assert_eq!(duplicate.id, job.id);
|
||||
let (status, _) = request(
|
||||
let (status, body) = request(
|
||||
address,
|
||||
"POST",
|
||||
"/api/cities/jobs",
|
||||
&message.encode_to_vec(),
|
||||
)
|
||||
.await;
|
||||
assert_eq!(status, 200, "repeated POST resumes the accepted job");
|
||||
assert_eq!(CityJob::decode(&body[..]).unwrap().id, job.id);
|
||||
let different = CreateCity { seed: 2, ..message };
|
||||
let (status, body) = request(
|
||||
address,
|
||||
"POST",
|
||||
"/api/cities/jobs",
|
||||
&different.encode_to_vec(),
|
||||
)
|
||||
.await;
|
||||
assert_eq!(status, 429);
|
||||
let error: serde_json::Value = serde_json::from_slice(&body).unwrap();
|
||||
assert!(error["retryAfterSeconds"].as_u64().unwrap() <= 60);
|
||||
app.stop();
|
||||
server.abort();
|
||||
assert_eq!(
|
||||
|
||||
@@ -151,37 +151,6 @@ async fn thirty_observers_snapshot_delta_vote_and_restart() {
|
||||
}
|
||||
}
|
||||
// 31st observer must be rejected without affecting existing players.
|
||||
let command = p::ClientMessage {
|
||||
body: Some(client_message::Body::Intervene(p::Intervene {
|
||||
action: "meal".into(),
|
||||
})),
|
||||
}
|
||||
.encode_to_vec();
|
||||
s.send(tokio_tungstenite::tungstenite::Message::Binary(
|
||||
command.clone().into(),
|
||||
))
|
||||
.await
|
||||
.unwrap();
|
||||
s.send(tokio_tungstenite::tungstenite::Message::Binary(
|
||||
command.into(),
|
||||
))
|
||||
.await
|
||||
.unwrap();
|
||||
loop {
|
||||
if let Some(server_message::Body::Error(error)) = read(s).await.body {
|
||||
assert_eq!(error.code, "COMMAND_LIMIT");
|
||||
break;
|
||||
}
|
||||
}
|
||||
loop {
|
||||
if let Some(server_message::Body::Gameplay(state)) = read(s).await.body {
|
||||
assert!(
|
||||
state.pending.iter().any(|p| p == "meal")
|
||||
|| state.events.iter().any(|e| e.kind == "meal")
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
let (mut extra, _) =
|
||||
tokio_tungstenite::connect_async(format!("ws://{address}/api/rooms/{id}/ws"))
|
||||
.await
|
||||
|
||||
Reference in new issue
Block a user