Skip to content

Commit

Permalink
Merge pull request #1708 from kclowes/upgrade-integration-tests-geth-…
Browse files Browse the repository at this point in the history
…1918

Upgrade Geth Test to 1.9.19
  • Loading branch information
kclowes authored Aug 21, 2020
2 parents 6a334ae + 103908f commit 8bb0b56
Show file tree
Hide file tree
Showing 14 changed files with 77 additions and 112 deletions.
62 changes: 31 additions & 31 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,13 @@ geth_steps: &geth_steps
name: build geth if missing
command: |
mkdir -p $HOME/.ethash
pip install --user py-geth>=1.10.1
pip install --user py-geth>=2.4.0
export GOROOT=/usr/local/go
echo $GETH_VERSION
export GETH_BINARY="$HOME/.py-geth/geth-$GETH_VERSION/bin/geth"
if [ ! -e "$GETH_BINARY" ]; then
curl -O https://storage.googleapis.com/golang/go1.9.7.linux-amd64.tar.gz
tar xvf go1.9.7.linux-amd64.tar.gz
curl -O https://storage.googleapis.com/golang/go1.14.2.linux-amd64.tar.gz
tar xvf go1.14.2.linux-amd64.tar.gz
sudo chown -R root:root ./go
sudo mv go /usr/local
sudo ln -s /usr/local/go/bin/go /usr/local/bin/go
Expand Down Expand Up @@ -188,29 +189,29 @@ jobs:
# Please don't use this key for any shenanigans
WEB3_INFURA_PROJECT_ID: 7707850c2fb7465ebe6f150d67182e22

py36-integration-goethereum-ipc-1.9.7:
py36-integration-goethereum-ipc-1.9.19:
<<: *geth_steps
docker:
- image: circleci/python:3.6
environment:
TOXENV: py36-integration-goethereum-ipc
GETH_VERSION: v1.9.7
GETH_VERSION: v1.9.19

py36-integration-goethereum-http-1.9.7:
py36-integration-goethereum-http-1.9.19:
<<: *geth_steps
docker:
- image: circleci/python:3.6
environment:
TOXENV: py36-integration-goethereum-http
GETH_VERSION: v1.9.7
GETH_VERSION: v1.9.19

py36-integration-goethereum-ws-1.9.7:
py36-integration-goethereum-ws-1.9.19:
<<: *geth_steps
docker:
- image: circleci/python:3.6
environment:
TOXENV: py36-integration-goethereum-ws
GETH_VERSION: v1.9.7
GETH_VERSION: v1.9.19

py36-integration-parity-ipc:
<<: *parity_steps
Expand Down Expand Up @@ -278,29 +279,29 @@ jobs:
# Please don't use this key for any shenanigans
WEB3_INFURA_PROJECT_ID: 7707850c2fb7465ebe6f150d67182e22

py37-integration-goethereum-ipc-1.9.7:
py37-integration-goethereum-ipc-1.9.19:
<<: *geth_steps
docker:
- image: circleci/python:3.7
environment:
TOXENV: py37-integration-goethereum-ipc
GETH_VERSION: v1.9.7
GETH_VERSION: v1.9.19

py37-integration-goethereum-http-1.9.7:
py37-integration-goethereum-http-1.9.19:
<<: *geth_steps
docker:
- image: circleci/python:3.7
environment:
TOXENV: py37-integration-goethereum-http
GETH_VERSION: v1.9.7
GETH_VERSION: v1.9.19

py37-integration-goethereum-ws-1.9.7:
py37-integration-goethereum-ws-1.9.19:
<<: *geth_steps
docker:
- image: circleci/python:3.7
environment:
TOXENV: py37-integration-goethereum-ws
GETH_VERSION: v1.9.7
GETH_VERSION: v1.9.19

py37-integration-parity-ipc:
<<: *parity_steps
Expand Down Expand Up @@ -368,29 +369,29 @@ jobs:
# Please don't use this key for any shenanigans
WEB3_INFURA_PROJECT_ID: 7707850c2fb7465ebe6f150d67182e22

py38-integration-goethereum-ipc-1.9.7:
py38-integration-goethereum-ipc-1.9.19:
<<: *geth_steps
docker:
- image: circleci/python:3.8
environment:
TOXENV: py38-integration-goethereum-ipc
GETH_VERSION: v1.9.7
GETH_VERSION: v1.9.19

py38-integration-goethereum-http-1.9.7:
py38-integration-goethereum-http-1.9.19:
<<: *geth_steps
docker:
- image: circleci/python:3.8
environment:
TOXENV: py38-integration-goethereum-http
GETH_VERSION: v1.9.7
GETH_VERSION: v1.9.19

py38-integration-goethereum-ws-1.9.7:
py38-integration-goethereum-ws-1.9.19:
<<: *geth_steps
docker:
- image: circleci/python:3.8
environment:
TOXENV: py38-integration-goethereum-ws
GETH_VERSION: v1.9.7
GETH_VERSION: v1.9.19

py38-integration-parity-ipc:
<<: *parity_steps
Expand Down Expand Up @@ -442,34 +443,33 @@ workflows:
- py36-core
- py37-core
- py38-core

- lint
- docs
- py36-ens
- py36-ethpm
- py36-integration-goethereum-ipc-1.9.7
- py36-integration-goethereum-http-1.9.7
- py36-integration-goethereum-ws-1.9.7
- py36-integration-goethereum-ipc-1.9.19
- py36-integration-goethereum-http-1.9.19
- py36-integration-goethereum-ws-1.9.19
- py36-integration-parity-ipc
- py36-integration-parity-http
- py36-integration-parity-ws
- py36-integration-ethtester-pyevm
- py36-wheel-cli
- py37-ens
- py37-ethpm
- py37-integration-goethereum-ipc-1.9.7
- py37-integration-goethereum-http-1.9.7
- py37-integration-goethereum-ws-1.9.7
- py37-integration-goethereum-ipc-1.9.19
- py37-integration-goethereum-http-1.9.19
- py37-integration-goethereum-ws-1.9.19
- py37-integration-parity-ipc
- py37-integration-parity-http
- py37-integration-parity-ws
- py37-integration-ethtester-pyevm
- py37-wheel-cli
- py38-ens
- py38-ethpm
- py38-integration-goethereum-ipc-1.9.7
- py38-integration-goethereum-http-1.9.7
- py38-integration-goethereum-ws-1.9.7
- py38-integration-goethereum-ipc-1.9.19
- py38-integration-goethereum-http-1.9.19
- py38-integration-goethereum-ws-1.9.19
- py38-integration-parity-ipc
- py38-integration-parity-http
- py38-integration-parity-ws
Expand Down
8 changes: 4 additions & 4 deletions docs/web3.geth.rst
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ The ``web3.geth.admin`` object exposes methods to interact with the RPC APIs und
.. Warning:: This method has been removed from Geth

.. py:method:: start_rpc(host='localhost', port='8545', cors="", apis="eth,net,web3")
.. py:method:: start_rpc(host='localhost', port=8545, cors="", apis="eth,net,web3")
* Delegates to ``admin_startRPC`` RPC Method

Expand All @@ -141,13 +141,13 @@ The ``web3.geth.admin`` object exposes methods to interact with the RPC APIs und
True
.. py:method:: startRPC(host='localhost', port='8545', cors="", apis="eth,net,web3")
.. py:method:: startRPC(host='localhost', port=8545, cors="", apis="eth,net,web3")
.. warning:: Deprecated: This method is deprecated in favor of
:meth:`~web3.geth.admin.start_rpc()`


.. py:method:: start_ws(host='localhost', port='8546', cors="", apis="eth,net,web3")
.. py:method:: start_ws(host='localhost', port=8546, cors="", apis="eth,net,web3")
* Delegates to ``admin_startWS`` RPC Method

Expand All @@ -162,7 +162,7 @@ The ``web3.geth.admin`` object exposes methods to interact with the RPC APIs und
True
.. py:method:: startWS(host='localhost', port='8546', cors="", apis="eth,net,web3")
.. py:method:: startWS(host='localhost', port=8546, cors="", apis="eth,net,web3")
.. warning:: Deprecated: This method is deprecated in favor of
:meth:`~web3.geth.admin.start_ws()`
Expand Down
1 change: 1 addition & 0 deletions newsfragments/1708.misc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Upgrade Geth integration tests to run against v1.9.19
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
extras_require = {
'tester': [
"eth-tester[py-evm]==v0.5.0-beta.1",
"py-geth>=2.2.0,<3",
"py-geth>=2.4.0,<3",
],
'linter': [
"flake8==3.4.1",
Expand All @@ -21,7 +21,7 @@
"click>=5.1",
"configparser==3.5.0",
"contextlib2>=0.5.4",
"py-geth>=2.2.0,<3",
"py-geth>=2.4.0,<3",
"py-solc>=0.4.0",
"pytest>=4.4.0,<5.0.0",
"sphinx>=2.4.4,<3",
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ def test_websocket_max_size_error(self, web3, endpoint_uri):
w3 = Web3(Web3.WebsocketProvider(
endpoint_uri=endpoint_uri, websocket_kwargs={'max_size': 1})
)
with pytest.raises(ConnectionClosed):
with pytest.raises((OSError, ConnectionClosed)):
w3.eth.getBlock(0)
Binary file added tests/integration/geth-1.9.19-fixture.zip
Binary file not shown.
Binary file removed tests/integration/geth-1.9.7-fixture.zip
Binary file not shown.
13 changes: 5 additions & 8 deletions tests/integration/go_ethereum/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,18 @@
Web3ModuleTest,
)

VERSIONS_WITHOUT_ETH_SUBMITHASH = ['v1.9.7']


class GoEthereumTest(Web3ModuleTest):
def _check_web3_clientVersion(self, client_version):
assert client_version.startswith('Geth/')


class GoEthereumEthModuleTest(EthModuleTest):
@pytest.mark.xfail(reason='eth_submitHashrate deprecated in 1.8.22 for ethash_submitHashRate')
def test_eth_submitHashrate(self, web3):
# https://github.com/ethereum/go-ethereum/commit/51db5975cc5fb88db6a0dba1826b534fd4df29d7
super().test_eth_submitHashrate(web3)

def test_eth_replaceTransaction_already_mined(self, web3, unlocked_account_dual_type):
web3.geth.miner.start()
super().test_eth_replaceTransaction_already_mined(web3, unlocked_account_dual_type)
Expand All @@ -32,12 +35,6 @@ def test_eth_estimateGas_with_block(self,
web3, unlocked_account_dual_type
)

def test_eth_submitHashrate(self, web3):
if any([v in web3.clientVersion for v in VERSIONS_WITHOUT_ETH_SUBMITHASH]):
# https://github.com/ethereum/go-ethereum/commit/51db5975cc5fb88db6a0dba1826b534fd4df29d7
pytest.xfail('eth_submitHashrate deprecated in 1.8.22 for ethash_submitHashRate')
super().test_eth_submitHashrate(web3)

@pytest.mark.xfail(reason='eth_signTypedData has not been released in geth')
def test_eth_signTypedData(self,
web3,
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/go_ethereum/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

KEYFILE_PW = 'web3py-test'

GETH_197_ZIP = 'geth-1.9.7-fixture.zip'
GETH_1919_ZIP = 'geth-1.9.19-fixture.zip'


@pytest.fixture(scope='module')
Expand Down Expand Up @@ -70,7 +70,7 @@ def base_geth_command_arguments(geth_binary, datadir):
@pytest.fixture(scope="module")
def geth_zipfile_version(get_geth_version):
if get_geth_version.major == 1 and get_geth_version.minor == 9:
return GETH_197_ZIP
return GETH_1919_ZIP
raise AssertionError("Unsupported geth version")


Expand Down
14 changes: 3 additions & 11 deletions tests/integration/go_ethereum/test_goethereum_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ def _geth_command_arguments(rpc_port,
yield from base_geth_command_arguments
if geth_version.major == 1:
yield from (
'--rpc',
'--rpcport', rpc_port,
'--rpcapi', 'admin,db,eth,net,web3,personal,shh,miner',
'--http',
'--http.port', rpc_port,
'--http.api', 'admin,eth,net,web3,personal,shh,miner',
'--ipcdisable',
'--allow-insecure-unlock'
)
Expand Down Expand Up @@ -77,14 +77,6 @@ def test_admin_peers(web3):
def test_admin_start_stop_rpc(web3):
super().test_admin_start_stop_rpc(web3)

@pytest.mark.xfail(reason='Only one RPC endpoint is allowed to be active at any time')
def test_admin_startRPC(web3):
super().test_admin_stopRPC(web3)

@pytest.mark.xfail(reason='Only one RPC endpoint is allowed to be active at any time')
def test_admin_stopRPC(web3):
super().test_admin_stopRPC(web3)


class TestGoEthereumEthModuleTest(GoEthereumEthModuleTest):
pass
Expand Down
4 changes: 4 additions & 0 deletions tests/integration/go_ethereum/test_goethereum_ipc.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ class TestGoEthereumAdminModuleTest(GoEthereumAdminModuleTest):
def test_admin_peers(web3):
super().test_admin_peers(web3)

@pytest.mark.xfail(reason="websockets aren't enabled with our IPC flags")
def test_admin_start_stop_ws(web3):
super().test_admin_start_stop_ws(web3)


class TestGoEthereumEthModuleTest(GoEthereumEthModuleTest):
pass
Expand Down
14 changes: 3 additions & 11 deletions tests/integration/go_ethereum/test_goethereum_ws.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ def _geth_command_arguments(ws_port,
if geth_version.major == 1:
yield from (
'--ws',
'--wsport', ws_port,
'--wsapi', 'admin,db,eth,net,shh,web3,personal,miner',
'--wsorigins', '*',
'--ws.port', ws_port,
'--ws.api', 'admin,eth,net,shh,web3,personal,miner',
'--ws.origins', '*',
'--ipcdisable',
'--allow-insecure-unlock',
)
Expand Down Expand Up @@ -83,14 +83,6 @@ def test_admin_peers(web3):
def test_admin_start_stop_ws(web3):
super().test_admin_start_stop_ws(web3)

@pytest.mark.xfail(reason='Only one WebSocket endpoint is allowed to be active at any time')
def test_admin_startWS(self, web3):
super().test_admin_startWS(web3)

@pytest.mark.xfail(reason='Only one WebSocket endpoint is allowed to be active at any time')
def test_admin_stopWS(self, web3):
super().test_admin_stopWS(web3)


class TestGoEthereumEthModuleTest(GoEthereumEthModuleTest):
pass
Expand Down
4 changes: 2 additions & 2 deletions web3/_utils/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@


def admin_start_params_munger(
module: Module, host: str='localhost', port: str='8546', cors: str='', apis: str='eth,net,web3'
) -> Tuple[str, str, str, str]:
module: Module, host: str='localhost', port: int=8546, cors: str='', apis: str='eth,net,web3'
) -> Tuple[str, int, str, str]:
return (host, port, cors, apis)


Expand Down
Loading

0 comments on commit 8bb0b56

Please sign in to comment.