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

Add OneShotWaitStrategy #730

Merged
merged 10 commits into from
Apr 15, 2024

Conversation

omerlh
Copy link
Contributor

@omerlh omerlh commented Mar 17, 2024

No description provided.

Copy link

netlify bot commented Mar 17, 2024

Deploy Preview for testcontainers-node ready!

Name Link
🔨 Latest commit c228531
🔍 Latest deploy log https://app.netlify.com/sites/testcontainers-node/deploys/661d33b8b3bd810007415f3e
😎 Deploy Preview https://deploy-preview-730--testcontainers-node.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@cristianrgreco
Copy link
Collaborator

cristianrgreco commented Mar 17, 2024

@omerlh I think the issue is that the container runtime strategy is injected into the wait strategy before it is initialised. There is a complexity in that the runtime initialisation is lazy, and a user defines their wait strategy before any container is started. I reckon you want to get the container runtime strategy in the wait strategy itself instead of passing it in.

@cristianrgreco cristianrgreco added enhancement New feature or request minor Backward compatible functionality labels Mar 17, 2024
@omerlh
Copy link
Contributor Author

omerlh commented Mar 17, 2024

I wasn't sure - I tried following the docs on creating a wait strategy that needs the container client, but seemed weird to me I need to pass it on the ctor. I guess you are saying I should not use StartupCheckStrategy here? Use AbstractWaitStrategy like log-wait-startegy?

@omerlh
Copy link
Contributor Author

omerlh commented Mar 17, 2024

I let myself change StartupCheckStrategy to get the container runtime only when checking but it is still failing with the same error...

@cristianrgreco
Copy link
Collaborator

I guess you are saying I should not use StartupCheckStrategy here? Use AbstractWaitStrategy like log-wait-startegy?

Yes that's right

@omerlh
Copy link
Contributor Author

omerlh commented Mar 20, 2024

So look at my latest changes - I think I did that, but it still failing...

@cristianrgreco cristianrgreco changed the title feat: one shot wait startegy Add OneShotWaitStrategy Apr 3, 2024
@omerlh omerlh marked this pull request as ready for review April 3, 2024 15:40
@cristianrgreco
Copy link
Collaborator

Could you please add an example in the wait strategies doc?

@cristianrgreco
Copy link
Collaborator

Tests are failing:

FAIL packages/testcontainers/src/wait-strategies/startup-check-strategy.test.ts
  ● Test suite failed to run

    packages/testcontainers/src/wait-strategies/startup-check-strategy.test.ts:26:8 - error TS2554: Expected 0 arguments, but got 1.

    26     })(client);
              ~~~~~~
    packages/testcontainers/src/wait-strategies/startup-check-strategy.test.ts:40:8 - error TS2554: Expected 0 arguments, but got 1.

    40     })(client);
              ~~~~~~
    packages/testcontainers/src/wait-strategies/startup-check-strategy.test.ts:58:8 - error TS2554: Expected 0 arguments, but got 1.

    58     })(client);

@omerlh
Copy link
Contributor Author

omerlh commented Apr 7, 2024

Sure, I think I fixed both!

@cristianrgreco cristianrgreco merged commit 0bc8c42 into testcontainers:main Apr 15, 2024
4 checks passed
@omerlh omerlh deleted the feat/one-shot-startegy branch April 16, 2024 05:25
@omerlh
Copy link
Contributor Author

omerlh commented Apr 16, 2024

Thanks for merging!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request minor Backward compatible functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants