summaryrefslogtreecommitdiff
path: root/tests/integration_tests/log_utils.py
diff options
context:
space:
mode:
authorJames Falcon <TheRealFalcon@users.noreply.github.com>2020-12-09 15:49:11 -0600
committerGitHub <noreply@github.com>2020-12-09 16:49:11 -0500
commit17ca02e10623b12065532b26de9cefcccee0062c (patch)
tree6e3a42a784a716cea4f63bee7e5ef8e191ecf925 /tests/integration_tests/log_utils.py
parent7ec314a96e764c52181e29902a27346b1021b000 (diff)
downloadvyos-cloud-init-17ca02e10623b12065532b26de9cefcccee0062c.tar.gz
vyos-cloud-init-17ca02e10623b12065532b26de9cefcccee0062c.zip
Add integration test for power_state_change module (#717)
Also introduce the `unstable` mark, to allow us to land tests which run inconsistently (such as this one).
Diffstat (limited to 'tests/integration_tests/log_utils.py')
-rw-r--r--tests/integration_tests/log_utils.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/integration_tests/log_utils.py b/tests/integration_tests/log_utils.py
new file mode 100644
index 00000000..fa807389
--- /dev/null
+++ b/tests/integration_tests/log_utils.py
@@ -0,0 +1,13 @@
+def ordered_items_in_text(to_verify: list, text: str) -> bool:
+ """Return if all items in list appear in order in text.
+
+ Examples:
+ ordered_items_in_text(['a', '1'], 'ab1') # Returns True
+ ordered_items_in_text(['1', 'a'], 'ab1') # Returns False
+ """
+ index = 0
+ for item in to_verify:
+ index = text[index:].find(item)
+ if index < 0:
+ return False
+ return True