From ec61c65c74e5822672e71d57cc168bef1d71465a Mon Sep 17 00:00:00 2001 From: James Lucas Date: Thu, 3 Oct 2024 15:32:50 -0500 Subject: [PATCH] Attempt fix flake This test is flaky around the fifth run for some reason. My guess is because another cleanup process is interfering, which seems strange but not impossible. Anyway, moving the content-existence check to _before_ changing its expiration seems to fix the issue. --- server/svix-server/tests/it/e2e_message.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/server/svix-server/tests/it/e2e_message.rs b/server/svix-server/tests/it/e2e_message.rs index 929157330..1e93260fd 100644 --- a/server/svix-server/tests/it/e2e_message.rs +++ b/server/svix-server/tests/it/e2e_message.rs @@ -395,6 +395,12 @@ async fn test_payload_retention_period() { .unwrap(); let msg_id = msg.id.clone(); + let content: Option = messagecontent::Entity::find_by_id(msg_id.clone()) + .one(&pool) + .await + .unwrap(); + assert_eq!(content.unwrap().id, msg_id.clone()); + let res = messagecontent::Entity::update_many() .col_expr( messagecontent::Column::Expiration, @@ -406,12 +412,6 @@ async fn test_payload_retention_period() { .unwrap(); assert_eq!(1, res.rows_affected); - let content: Option = messagecontent::Entity::find_by_id(msg_id.clone()) - .one(&pool) - .await - .unwrap(); - assert_eq!(content.unwrap().id, msg_id.clone()); - expired_message_cleaner::clean_expired_messages(&pool, 5000, false) .await .unwrap();