You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-08-08 14:22:09 +03:00
feat/MCOL-6074: CMAPI integrational tests that work with real hosts (using columnstore-ansible-aws for cluster creation/provisioning)
This commit is contained in:
41
cmapi/integration_tests/utils.py
Normal file
41
cmapi/integration_tests/utils.py
Normal file
@@ -0,0 +1,41 @@
|
||||
from contextlib import contextmanager
|
||||
import os
|
||||
|
||||
|
||||
@contextmanager
|
||||
def change_directory(new_dir):
|
||||
"""
|
||||
Context manager for temporarily changing the current working directory.
|
||||
|
||||
Args:
|
||||
new_dir: Directory to change to
|
||||
|
||||
Example:
|
||||
with change_directory("/path/to/dir"):
|
||||
# Code here runs with the working directory as "/path/to/dir"
|
||||
# After the block, we return to the original directory
|
||||
"""
|
||||
old_dir = os.getcwd()
|
||||
try:
|
||||
os.chdir(new_dir)
|
||||
yield
|
||||
finally:
|
||||
os.chdir(old_dir)
|
||||
|
||||
|
||||
def drop_timestamp(data: dict) -> dict:
|
||||
"""
|
||||
Drop the timestamp from the data dictionary.
|
||||
"""
|
||||
if "timestamp" in data:
|
||||
del data["timestamp"]
|
||||
return data
|
||||
|
||||
|
||||
def assert_dict_includes(this: dict, other: dict) -> None:
|
||||
"""
|
||||
Check if the current dictionary includes all keys and values from another dictionary.
|
||||
"""
|
||||
for key, value in other.items():
|
||||
assert key in this
|
||||
assert this[key] == value, f"Key '{key}' does not match: {this[key]} != {value}"
|
Reference in New Issue
Block a user