You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I use dockertest/v3 extensively in my testing of api servers in go.
I am getting to the point where I want to do more interesting things the backing mongodb database (e.g. change streams, transactions) and still would like to containerize the mongo instance for tests. I feel like I'm close to figuring this out but I'd like to successfully run rs.initiate() inside the mongodb container after creating the test resource, but have been running into issues successfully using the resource.Exec function.
Describe your ideal solution
Spin up a mongodb container, programmatically in go, with replica set configuration and execute the rs.initiate() command so that the repl set is connectable in code. Was hoping something like this would work:
While troubleshooting, I have tried removing the "pipe to mongo shell" at first with no success, so I think I am just going about resource.Exec incorrectly here.
When calling: .Exec([]string{echo "rs.initiate().ok || rs.status().ok"}, I see output:
OCI runtime exec failed: exec failed: unable to start container process: exec: "echo \"rs.initiate().ok || rs.status().ok\"": executable file not found in $PATH: unknown
When adding "/bin/bash" in front: Exec([]string{"/bin/bash", echo "rs.initiate().ok || rs.status().ok"}:
/bin/bash: echo"rs.initiate().ok || rs.status().ok": No such file or directory
Version
github.com/ory/dockertest/v3 v3.10.0
Additional Context
No response
The text was updated successfully, but these errors were encountered:
Preflight checklist
Ory Network Project
No response
Describe your problem
I use
dockertest/v3
extensively in my testing of api servers ingo
.I am getting to the point where I want to do more interesting things the backing
mongodb
database (e.g. change streams, transactions) and still would like to containerize themongo
instance for tests. I feel like I'm close to figuring this out but I'd like to successfully runrs.initiate()
inside themongodb
container after creating the test resource, but have been running into issues successfully using theresource.Exec
function.Describe your ideal solution
Spin up a
mongodb
container, programmatically ingo
, with replica set configuration and execute thers.initiate()
command so that the repl set is connectable in code. Was hoping something like this would work:Workarounds or alternatives
While troubleshooting, I have tried removing the "pipe to mongo shell" at first with no success, so I think I am just going about
resource.Exec
incorrectly here.When calling:
.Exec([]string{
echo "rs.initiate().ok || rs.status().ok"}
, I see output:When adding
"/bin/bash"
in front:Exec([]string{"/bin/bash",
echo "rs.initiate().ok || rs.status().ok"}
:Version
github.com/ory/dockertest/v3 v3.10.0
Additional Context
No response
The text was updated successfully, but these errors were encountered: