Closed abayer closed 1 year ago
Hey @abayer did you manage to create a smaller reproduction case? I won't have time to look at this until Christmas break, so having that would help me a lot in clarifying what's going on.
@abayer , @mdelapenya
Need more info by issue. It is impossible to reproduce by that description.
@abayer , @mdelapenya
Need more info by issue. It is impossible to reproduce by that description.
Indeed. @abayer would you mind explaining it a little more what is the use case you described? Could it be that you are lacking container logs when running your own tests?
I'm closing this issue as stale. Please feel free to reopen if needed.
Thanks in advance
Describe the bug I started to move from using an already-running database to using postgres in a container via testcontainers-go, and when I did, the logs that normally stream to the console when I run
go test -v ./...
stopped showing up untilgo test
had completed. No=== RUN TestGetJVMVersionID
etc or anything until it finishes, and then thego test
logs all show up at once. This is the case whether I rungo test -v ./...
or add other flags like-run TestGetJVMVersionID
, etc, though interestingly when running individual tests in Goland, the logs do stream.To Reproduce So...I've tried to create a simple reproduction case, but I have not succeeded. The best I can do is point to the commit in my repo where this started happening - https://github.com/abayer/jenkins-usage-stats/commit/a30e0ecc77388fa36f563bf5442176297bbd4bf9. Note that
go test -v ./...
run against the previous commit requires the creation of a local database namedjenkins_usage_stats
and runningmake migration
or they'll fail so quickly you may not be able to tell whether the logs are streaming or just show up at the end. With that commit, you can just rungo test -v ./...
without any setup.Note that there were other things changed in that commit, but the
go.mod
changes are justgithub.com/beevik/etree
moving from an indirect to a directrequire
, and addinggithub.com/testcontainers/testcontainers-go
andgithub.com/golang-migrate/migrate/v4
. I've verified (by hacking the code around to remove allmigrate
usages and removing it fromgo.mod
) thatgithub.com/golang-migrate/migrate/v4
's presence or absence makes no difference to logs streaming.The testcontainers-go-related code is in https://github.com/abayer/jenkins-usage-stats/commit/a30e0ecc77388fa36f563bf5442176297bbd4bf9#diff-f8620f9dd4990ddb428e7f3e8ab587b56226b72e77ed1088892a98835f91e589, derived from https://brietsparks.com/testcontainers-golang-db-access/.
Expected behavior
go test -v ./...
to stream logs, rather than them only showing up on completion? =)docker info
Additional context I am using go1.17, though I have a feeling that won't make a difference, and have reproduced this on MacOS and Ubuntu 20.04. And yes, I know that my package layout is janky - I need to fix that. =) Also, I'll keep trying to put together a simpler, smaller reproduction case.