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

Handle Flaky Geth WS Tests #1727

Merged
merged 1 commit into from
Sep 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions newsfragments/1727.misc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"Fixed" flaky geth integration tests by adding an xfail.
12 changes: 9 additions & 3 deletions tests/integration/go_ethereum/test_goethereum_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,19 @@ class TestGoEthereumTest(GoEthereumTest):

class TestGoEthereumAdminModuleTest(GoEthereumAdminModuleTest):
@pytest.mark.xfail(reason="running geth with the --nodiscover flag doesn't allow peer addition")
def test_admin_peers(web3):
def test_admin_peers(self, web3: "Web3") -> None:
super().test_admin_peers(web3)

@pytest.mark.xfail(reason='Only one RPC endpoint is allowed to be active at any time')
def test_admin_start_stop_rpc(web3):
def test_admin_start_stop_rpc(self, web3: "Web3") -> None:
# This test causes all tests after it to fail on CI if it's allowed to run
pytest.xfail(reason='Only one RPC endpoint is allowed to be active at any time')
super().test_admin_start_stop_rpc(web3)

def test_admin_start_stop_ws(self, web3: "Web3") -> None:
# This test causes all tests after it to fail on CI if it's allowed to run
pytest.xfail(reason='Only one WS endpoint is allowed to be active at any time')
super().test_admin_start_stop_ws(web3)


class TestGoEthereumEthModuleTest(GoEthereumEthModuleTest):
pass
Expand Down
11 changes: 8 additions & 3 deletions tests/integration/go_ethereum/test_goethereum_ws.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,16 @@ class TestGoEthereumTest(GoEthereumTest):

class TestGoEthereumAdminModuleTest(GoEthereumAdminModuleTest):
@pytest.mark.xfail(reason="running geth with the --nodiscover flag doesn't allow peer addition")
def test_admin_peers(web3):
def test_admin_peers(self, web3: "Web3") -> None:
super().test_admin_peers(web3)

@pytest.mark.xfail(reason='Only one WebSocket endpoint is allowed to be active at any time')
def test_admin_start_stop_ws(web3):
def test_admin_start_stop_ws(self, web3: "Web3") -> None:
# This test inconsistently causes all tests after it to fail on CI if it's allowed to run
pytest.xfail(reason='Only one WebSocket endpoint is allowed to be active at any time')
super().test_admin_start_stop_ws(web3)

def test_admin_start_stop_rpc(self, web3: "Web3") -> None:
pytest.xfail(reason="This test inconsistently causes all tests after it on CI to fail if it's allowed to run") # noqa: E501
super().test_admin_start_stop_ws(web3)


Expand Down
13 changes: 9 additions & 4 deletions web3/_utils/module_testing/go_ethereum_admin_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,27 +49,32 @@ def test_admin_start_stop_rpc(self, web3: "Web3") -> None:
stop = web3.geth.admin.stop_rpc()
assert stop is True

start = web3.geth.admin.start_rpc('localhost', 8548)
start = web3.geth.admin.start_rpc()
assert start is True

with pytest.warns(DeprecationWarning):
stop = web3.geth.admin.stopRPC()
assert stop is True

start = web3.geth.admin.startRPC()
assert start is True
with pytest.warns(DeprecationWarning):
start = web3.geth.admin.startRPC()
assert start is True

def test_admin_start_stop_ws(self, web3: "Web3") -> None:
stop = web3.geth.admin.stop_ws()
assert stop is True

start = web3.geth.admin.start_ws('localhost', 8548)
start = web3.geth.admin.start_ws()
assert start is True

with pytest.warns(DeprecationWarning):
stop = web3.geth.admin.stopWS()
assert stop is True

with pytest.warns(DeprecationWarning):
start = web3.geth.admin.startWS()
assert start is True

#
# Deprecated
#
Expand Down