Testcontainers execInContainer Not Working with Cockroachdb
I'm Using Testcontainers to Start a Cockroachdb Instance with Docker. I Need to Enable Support for Temporary Tables by Setting the Property Sql. Defaults...
I'm using Testcontainers to start a CockroachDB instance with docker.
I need to enable support for temporary tables by setting the property sql.defaults.experimental_temporary_tables.enabled to true.
When the machine is running, I can do it with:
docker exec -it CockroachDBHibernate ./cockroach sql --insecure -e "SET CLUSTER SETTING sql.defaults.experimental_temporary_tables.enabled = 'true';"
But when I try to run the same command with Testcontainers:
container.execInContainer(
"./cockroach sql --insecure -e \"SET CLUSTER SETTING sql.defaults.experimental_temporary_tables.enabled = 'true';\"" );
I have the following error:
OCI runtime exec failed: exec failed: container_linux.go:370: starting container process caused: exec: "./cockroach sql --insecure -e \"SET CLUSTER SETTING sql.defaults.experimental_temporary_tables.enabled = 'true';\"": stat ./cockroach sql --insecure -e "SET CLUSTER SETTING sql.defaults.experimental_temporary_tables.enabled = 'true';": no such file or directory: unknown
Note that the error is visible via Container.ExecResult#getStdout().
Exit code is 126
I'm using Testcontainers 1.15.2 and CockroachDB v20.2.5
Thanks
1 Answer
container.execInContainer( "sh", "-c", "./cockroach sql --insecure -e \"SET CLUSTER SETTING sql.defaults.experimental_temporary_tables.enabled = 'true';\"" );