Skip to content

Commit

Permalink
test_: cleanup all containers
Browse files Browse the repository at this point in the history
  • Loading branch information
fbarbu15 committed Jan 30, 2025
1 parent b17a2ec commit 82ca374
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion _assets/ci/Jenkinsfile.tests-rpc
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ pipeline {
cleanup {
script {
sh '''
docker ps -a --filter "name=status-go-func-tests-${BUILD_ID}" -q | xargs -r docker rm
docker ps -a --filter "name=status-go-func-tests-${BUILD_ID}" -q | xargs -r docker rm -f
make git-clean
'''
}
Expand Down
2 changes: 1 addition & 1 deletion _assets/scripts/run_functional_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ project_name="status-go-func-tests-${identifier}"
export STATUS_BACKEND_URLS=$(eval echo http://${project_name}-status-backend-{1..${STATUS_BACKEND_COUNT}}:3333 | tr ' ' ,)

# Remove orphans
docker ps -a --filter "status-go-func-tests-${identifier}" --filter "status=exited" -q | xargs -r docker rm
docker ps -a --filter "status-go-func-tests-${identifier}" --filter "status=exited" -q | xargs -r docker rm -f

# Run docker
echo -e "${GRN}Running tests${RST}, HEAD: $(git rev-parse HEAD)"
Expand Down
7 changes: 4 additions & 3 deletions tests-functional/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,9 @@ def pytest_configure(config):


@pytest.fixture(scope="function", autouse=True)
def close_status_backend_containers():
option.status_backend_containers = []
def close_status_backend_containers(request):
yield
if hasattr(request.node.instance, "reuse_container"):
return
for container in option.status_backend_containers:
container.kill()
container.kill() # type: ignore
5 changes: 5 additions & 0 deletions tests-functional/tests/test_cases.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def setup_method(self):

class StatusBackendTestCase:

reuse_container = True # Skip close_status_backend_containers cleanup
await_signals = [SignalType.NODE_LOGIN.value]

network_id = 31337
Expand All @@ -37,6 +38,10 @@ def setup_class(self):
self.rpc_client.restore_account_and_login()
self.rpc_client.wait_for_login()

def teardown_class(self):
for container in option.status_backend_containers:
container.kill()


class WalletTestCase(StatusBackendTestCase):

Expand Down

0 comments on commit 82ca374

Please sign in to comment.