-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SNOW-1728000 TestExecutor and TestSelector for e2e tests (#963)
- Loading branch information
1 parent
b6ffff3
commit bc8e824
Showing
3 changed files
with
66 additions
and
79 deletions.
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": | ||
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