@@ -34,16 +34,16 @@ func testImpl(impl string) (err error) {
3434 // Implementations that require a separate service
3535
3636 var dockerImage string
37- dockerCmd := "docker run -d --rm"
37+ dockerCmd := "docker run -d --rm --name gokv- "
3838 var setup func () error
3939 // TODO: Check quoting on Windows
4040 switch impl {
4141 case "cockroachdb" :
4242 dockerImage = "cockroachdb/cockroach"
43- dockerCmd += ` --name cockroachdb -p 26257:26257 --health-cmd='curl -f http://localhost:8080/health?ready=1' ` + dockerImage + ` start-single-node --insecure`
43+ dockerCmd += `cockroachdb -p 26257:26257 --health-cmd='curl -f http://localhost:8080/health?ready=1' ` + dockerImage + ` start-single-node --insecure`
4444 setup = func () error {
4545 var out string
46- out , err = script .Exec (`docker exec cockroachdb bash -c './cockroach sql --insecure --execute="create database gokv;"'` ).String ()
46+ out , err = script .Exec (`docker exec gokv- cockroachdb bash -c './cockroach sql --insecure --execute="create database gokv;"'` ).String ()
4747 if err != nil {
4848 // Print the output here, as it could be more info than what's in err.
4949 fmt .Println (out )
@@ -53,43 +53,43 @@ func testImpl(impl string) (err error) {
5353 }
5454 case "consul" :
5555 dockerImage = "bitnami/consul"
56- dockerCmd += ` --name consul -e CONSUL_LOCAL_CONFIG='{"limits":{"http_max_conns_per_client":1000}}' -p 8500:8500 ` + dockerImage
56+ dockerCmd += `consul -e CONSUL_LOCAL_CONFIG='{"limits":{"http_max_conns_per_client":1000}}' -p 8500:8500 ` + dockerImage
5757 case "datastore" : // Google Cloud Datastore via "Cloud Datastore Emulator"
5858 // Using the ":slim" or ":alpine" tag would require the emulator to be installed manually.
5959 // Both ways seem to be okay for setting the project: `-e CLOUDSDK_CORE_PROJECT=gokv` and CLI parameter `--project=gokv`
6060 // `--host-port` is required because otherwise the server only listens on localhost IN the container.
6161 dockerImage = "google/cloud-sdk"
62- dockerCmd += ` --name datastore -p 8081:8081 ` + dockerImage + ` gcloud beta emulators datastore start --no-store-on-disk --project=gokv --host-port=0.0.0.0:8081`
62+ dockerCmd += `datastore -p 8081:8081 ` + dockerImage + ` gcloud beta emulators datastore start --no-store-on-disk --project=gokv --host-port=0.0.0.0:8081`
6363 case "dynamodb" : // DynamoDB via "DynamoDB local"
6464 dockerImage = "amazon/dynamodb-local"
65- dockerCmd += ` --name dynamodb-local -p 8000:8000 ` + dockerImage
65+ dockerCmd += `dynamodb-local -p 8000:8000 ` + dockerImage
6666 case "etcd" :
6767 dockerImage = "bitnami/etcd"
68- dockerCmd += ` --name etcd -p 2379:2379 --env ALLOW_NONE_AUTHENTICATION=yes --health-cmd='etcdctl endpoint health' ` + dockerImage
68+ dockerCmd += `etcd -p 2379:2379 --env ALLOW_NONE_AUTHENTICATION=yes --health-cmd='etcdctl endpoint health' ` + dockerImage
6969 case "hazelcast" :
7070 dockerImage = "hazelcast/hazelcast"
71- dockerCmd += ` --name hazelcast -p 5701:5701 --health-cmd='curl -f http://localhost:5701/hazelcast/health/node-state' ` + dockerImage
71+ dockerCmd += `hazelcast -p 5701:5701 --health-cmd='curl -f http://localhost:5701/hazelcast/health/node-state' ` + dockerImage
7272 case "ignite" :
7373 dockerImage = "apacheignite/ignite"
74- dockerCmd += ` --name ignite -p 10800:10800 --health-cmd='${IGNITE_HOME}/bin/control.sh --baseline | grep "Cluster state: active"' ` + dockerImage
74+ dockerCmd += `ignite -p 10800:10800 --health-cmd='${IGNITE_HOME}/bin/control.sh --baseline | grep "Cluster state: active"' ` + dockerImage
7575 case "memcached" :
7676 dockerImage = "memcached"
77- dockerCmd += ` --name memcached -p 11211:11211 ` + dockerImage
77+ dockerCmd += `memcached -p 11211:11211 ` + dockerImage
7878 case "mongodb" :
7979 dockerImage = "mongo"
80- dockerCmd += ` --name mongodb -p 27017:27017 --health-cmd='echo "db.runCommand({ ping: 1 }).ok" | mongosh localhost:27017/test --quiet' ` + dockerImage
80+ dockerCmd += `mongodb -p 27017:27017 --health-cmd='echo "db.runCommand({ ping: 1 }).ok" | mongosh localhost:27017/test --quiet' ` + dockerImage
8181 case "mysql" :
8282 dockerImage = "mysql"
83- dockerCmd += ` --name mysql -e MYSQL_ALLOW_EMPTY_PASSWORD=true -p 3306:3306 --health-cmd='mysqladmin ping -h localhost' ` + dockerImage
83+ dockerCmd += `mysql -e MYSQL_ALLOW_EMPTY_PASSWORD=true -p 3306:3306 --health-cmd='mysqladmin ping -h localhost' ` + dockerImage
8484 case "postgresql" :
8585 dockerImage = "postgres:alpine"
86- dockerCmd += ` --name postgres -e POSTGRES_PASSWORD=secret -e POSTGRES_DB=gokv -p 5432:5432 --health-cmd='pg_isready -U postgres' ` + dockerImage
86+ dockerCmd += `postgres -e POSTGRES_PASSWORD=secret -e POSTGRES_DB=gokv -p 5432:5432 --health-cmd='pg_isready -U postgres' ` + dockerImage
8787 case "redis" :
8888 dockerImage = "redis"
89- dockerCmd += ` --name redis -p 6379:6379 --health-cmd='redis-cli ping' ` + dockerImage
89+ dockerCmd += `redis -p 6379:6379 --health-cmd='redis-cli ping' ` + dockerImage
9090 case "s3" : // Amazon S3 via Minio
9191 dockerImage = "minio/minio"
92- dockerCmd += ` --name s3 -e "MINIO_ACCESS_KEY=AKIAIOSFODNN7EXAMPLE" -e "MINIO_SECRET_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY" -p 9000:9000 --health-cmd='mc ready local' ` + dockerImage + ` server /data`
92+ dockerCmd += `s3 -e "MINIO_ACCESS_KEY=AKIAIOSFODNN7EXAMPLE" -e "MINIO_SECRET_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY" -p 9000:9000 --health-cmd='mc ready local' ` + dockerImage + ` server /data`
9393 case "tablestorage" : // Tablestorage via Azurite
9494 // In the past there was this problem: https://github.com/Azure/Azurite/issues/121
9595 // With this Docker image:
@@ -100,7 +100,7 @@ func testImpl(impl string) (err error) {
100100 // Currently no emulator exists for Alibaba Cloud Table Store.
101101 case "zookeeper" :
102102 dockerImage = "zookeeper"
103- dockerCmd += ` --name zookeeper -p 2181:2181 -e ZOO_4LW_COMMANDS_WHITELIST=ruok --health-cmd='echo ruok | timeout 2 nc -w 2 localhost 2181 | grep imok' ` + dockerImage
103+ dockerCmd += `zookeeper -p 2181:2181 -e ZOO_4LW_COMMANDS_WHITELIST=ruok --health-cmd='echo ruok | timeout 2 nc -w 2 localhost 2181 | grep imok' ` + dockerImage
104104 default :
105105 return errors .New ("unknown `gokv.Store` implementation" )
106106 }
0 commit comments