Skip to content

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

Merged
merged 2 commits into from
Sep 22, 2020

Conversation

yihezkel
Copy link
Member

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.


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))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GUID instead of random?

Copy link
Member Author

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?

Copy link
Member Author

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.

Copy link
Contributor

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

@yihezkel yihezkel requested a review from yogilad September 22, 2020 08:18
@yihezkel yihezkel merged commit 4f560ba into master Sep 22, 2020
@yihezkel yihezkel deleted the cleanUpAfterE2eTests branch April 4, 2021 09:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants