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

Testing: Use unique names when running multiple test container instances #114

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

amotl
Copy link
Contributor

@amotl amotl commented Feb 9, 2024

About

When running multiple instances of CrateDBTestAdapter on behalf of software tests at GH-113, the process stalls, and times out.

___________________ ERROR at setup of test_cratedb_service ___________________

    @pytest.fixture(scope="session")
    def cratedb_service() -> Generator[CrateDBTestAdapter, None, None]:
        """
        Provide a CrateDB service instance to the test suite.
        """
        db = CrateDBTestAdapter()
>       db.start()

cratedb_toolkit/testing/pytest.py:14:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cratedb_toolkit/testing/testcontainers/cratedb.py:178: in start
    self.database = DatabaseAdapter(dburi=self.get_connection_url())
cratedb_toolkit/testing/testcontainers/cratedb.py:200: in get_connection_url
    return self.cratedb.get_connection_url(*args, **kwargs)
cratedb_toolkit/testing/testcontainers/cratedb.py:144: in get_connection_url
    return super()._create_connection_url(
.venv/lib/python3.11/site-packages/testcontainers/core/generic.py:44: in _create_connection_url
    port = self.get_exposed_port(port)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

wrapped = <bound method DockerContainer.get_exposed_port of <cratedb_toolkit.testing.testcontainers.cratedb.CrateDBContainer object at 0x1233b0a90>>
instance = <cratedb_toolkit.testing.testcontainers.cratedb.CrateDBContainer object at 0x1233b0a90>, args = (4200,), kwargs = {}

    @wrapt.decorator
    def wrapper(wrapped, instance, args, kwargs):
        exception = None
        logger.info("Waiting to be ready...")
        for attempt_no in range(config.MAX_TRIES):
            try:
                return wrapped(*args, **kwargs)
            except transient_exceptions as e:
                logger.debug(f"Connection attempt '{attempt_no + 1}' of '{config.MAX_TRIES + 1}' "
                             f"failed: {traceback.format_exc()}")
                time.sleep(config.SLEEP_TIME)
                exception = e
>       raise TimeoutException(
            f'Wait time ({config.MAX_TRIES * config.SLEEP_TIME}s) exceeded for {wrapped.__name__}'
            f'(args: {args}, kwargs {kwargs}). Exception: {exception}'
        )
E       testcontainers.core.exceptions.TimeoutException: Wait time (120s) exceeded for get_exposed_port(args: (4200,), kwargs {}). Exception: port mapping for container d6aa8f92b128a39110957619f56ad071c5562384a9c91fec3adc4112ce3d7104 and port 4200 is not available

.venv/lib/python3.11/site-packages/testcontainers/core/waiting_utils.py:55: TimeoutException

Copy link

codecov bot commented Feb 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (3a8e9bf) 84.82% compared to head (224bba5) 66.85%.

Additional details and impacted files
@@             Coverage Diff             @@
##             main     #114       +/-   ##
===========================================
- Coverage   84.82%   66.85%   -17.98%     
===========================================
  Files          48       48               
  Lines        1812     1813        +1     
===========================================
- Hits         1537     1212      -325     
- Misses        275      601      +326     
Flag Coverage Δ
influxdb ?
main 66.85% <100.00%> (+0.01%) ⬆️
mongodb ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant