diff --git a/.github/workflows/goth.yml b/.github/workflows/goth.yml index c0317a4f3..a153091c2 100644 --- a/.github/workflows/goth.yml +++ b/.github/workflows/goth.yml @@ -14,75 +14,34 @@ on: jobs: goth-tests: name: Run integration tests - runs-on: [goth, ubuntu-18.04] + runs-on: ubuntu-latest steps: - - name: install docker-compose - run: | - sudo curl -L "https://github.com/docker/compose/releases/download/1.28.4/docker-compose-Linux-x86_64" -o /usr/local/bin/docker-compose - sudo chmod a+x /usr/local/bin/docker-compose - - - name: install ffi and gcc - run: sudo apt-get install -y libffi-dev build-essential - - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Configure python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: - python-version: '3.9' + python-version: '3.10' - - name: Install and configure Poetry - run: python -m pip install -U pip setuptools poetry==1.3.2 + - name: Install Poetry + run: curl -sSL https://install.python-poetry.org | python3 - --version 1.8.2 - name: Install dependencies run: | - poetry env use python3.9 poetry install - - name: Disconnect Docker containers from default network - continue-on-error: true - # related to this issue: https://github.com/moby/moby/issues/23302 - run: | - docker network inspect docker_default - sudo apt-get install -y jq - docker network inspect docker_default | jq ".[0].Containers | map(.Name)[]" | tee /dev/stderr | xargs --max-args 1 -- docker network disconnect -f docker_default - - - name: Remove Docker containers - continue-on-error: true - run: docker rm -f $(docker ps -a -q) - - - name: Restart Docker daemon - # related to this issue: https://github.com/moby/moby/issues/23302 - run: sudo systemctl restart docker - - - name: Log in to GitHub Docker repository - run: echo ${{ secrets.GITHUB_TOKEN }} | docker login docker.pkg.github.com -u ${{github.actor}} --password-stdin - - name: Initialize the test suite run: poetry run poe tests_integration_init - name: Run test suite env: - GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: poetry run poe tests_integration - name: Upload test logs - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 if: always() with: name: goth-logs path: /tmp/goth-tests - - # Only relevant for self-hosted runners - - name: Remove test logs - if: always() - run: rm -rf /tmp/goth-tests - - # Only relevant for self-hosted runners - - name: Remove poetry virtual env - if: always() - # Python version below should agree with the version set up by this job. - # In future we'll be able to use the `--all` flag here to remove envs for - # all Python versions (https://github.com/python-poetry/poetry/issues/3208). - run: poetry env remove python3.9 diff --git a/pyproject.toml b/pyproject.toml index 79519853c..e63a7d313 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -84,7 +84,7 @@ tests_unit = {cmd = "pytest --cov=yapapi --cov-report html --cov-report term -sv tests_integration_init = { sequence = ["_gothv_env", "_gothv_requirements", "_gothv_assets"], help="Initialize the integration test environment"} tests_integration = { cmd = ".envs/yapapi-goth/bin/python -m pytest -svx tests/goth_tests --config-override docker-compose.build-environment.use-prerelease=false --config-path tests/goth_tests/assets/goth-config.yml --ssh-verify-connection --reruns 3 --only-rerun AssertionError --only-rerun TimeoutError --only-rerun goth.runner.exceptions.TimeoutError --only-rerun goth.runner.exceptions.TemporalAssertionError --only-rerun urllib.error.URLError --only-rerun goth.runner.exceptions.CommandError --only-rerun requests.exceptions.ConnectionError --only-rerun OSError --only-rerun requests.exceptions.ReadTimeout", help = "Run the integration tests"} _gothv_env = "python -m venv .envs/yapapi-goth" -_gothv_requirements = ".envs/yapapi-goth/bin/pip install -U --extra-index-url https://test.pypi.org/simple/ goth==0.14.1 pip pytest pytest-asyncio pytest-rerunfailures pexpect" +_gothv_requirements = ".envs/yapapi-goth/bin/pip install -U --extra-index-url https://test.pypi.org/simple/ goth==0.17.0 pip pytest pytest-asyncio pytest-rerunfailures pexpect" _gothv_assets = ".envs/yapapi-goth/bin/python -m goth create-assets tests/goth_tests/assets" clean = {cmd = "rm -rf .coverage .requirements.txt dist md handbook build", help = "Clean all development related files" } diff --git a/tests/goth_tests/___test_resubscription.py b/tests/goth_tests/___test_resubscription.py index 2da7c4c63..cd84edea8 100644 --- a/tests/goth_tests/___test_resubscription.py +++ b/tests/goth_tests/___test_resubscription.py @@ -165,7 +165,7 @@ async def worker(work_ctx, tasks): async with Golem( budget=10.0, event_consumer=monitor.add_event_sync, - payment_network="rinkeby", + payment_network="holesky", ) as golem: task: Task # mypy needs this for some reason async for task in golem.execute_tasks( diff --git a/tests/goth_tests/test_agreement_termination/requestor.py b/tests/goth_tests/test_agreement_termination/requestor.py index d7ecea6b3..c604ad470 100755 --- a/tests/goth_tests/test_agreement_termination/requestor.py +++ b/tests/goth_tests/test_agreement_termination/requestor.py @@ -43,7 +43,7 @@ async def worker(ctx: WorkContext, tasks): yield script else: # Simulate some work - script.run("/bin/sleep", "5") + script.run("/bin/sleep", "1") yield script task.accept_result() @@ -51,7 +51,7 @@ async def worker(ctx: WorkContext, tasks): async with Golem( budget=10.0, subnet_tag="goth", - payment_network="rinkeby", + payment_network="holesky", ) as golem: tasks = [Task(data=n) for n in range(6)] async for task in golem.execute_tasks( diff --git a/tests/goth_tests/test_agreement_termination/test_agreement_termination.py b/tests/goth_tests/test_agreement_termination/test_agreement_termination.py index 3ac8bf373..58ec70820 100644 --- a/tests/goth_tests/test_agreement_termination/test_agreement_termination.py +++ b/tests/goth_tests/test_agreement_termination/test_agreement_termination.py @@ -88,7 +88,7 @@ async def test_agreement_termination( # Wait for worker failure due to command error assertion = cmd_monitor.add_assertion(assert_command_error) - agr_id = await assertion.wait_for_result(timeout=60) + agr_id = await assertion.wait_for_result(timeout=120) logger.info("Detected command error in activity for agreement %s", agr_id) # Make sure no new tasks are sent and the agreement is terminated @@ -96,8 +96,8 @@ async def test_agreement_termination( partial(assert_agreement_cancelled, agr_id), name=f"assert_agreement_cancelled({agr_id})", ) - await assertion.wait_for_result(timeout=10) + await assertion.wait_for_result(timeout=20) # Wait for executor shutdown - await cmd_monitor.wait_for_pattern("ShutdownFinished", timeout=60) + await cmd_monitor.wait_for_pattern("ShutdownFinished", timeout=120) logger.info("Requestor script finished") diff --git a/tests/goth_tests/test_async_task_generation/requestor.py b/tests/goth_tests/test_async_task_generation/requestor.py index cb7c45828..579c79656 100755 --- a/tests/goth_tests/test_async_task_generation/requestor.py +++ b/tests/goth_tests/test_async_task_generation/requestor.py @@ -29,7 +29,7 @@ async def worker(work_ctx, tasks): budget=10.0, subnet_tag="goth", event_consumer=log_event_repr, - payment_network="rinkeby", + payment_network="holesky", ) as golem: # We use an async task generator that yields tasks removed from # an async queue. Each computed task will potentially spawn diff --git a/tests/goth_tests/test_concurrent_executors/requestor.py b/tests/goth_tests/test_concurrent_executors/requestor.py index 66192f06f..ccf0582d7 100755 --- a/tests/goth_tests/test_concurrent_executors/requestor.py +++ b/tests/goth_tests/test_concurrent_executors/requestor.py @@ -50,7 +50,7 @@ async def duplicator(work_ctx, tasks): output = result.stdout.strip() task.accept_result(output) - async with Golem(budget=1.0, subnet_tag="goth", payment_network="rinkeby") as golem: + async with Golem(budget=1.0, subnet_tag="goth", payment_network="holesky") as golem: # Construct a pipeline: # # input_tasks diff --git a/tests/goth_tests/test_instance_restart/requestor.py b/tests/goth_tests/test_instance_restart/requestor.py index 62b3a82b3..e4e51eddd 100755 --- a/tests/goth_tests/test_instance_restart/requestor.py +++ b/tests/goth_tests/test_instance_restart/requestor.py @@ -81,7 +81,7 @@ async def shutdown(self): async def main(): - async with Golem(budget=1.0, subnet_tag="goth", payment_network="rinkeby") as golem: + async with Golem(budget=1.0, subnet_tag="goth", payment_network="holesky") as golem: # Start a cluster with a single service. # The first instance will fail before reaching the `running` state # due to an error. Another instance should be spawned in its place. diff --git a/tests/goth_tests/test_mid_agreement_payments/requestor_agent.py b/tests/goth_tests/test_mid_agreement_payments/requestor_agent.py index ad469e9d8..a2db78095 100755 --- a/tests/goth_tests/test_mid_agreement_payments/requestor_agent.py +++ b/tests/goth_tests/test_mid_agreement_payments/requestor_agent.py @@ -42,7 +42,7 @@ async def main(): strategy=ShortDebitNoteIntervalAndPaymentTimeout(), subnet_tag="goth", event_consumer=log_event_repr, - payment_network="rinkeby", + payment_network="holesky", ) as golem: logger = logging.getLogger("yapapi") logger.handlers[0].setLevel(logging.DEBUG) diff --git a/tests/goth_tests/test_multiactivity_agreement/requestor.py b/tests/goth_tests/test_multiactivity_agreement/requestor.py index 19a9e018d..ca97ee451 100755 --- a/tests/goth_tests/test_multiactivity_agreement/requestor.py +++ b/tests/goth_tests/test_multiactivity_agreement/requestor.py @@ -29,7 +29,7 @@ async def worker(work_ctx, tasks): budget=10.0, subnet_tag="goth", event_consumer=log_event_repr, - payment_network="rinkeby", + payment_network="holesky", ) as golem: tasks = [Task(data=n) for n in range(3)] async for task in golem.execute_tasks( diff --git a/tests/goth_tests/test_power_outage.py b/tests/goth_tests/test_power_outage.py index 9189c085f..caf7a20cf 100644 --- a/tests/goth_tests/test_power_outage.py +++ b/tests/goth_tests/test_power_outage.py @@ -60,8 +60,7 @@ async def test_power_outage( provider_1 = runner.get_probes(probe_type=ProviderProbe)[0] async with requestor.run_command_on_host( - "{} --subnet-tag goth --min-cpu-threads 1 " - "--payment-network rinkeby --log-file {}".format( + "{} --subnet-tag goth --min-cpu-threads 1 --log-file {}".format( blender_path, log_dir / "test_power_outage.log" ), env=os.environ, diff --git a/tests/goth_tests/test_recycle_ip/ssh_recycle_ip.py b/tests/goth_tests/test_recycle_ip/ssh_recycle_ip.py index e7e162af6..c6fc9a96f 100755 --- a/tests/goth_tests/test_recycle_ip/ssh_recycle_ip.py +++ b/tests/goth_tests/test_recycle_ip/ssh_recycle_ip.py @@ -59,7 +59,7 @@ async def main(): async with Golem( budget=1.0, subnet_tag="goth", - payment_network="rinkeby", + payment_network="holesky", ) as golem: network = await golem.create_network("192.168.0.1/24") proxy = SocketProxy(ports=[2222]) diff --git a/tests/goth_tests/test_run_blender.py b/tests/goth_tests/test_run_blender.py index 8a7671332..9574ec5c7 100644 --- a/tests/goth_tests/test_run_blender.py +++ b/tests/goth_tests/test_run_blender.py @@ -52,7 +52,7 @@ async def test_run_blender( requestor = runner.get_probes(probe_type=RequestorProbe)[0] async with requestor.run_command_on_host( - f"{blender_path} --subnet-tag goth --min-cpu-threads 1 --payment-network rinkeby", + f"{blender_path} --subnet-tag goth --min-cpu-threads 1", env=os.environ, ) as (_cmd_task, cmd_monitor, _process_monitor): # Add assertions to the command output monitor `cmd_monitor`: diff --git a/tests/goth_tests/test_run_custom_usage_counter.py b/tests/goth_tests/test_run_custom_usage_counter.py index 6a2c566d4..cd473eb02 100644 --- a/tests/goth_tests/test_run_custom_usage_counter.py +++ b/tests/goth_tests/test_run_custom_usage_counter.py @@ -86,8 +86,7 @@ async def test_run_custom_usage_counter( requestor = runner.get_probes(probe_type=RequestorProbe)[0] async with requestor.run_command_on_host( - f"{requestor_path} --running-time {RUNNING_TIME} " - f"--subnet-tag {SUBNET_TAG} --payment-network rinkeby", + f"{requestor_path} --running-time {RUNNING_TIME} --subnet-tag {SUBNET_TAG}", env=os.environ, ) as (_cmd_task, cmd_monitor, _process_monitor): cmd_monitor.add_assertion(assert_no_errors) diff --git a/tests/goth_tests/test_run_scan.py b/tests/goth_tests/test_run_scan.py index 9d14f342d..95a56a220 100644 --- a/tests/goth_tests/test_run_scan.py +++ b/tests/goth_tests/test_run_scan.py @@ -45,7 +45,7 @@ async def test_run_scan( requestor = runner.get_probes(probe_type=RequestorProbe)[0] async with requestor.run_command_on_host( - f"{requestor_path} --subnet-tag {SUBNET_TAG} --scan-size 3 --payment-network rinkeby", + f"{requestor_path} --subnet-tag {SUBNET_TAG} --scan-size 3", env=os.environ, ) as (_cmd_task, cmd_monitor, process_monitor): cmd_monitor.add_assertion(assert_no_errors) diff --git a/tests/goth_tests/test_run_simple_service.py b/tests/goth_tests/test_run_simple_service.py index 1e3abf62c..d88c02206 100644 --- a/tests/goth_tests/test_run_simple_service.py +++ b/tests/goth_tests/test_run_simple_service.py @@ -44,8 +44,7 @@ async def test_run_simple_service( requestor = runner.get_probes(probe_type=RequestorProbe)[0] async with requestor.run_command_on_host( - f"{requestor_path} --running-time {RUNNING_TIME} " - f"--subnet-tag {SUBNET_TAG} --payment-network rinkeby", + f"{requestor_path} --running-time {RUNNING_TIME} --subnet-tag {SUBNET_TAG}", env=os.environ, ) as (_cmd_task, cmd_monitor, _process_monitor): start_time = time.time() diff --git a/tests/goth_tests/test_run_ssh.py b/tests/goth_tests/test_run_ssh.py index 9a6f844fc..9c314db20 100644 --- a/tests/goth_tests/test_run_ssh.py +++ b/tests/goth_tests/test_run_ssh.py @@ -62,7 +62,7 @@ async def test_run_ssh( requestor = runner.get_probes(probe_type=RequestorProbe)[0] async with requestor.run_command_on_host( - f"{requestor_path} --subnet-tag {SUBNET_TAG} --payment-network rinkeby", + f"{requestor_path} --subnet-tag {SUBNET_TAG}", env=os.environ, ) as (_cmd_task, cmd_monitor, process_monitor): start_time = time.time() diff --git a/tests/goth_tests/test_run_webapp.py b/tests/goth_tests/test_run_webapp.py index 2bace1470..979bf83de 100644 --- a/tests/goth_tests/test_run_webapp.py +++ b/tests/goth_tests/test_run_webapp.py @@ -58,7 +58,7 @@ async def test_run_webapp( requestor = runner.get_probes(probe_type=RequestorProbe)[0] async with requestor.run_command_on_host( - f"{requestor_path} --subnet-tag {SUBNET_TAG} --port {port} --payment-network rinkeby", + f"{requestor_path} --subnet-tag {SUBNET_TAG} --port {port}", env=os.environ, ) as (_cmd_task, cmd_monitor, process_monitor): start_time = time.time() diff --git a/tests/goth_tests/test_run_yacat.py b/tests/goth_tests/test_run_yacat.py index c28859bed..922ad9877 100644 --- a/tests/goth_tests/test_run_yacat.py +++ b/tests/goth_tests/test_run_yacat.py @@ -64,7 +64,7 @@ async def test_run_yacat( async with requestor.run_command_on_host( f"{yacat_path} --mask ?a?a --hash $P$5ZDzPE45CigTC6EY4cXbyJSLj/pGee0 " f"--subnet-tag goth --chunk-size {CHUNK_SIZE} --max-workers {PROVIDER_COUNT} " - f"--log-file {(log_dir / logfile).resolve()} --payment-network rinkeby", + f"--log-file {(log_dir / logfile).resolve()}", env=os.environ, ) as (_cmd_task, cmd_monitor, _process_monitor): # Add assertions to the command output monitor `cmd_monitor`: