pcs/tests-fix-datetime-race-condition.patch
bizhiyuan 99438fae3f fix datetime race condition
(cherry picked from commit 6c87e398a5f41596fcdb9a9136cdbd48959b1c0a)
2023-09-06 14:14:01 +08:00

28 lines
962 B
Diff

From b8e186f82cafea79e0ebf9beb1627ce0c62a8b16 Mon Sep 17 00:00:00 2001
From: bizhiyuan <bizhiyuan@kylinos.cn>
Date: Wed, 6 Sep 2023 01:02:45 +0800
Subject: [PATCH] tests: fix datetime race condition
---
pcs_test/tier1/legacy/test_constraints.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/pcs_test/tier1/legacy/test_constraints.py b/pcs_test/tier1/legacy/test_constraints.py
index 963fbe8..90c8d7f 100644
--- a/pcs_test/tier1/legacy/test_constraints.py
+++ b/pcs_test/tier1/legacy/test_constraints.py
@@ -4709,7 +4709,9 @@ class LocationAdd(ConstraintEffect):
@skip_unless_crm_rule()
class ExpiredConstraints(ConstraintBaseTest):
- _tomorrow = (datetime.date.today() + datetime.timedelta(days=1)).strftime(
+ # Setting tomorrow to the day after tomorrow in case the tests run close to
+ # midnight.
+ _tomorrow = (datetime.date.today() + datetime.timedelta(days=2)).strftime(
"%Y-%m-%d"
)
--
2.27.0