-
-
Notifications
You must be signed in to change notification settings - Fork 201
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 support for fetching container logs from a given time #670
Add support for fetching container logs from a given time #670
Conversation
✅ Deploy Preview for testcontainers-node ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Hello! @javierlopezdeancos Can u please review my PR? |
Hello! @kiview Can u please review my PR? It's very simple |
Hey @NuShoSinkuPomogliTebeTvoiSankcii can you add some description or link the issue to get context and leave it track? |
@javierlopezdeancos |
Thanks to your clarification. is LGTM |
Thanks for submitting this PR @NuShoSinkuPomogliTebeTvoiSankcii , could you please update the PR description with the motivation for it (the same in your comment). We need discoverability for the future us when going back to the code, and for eventual readers to check why some code was introduced in the project. It's on us to update the PR template including certain sections, like "What does this PR do?" and "Why is it important?" (PTAL to other testcontainers projects) In the mean time, this PR looks good to me. Will merge it once the description is updated and the CI passes. Thanks! |
Oh I forgot! Could you please add a test demonstrating the new behaviour? 🙏 |
packages/testcontainers/src/container-runtime/clients/container/docker-container-client.ts
Outdated
Show resolved
Hide resolved
@mdelapenya thanks for your advice! Added tests and found out that I missed some logic (added it to docker-container-client). Also added description to my PR. |
@mdelapenya Can you also publish new library version to npm after my PR will be merged, please? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a few comments regarding the new opts variable.
Thanks!
packages/testcontainers/src/container-runtime/clients/container/docker-container-client.test.ts
Outdated
Show resolved
Hide resolved
packages/testcontainers/src/container-runtime/clients/container/docker-container-client.ts
Outdated
Show resolved
Hide resolved
packages/testcontainers/src/generic-container/generic-container-logs.test.ts
Outdated
Show resolved
Hide resolved
Hey @NuShoSinkuPomogliTebeTvoiSankcii I'm the maintainer of testcontainers-go, helping out with the maintenance of the NodeJS flavour while @cristianrgreco is on PTO. I can help with the big picture of the library, where @javierlopezdeancos can support me with the Typescript specifics. Said that, I'm afraid that we are going to slow down a bit the release cadence until we get more familiar with the codebase. But hopefully soon enough to see your changes released, for sure. So please be patient with us 🙏 |
packages/testcontainers/src/container-runtime/clients/container/docker-container-client.ts
Outdated
Show resolved
Hide resolved
packages/testcontainers/src/generic-container/generic-container-logs.test.ts
Outdated
Show resolved
Hide resolved
@javierlopezdeancos I reverted my changes with overriding options. Just passing options for since parameter – actually it's the only thing that I need for now. Also added test for this behaviour. Review it please. 🙏 |
@javierlopezdeancos I'm sorry for disturbing, but I will also be on leave (as @cristianrgreco 😄) after Friday for 2 weeks, so it will be nice to merge my PR before that date. |
Hi @NuShoSinkuPomogliTebeTvoiSankcii, thanks for raising the PR. I'd prefer not to expose the underlying Docker API (dockerode) in Testcontainers' public API. This way we do not proxy breaking changes from dockerode/Docker when they happen. I see from the test you want to add support for fetching logs since a certain time, so let's implement support just for that and update the docs to explain how to use it. If it is low level access to the Docker client you need, this PR will give you what you're after: #644 |
@cristianrgreco Hi! Done refactoring and docs. About low level access – I understand the problem with breaking changes. For example this PR. In my project I had to copy-paste this logic with dockerode interactions just to pass since parameter directly to dockerode container logs method. P.S. Glad to have you back! |
Thanks for the response @NuShoSinkuPomogliTebeTvoiSankcii. I think I understand your points, but I think this result is actually ideal: You identified a use case for fetching logs since a given time, you've raised a well documented PR with this behaviour, where a conflict when upgrading Dockerode results in a compile time error, which ensures we don't accidentally introduce breaking changes. Thanks to a level of indirection we can handle breaking changes in Dockerode without requiring changes from our users, IMO this is a win. If you think supporting tail/until is a common use case then please feel free to raise more PRs, but to date this has not been asked for. If raising a PR is an inconvenience then adding a couple of lines of code to get the underlying Docker client I think is a compromise worthwhile for not having breaking changes. The PR LGTM, than you for making the changes. I'll get this deployed shortly.
Thanks 🙂 |
Added ability to pass options to dockerode logs API for StartedContainer.
I need it to pass since parameter for example.