Skip to content

Commit 6a33ac7

Browse files
committed
fix flaky test
1 parent 0c87dee commit 6a33ac7

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

crates/api/tests/agent_tests.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,9 @@ async fn test_create_instance_rejects_unsubscribed_user() {
262262
let user_email = "no_sub_user@example.com";
263263
let user_token = mock_login(&server, user_email).await;
264264

265+
// Clean up any leftover subscription plans from other tests
266+
common::clear_subscription_plans(&server).await;
267+
265268
// Ensure user has NO subscription
266269
common::cleanup_user_subscriptions(&db, user_email).await;
267270

@@ -306,6 +309,9 @@ async fn test_create_instance_rejects_unsubscribed_user() {
306309
"Error message should mention limit, got: {}",
307310
error_message
308311
);
312+
313+
// Clean up: clear subscription plans to avoid polluting other tests
314+
common::clear_subscription_plans(&server).await;
309315
}
310316

311317
/// Test agent instance limit validation with subscription plans
@@ -317,6 +323,9 @@ async fn test_create_instance_respects_agent_instance_limit_max_1() {
317323
let user_email = "limit_test_user_max1@example.com";
318324
let user_token = mock_login(&server, user_email).await;
319325

326+
// Clean up any leftover subscription plans from other tests
327+
common::clear_subscription_plans(&server).await;
328+
320329
// Set up subscription with agent_instances limit of 1
321330
// NOTE: insert_test_subscription uses price_id "price_test_basic"
322331
common::set_subscription_plans(
@@ -408,4 +417,7 @@ async fn test_create_instance_respects_agent_instance_limit_max_1() {
408417
"Error message should mention limit, got: {}",
409418
error_message
410419
);
420+
421+
// Clean up: clear subscription plans to avoid polluting other tests
422+
common::clear_subscription_plans(&server).await;
411423
}

0 commit comments

Comments
 (0)