Serialization of a started container so its class can be recreated (eg. in another thread). #1167
Replies: 1 comment 5 replies
-
|
Hi @PieterJanVdb, in what way is this different from the Essentially if you start a container with Unless I've misunderstood something, even more simply, if you use vitest's |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I've just implemented some functionality whereby we provision a pool of running postgresql testcontainers in the global setup of vitest so that each worker (fork in this case) has its own running, singleton database. Because the global setup and the test suites itself run in different contexts, I had to create some kind of serializable description of the running testcontainers:
We could then make use of this 'description' inside a test suite, by first recreating a
StartedGenericContainerand then aStartedPostgreSqlContainerwith the serializable description:This all works fine expect for the somewhat hacky way of creating the
boundPortsand manually calling inspect on the container instance, but I was wondering if it would be a good idea to include some functionality in the library to achieve this more easily without having to manually recreate all required arguments to the container constructors.Beta Was this translation helpful? Give feedback.
All reactions