Skip to content
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

Adds flaky e2e report and restart functionality #11263

Merged
merged 31 commits into from
Dec 19, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
fae8a15
Reverted old changes
DubeySandeep Nov 25, 2020
c6c9a8a
Adds checks for reporting.
DubeySandeep Nov 25, 2020
9562edd
Added url
DubeySandeep Nov 25, 2020
43f2ffd
Merge branch 'develop' of github.com:oppia/oppia into flake-e2e
DubeySandeep Nov 27, 2020
6353ea8
Fixes exit error issues.
DubeySandeep Nov 28, 2020
ea3af12
Adds checker file.
DubeySandeep Nov 28, 2020
d2bfd87
Adds correct url.
DubeySandeep Nov 28, 2020
7e6bf00
Adds correct url format.
DubeySandeep Nov 28, 2020
917c92f
Fixes test issues
DubeySandeep Nov 28, 2020
1f0544a
Address review comments.
DubeySandeep Dec 1, 2020
d33937e
Merge branch 'develop' into flake-e2e
U8NWXD Dec 11, 2020
f10e084
Update with review comments and for new server
U8NWXD Dec 11, 2020
58753c1
lint fixes
U8NWXD Dec 11, 2020
4f68414
Catch non-unicode characters and ignore them
U8NWXD Dec 11, 2020
4e28982
Merge branch 'develop' into flake-e2e
U8NWXD Dec 14, 2020
f203b29
Report passes and rerun non flaky e2e tests
U8NWXD Dec 15, 2020
2b66886
Fix e2e backend tests
U8NWXD Dec 15, 2020
17c4179
Fix lint errors
U8NWXD Dec 15, 2020
f55fff8
Fix backend tests
U8NWXD Dec 16, 2020
6209a6a
Silence pylint
U8NWXD Dec 16, 2020
426aace
Reach 100% coverage of run_e2e_tests.py
U8NWXD Dec 16, 2020
02210e2
Add tests for flake_checker.py
U8NWXD Dec 17, 2020
1826229
Lint fixes
U8NWXD Dec 17, 2020
545b794
Merge branch 'develop' into flake-e2e
U8NWXD Dec 18, 2020
19f43c1
Include unicode character directly for testing
U8NWXD Dec 18, 2020
8203f85
Make cleanup code more robust
U8NWXD Dec 18, 2020
a84928c
Improve unicode handling
U8NWXD Dec 18, 2020
49d3f05
Fix backend code coverage
U8NWXD Dec 18, 2020
c87d667
Fix CI errors
U8NWXD Dec 19, 2020
8c219b0
More robustly shut down processes
U8NWXD Dec 19, 2020
a2f3b67
Make killing reluctant processes more robust
U8NWXD Dec 19, 2020
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
Prev Previous commit
Make killing reluctant processes more robust
  • Loading branch information
U8NWXD committed Dec 19, 2020
commit a2f3b67cffd87434da39754030afea7b45eb1cf6
6 changes: 4 additions & 2 deletions scripts/run_e2e_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,11 @@ def _kill_process(process):
for _ in python_utils.RANGE(KILL_TIMEOUT_SECS):
time.sleep(1)
if not process.poll():
break
if process.poll():
return
try:
process.kill()
except OSError:
pass # Indicates process already dead.


def cleanup():
Expand Down
28 changes: 20 additions & 8 deletions scripts/run_e2e_tests_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@
class MockProcessClass(python_utils.OBJECT):

def __init__(
self, clean_shutdown=True, stdout='', accept_signal=True):
self, clean_shutdown=True, stdout='',
accept_signal=True, accept_kill=True):
"""Create a mock process object.
Attributes:
poll_count: int. The number of times poll() has been called.
Expand All @@ -59,20 +60,25 @@ def __init__(
process.
accept_signal: bool. Whether to raise OSError in
send_signal.
accept_kill: bool. Whether to raise OSError in
kill().

Args:
clean_shutdown: bool. Whether to shut down when SIGINT received.
stdout: str. The text written to standard output by the
process.
accept_signal: bool. Whether to raise OSError in
send_signal.
accept_kill: bool. Whether to raise OSError in
kill().
"""
self.poll_count = 0
self.signals_received = []
self.kill_count = 0
self.poll_return = True
self.clean_shutdown = clean_shutdown
self.accept_signal = accept_signal
self.accept_kill = accept_kill

self.stdout = python_utils.string_io(buffer_value=stdout)

Expand All @@ -82,6 +88,8 @@ def kill(self):
Mocks the process being killed.
"""
self.kill_count += 1
if not self.accept_kill:
raise OSError()

def poll(self):
"""Increment poll_count.
Expand Down Expand Up @@ -1689,7 +1697,7 @@ def test_cleanup_portserver_when_server_shuts_down_cleanly(self):
# Server gets polled twice. Once to break out of wait loop and
# again to check that the process shut down and does not need to
# be killed.
self.assertEqual(process.poll_count, 2)
self.assertEqual(process.poll_count, 1)
self.assertEqual(process.signals_received, [signal.SIGINT])

def test_cleanup_portserver_when_server_shutdown_fails(self):
Expand All @@ -1700,17 +1708,21 @@ def test_cleanup_portserver_when_server_shutdown_fails(self):
# loop and again to see that the process did not shut down and
# therefore needs to be killed.
self.assertEqual(
process.poll_count,
run_e2e_tests.KILL_TIMEOUT_SECS + 1
)
process.poll_count, run_e2e_tests.KILL_TIMEOUT_SECS)
self.assertEqual(process.signals_received, [signal.SIGINT])

def test_cleanup_portserver_when_server_already_shutdown(self):
process = MockProcessClass(accept_signal=False)
run_e2e_tests.cleanup_portserver(process)
self.assertEqual(process.kill_count, 0)
# Server gets polled 11 times. 1 for each second of the wait
# loop and again to see that the process did not shut down and
# therefore needs to be killed.
self.assertEqual(process.poll_count, 0)
self.assertEqual(process.signals_received, [signal.SIGINT])

def test_cleanup_portserver_when_server_kill_fails(self):
process = MockProcessClass(
accept_kill=False, clean_shutdown=False)
run_e2e_tests.cleanup_portserver(process)
self.assertEqual(process.kill_count, 1)
self.assertEqual(
process.poll_count, run_e2e_tests.KILL_TIMEOUT_SECS)
self.assertEqual(process.signals_received, [signal.SIGINT])