testcontainers-go icon indicating copy to clipboard operation
testcontainers-go copied to clipboard

[Documentation]: document volumes and mounts

Open mdelapenya opened this issue 1 year ago • 8 comments

Proposal

They are not properly documented in our docs

mdelapenya avatar Jan 25 '24 10:01 mdelapenya

This seemed like a good place to remark on my experience in the last couple of days with mounts, as a testcontainers-go user.

My bind mounts quietly stopped working when I upgraded from 0.26.0 to 0.27.0, for some reason I couldn't figure out (the deprecation of bind mounts in testcontainers wasn't supposed to break them). So, I switched over to volumes instead. That created a lot more pain, since our CI system got overrun with volumes. As it turned out, named volumes don't get cleaned up by ryuk, so they stuck around indefinitely. The testcontainers-go API makes it really tempting to set a non-empty name for volumes, but the consequences of that are quite bad.

Anyway, yeah, more documentation on this stuff would be great :).

Also, there was some quite misleading logging in place as of when bind mounts were deprecated, and I made a PR to improve that. https://github.com/testcontainers/testcontainers-go/pull/2178/files

srabraham avatar Jan 30 '24 19:01 srabraham

@srabraham thanks for raising your voice on this issue. I do appreciate your feedback.

My bind mounts quietly stopped working when I upgraded from 0.26.0 to 0.27.0, for some reason I couldn't figure out (the deprecation of bind mounts in testcontainers wasn't supposed to break them)

I'm interested in this. Could you share a repo where it happened? As you pointed out, they should not break any client code as per the deprecation, although I could have committed a mistake during the deprecation path.

named volumes don't get cleaned up by ryuk

Did you manually created the volumes? If not I'd expect testcontainers-go to label the volumes accordingly, so that Ryuk prunes them. Could you run Ryuk in verbose mode, so you're be able to check what volumes are pruned?: https://github.com/testcontainers/moby-ryuk/blob/430d3338e3af80816a0a7445a90b4a1e58b1c710/main.go#L330-L337.

In order to do so: https://golang.testcontainers.org/features/configuration/#customizing-ryuk-the-resource-reaper. Since v0.27.0 it's possible to run Ryuk in verbose mode.

The testcontainers-go API makes it really tempting to set a non-empty name

Mmmm could you share how did you create the volumes? I think this answers my previous question so you probably used the API. I'm interested in how so I can double check and identify where the experience is broken.

mdelapenya avatar Jan 31 '24 12:01 mdelapenya

Regarding bind mount breakage at 0.27.0, I made a separate bug report here with a very simple reproduction: https://github.com/testcontainers/testcontainers-go/issues/2179

srabraham avatar Jan 31 '24 17:01 srabraham

and here's a demo of named volumes not getting deleted by ryuk: https://github.com/srabraham/demovolume/blob/main/main.go

srabraham avatar Jan 31 '24 17:01 srabraham

@mdelapenya in case you missed it, please have a look at my additional demo above (https://github.com/testcontainers/testcontainers-go/issues/2163#issuecomment-1919561727), which shows how named volumes don't get cleaned up by Ryuk.

srabraham avatar Feb 01 '24 23:02 srabraham

@mdelapenya in case you missed it, please have a look at my additional demo above (#2163 (comment)), which shows how named volumes don't get cleaned up by Ryuk.

I think we should open a bug in https://github.com/testcontainers/moby-ryuk

mdelapenya avatar Feb 01 '24 23:02 mdelapenya

@srabraham here it's the fix https://github.com/testcontainers/testcontainers-go/pull/2191

mdelapenya avatar Feb 01 '24 23:02 mdelapenya

Awesome, thanks!

srabraham avatar Feb 02 '24 00:02 srabraham