hashicorp / vault

A tool for secrets management, encryption as a service, and privileged access management
https://www.vaultproject.io/
Other
31.08k stars 4.2k forks source link

About #8948 #10430

Closed Nayana-ibm closed 3 years ago

Nayana-ibm commented 3 years ago

This is with reference to https://github.com/hashicorp/vault/pull/8948/ I could see that for test execution the code from docker/testhelpers.go has changed through this commit. Like dockertest.NewPool etc. routines has removed and new functionality added NewServiceRunner.

In v1.5.5, I can connect to docker running on another host with port 2375 by changing code in prepareCassandraTestContainer as

pool, err := dockertest.NewPool("tcp://<ip>:2375") 
address := fmt.Sprintf("<ip>:%d", port)

However in v1.6.0 new functionality is added. I tried changing default parameters in kept client/client_unix.go but doesn't help. Could you please let me know if anything more needs to be configured here?

ncabatoff commented 3 years ago

Hi @Nayana-ibm,

Could you give me more context please? Why do you want to run the test with a different Cassandra instance than the one it starts?

I'm guessing you want to do something like what we do here: https://github.com/hashicorp/vault/blob/master/builtin/logical/nomad/backend_test.go#L31 such that if an environment variable is set we take the Cassandra address from that instead of starting a docker container.

Nayana-ibm commented 3 years ago

@ncabatoff Thank you for insights.

Hi @Nayana-ibm,

Could you give me more context please? Why do you want to run the test with a different Cassandra instance than the one it starts?

I am executing tests on s390x vm where docker image for cassandra is not available. So, just to check test passing if we connect to amd64 vm where docker is running and cassandra image is available ( docker container for cassandra instance).

I'm guessing you want to do something like what we do here: https://github.com/hashicorp/vault/blob/master/builtin/logical/nomad/backend_test.go#L31 such that if an environment variable is set we take the Cassandra address from that instead of starting a docker container.

Yes..this is also a way to do. however I was looking for starting a docker container on different host/vm.

ncabatoff commented 3 years ago

Oh, I misunderstood. You can get that effect already by setting env vars:

// DOCKER_HOST to set the url to the docker server.
// DOCKER_API_VERSION to set the version of the API to reach, leave empty for latest.
// DOCKER_CERT_PATH to load the TLS certificates from.
// DOCKER_TLS_VERIFY to enable or disable TLS verification, off by default.
Nayana-ibm commented 3 years ago

@ncabatoff Yes ..setting DOCKER_HOST helped. However additional change was required as adding docker host ip to routines like docker.NewServiceHostPort , runner.StartService. Could verify cassandra and influxdb testcases successfully .

Nayana-ibm commented 3 years ago

Got the required info. Thanks Closing the issue