-
Notifications
You must be signed in to change notification settings - Fork 108
Clean up data (drop created table) after running E2E tests #269
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
I remove a separate function that drops the table which was executed before starting the tests. Since the generated table name includes a second-based timestamp, this should only be necessary if the previous execution was *started* within 1 second of the current execution, including the time it took to create the table. As surprising as that might be (even if it failed immediately after creating the table and was then reexecuted), the function must've been added when this or some other situation that made this necessary was encountered. Adding randomness to the table's name should solve the same issue, but faster to reduce the E2E's already long runtime.
@@ -144,14 +142,13 @@ def get_file_path() -> str: | |||
test_db = os.environ.get("TEST_DATABASE") | |||
|
|||
python_version = "_".join([str(v) for v in sys.version_info[:3]]) | |||
test_table = "python_test_{0}_{1}".format(python_version, str(int(time.time()))) | |||
test_table = "python_test_{0}_{1}_{2}".format(python_version, str(int(time.time())), random.randint(1, 100000)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GUID instead of random?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I used random because I thought a UUID would be overkill. Aren't Python UUIDs 36 characters long? And wouldn't it take longer for Python to generate its 32 (not including dashes) random characters than to generate 5 random digits?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also considered using a random int instead of the python version and time components, but I think the 1st two fields are helpful to identify what (and when) created rogue Kusto tables.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably, but is sends a clearer intent.
optional comment, not a must
Pull Request Description
Clean up data (drop created table) after running E2E tests.
I remove a separate function that drops the table which was executed before starting the tests. Since the generated table name includes a second-based timestamp, this should only be necessary if the previous execution was started within 1 second of the current execution, including the time it took to create the table. As surprising as that might be (even if it failed immediately after creating the table and was then reexecuted), the function must've been added when this or some other situation that made this necessary was encountered. Adding randomness to the table's name should solve the same issue, but faster to reduce the E2E's already long runtime.