-
Notifications
You must be signed in to change notification settings - Fork 99
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
SNOW-1728000 TestExecutor and TestSelector for e2e tests #963
Merged
sfc-gh-mbobowski
merged 2 commits into
master
from
mbobowski-SNOW--1728000-abstractions
Oct 17, 2024
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
from datetime import datetime | ||
import sys | ||
import traceback | ||
|
||
# TestExecutor is responsible for running a given subset of tests | ||
class TestExecutor: | ||
|
||
def execute(self, testSuitList, driver, nameSalt, round=1): | ||
try: | ||
for test in testSuitList: | ||
driver.createConnector(test.getConfigFileName(), nameSalt) | ||
|
||
driver.startConnectorWaitTime() | ||
|
||
for r in range(round): | ||
print(datetime.now().strftime("\n%H:%M:%S "), "=== round {} ===".format(r)) | ||
for test in testSuitList: | ||
print(datetime.now().strftime("\n%H:%M:%S "), | ||
"=== Sending " + test.__class__.__name__ + " data ===") | ||
test.send() | ||
print(datetime.now().strftime("%H:%M:%S "), "=== Done " + test.__class__.__name__ + " ===", flush=True) | ||
|
||
|
||
driver.verifyWaitTime() | ||
|
||
for test in testSuitList: | ||
print(datetime.now().strftime("\n%H:%M:%S "), "=== Verify " + test.__class__.__name__ + " ===") | ||
driver.verifyWithRetry(test.verify, r, test.getConfigFileName()) | ||
print(datetime.now().strftime("%H:%M:%S "), "=== Passed " + test.__class__.__name__ + " ===", flush=True) | ||
|
||
print(datetime.now().strftime("\n%H:%M:%S "), "=== All test passed ===") | ||
except Exception as e: | ||
print(datetime.now().strftime("%H:%M:%S "), e) | ||
traceback.print_tb(e.__traceback__) | ||
print(datetime.now().strftime("%H:%M:%S "), "Error: ", sys.exc_info()[0], driver.connectorParameters) | ||
exit(1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from test_suites import create_end_to_end_test_suites | ||
import test_suit | ||
|
||
# TestSelector is responsible for selecting a subset of tests to be run | ||
# It is meant to filter tests by platform, cloud vendor or any other predicate needed | ||
class TestSelector: | ||
|
||
def selectTestsToBeRun(self, driver, nameSalt, schemaRegistryAddress, testPlatform, allowedTestsCsv): | ||
test_suites = create_end_to_end_test_suites(driver, nameSalt, schemaRegistryAddress, testPlatform, allowedTestsCsv) | ||
|
||
if testPlatform == "apache": | ||
return [single_end_to_end_test.test_instance for single_end_to_end_test in test_suites.values() if single_end_to_end_test.run_in_apache == True] | ||
elif testPlatform == "confluent": | ||
return [single_end_to_end_test.test_instance for single_end_to_end_test in test_suites.values() if single_end_to_end_test.run_in_confluent == True] | ||
elif testPlatform == "clean": | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This |
||
return [single_end_to_end_test.test_instance for single_end_to_end_test in test_suites.values()] | ||
else: | ||
raise test_suit.test_utils.NonRetryableError("unknown testPlatform={}".format(testPlatform)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
allowedTestCsv
filtering will be moved here as well.