Skip to content
This repository was archived by the owner on Sep 3, 2022. It is now read-only.
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Support running the end-to-end test repeatedly.
This will aid in reproducing and fixing flaky test failures.

In particular, this is being added to help test fixes for #2051.
  • Loading branch information
ojarjur committed Aug 8, 2018
commit 558d03d3e9ee7abf562446bd3ce040a8eb07bb0f
17 changes: 16 additions & 1 deletion tools/cli/tests/end-to-end.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
# of the bundled CLI tool. This requires a GCP project in which the
# test will create, connect to, and delete Datalab instances.

import argparse
import random
import socket
import subprocess
Expand Down Expand Up @@ -232,4 +233,18 @@ def run_connection_test(self):


if __name__ == '__main__':
unittest.main()
parser = argparse.ArgumentParser()
parser.add_argument('--runs', type=int, default=1, choices=range(1,100),
metavar='COUNT', dest='runs',
help='Number of times to run the test suite')
args = parser.parse_args()

failed_count, run_count = 0, 0
for _ in xrange(0, args.runs):
suite = unittest.TestLoader().loadTestsFromTestCase(TestEndToEnd)
result = unittest.TextTestRunner(buffer=True).run(suite)
run_count += 1
if not result.wasSuccessful():
failed_count += 1

print('Ran {} test runs with {} failing'.format(run_count, failed_count))