Skip to content

Commit

Permalink
[electrum] use the docker-compose command for functional tests
Browse files Browse the repository at this point in the history
Summary: As of pytest-docker 2.0.0, docker-compose is no longer the default command. The default `docker compose` command now requires a newer version of `docker` than what is packaged for debian, so add a `docker_compose_command` pytest fixture to switch back to the previous behavior.

Test Plan: `@bot electrum-functional-tests`

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D14291
  • Loading branch information
PiRK authored and abc-bot committed Jul 26, 2023
1 parent 24d9af7 commit 6b59f13
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
7 changes: 4 additions & 3 deletions electrumabc/tests/regtest/test_rpc_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@
from jsonrpcclient import request

# See https://docs.pytest.org/en/7.1.x/how-to/fixtures.html
from .util import docker_compose_file # noqa: F401
from .util import fulcrum_service # noqa: F401
from .util import (
from .util import ( # noqa: F401
EC_DAEMON_RPC_URL,
SUPPORTED_PLATFORM,
bitcoind_rpc_connection,
docker_compose_command,
docker_compose_file,
fulcrum_service,
poll_for_answer,
)

Expand Down
7 changes: 4 additions & 3 deletions electrumabc/tests/regtest/test_rpc_payment_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@
from jsonrpcclient import request

# See https://docs.pytest.org/en/7.1.x/how-to/fixtures.html
from .util import docker_compose_file # noqa: F401
from .util import fulcrum_service # noqa: F401
from .util import (
from .util import ( # noqa: F401
EC_DAEMON_RPC_URL,
SUPPORTED_PLATFORM,
bitcoind_rpc_connection,
docker_compose_command,
docker_compose_file,
fulcrum_service,
poll_for_answer,
)

Expand Down
10 changes: 10 additions & 0 deletions electrumabc/tests/regtest/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,16 @@ def docker_compose_file(pytestconfig) -> str:
)


@pytest.fixture(scope="session")
def docker_compose_command() -> str:
"""Use the docker-compose command rather than `docker compose`. This is no longer
the default since pytest-docker 2.0.0 was released, so we need to specify it.
The docker version installed on CI seems to be too old to be compatible with the
way pytest-docker calls the `docker compose` command.
"""
return "docker-compose"


def make_electrum_data_dir():
"""Create a temporary directory with a regtest subdirectory, and copy the Electrum
config file into it.
Expand Down

0 comments on commit 6b59f13

Please sign in to comment.