Skip to content

Commit 35cd5aa

Browse files
committed
Added docker+cluster+local+agencySize=1 test
1 parent 7c56069 commit 35cd5aa

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

test/docker_cluster_local_test.go

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,65 @@ func TestDockerClusterLocal(t *testing.T) {
8686
ShutdownStarter(t, insecureStarterEndpoint(0))
8787
}
8888

89+
// TestDockerClusterLocalAgencySize1 runs the arangodb starter in docker
90+
// with `--starter.local` & `--cluster.agency-size=1`
91+
func TestDockerClusterLocalAgencySize1(t *testing.T) {
92+
needTestMode(t, testModeDocker)
93+
needStarterMode(t, starterModeCluster)
94+
if os.Getenv("IP") == "" {
95+
t.Fatal("IP envvar must be set to IP address of this machine")
96+
}
97+
/*
98+
docker volume create arangodb1
99+
docker run -i --name=adb1 --rm -p 8528:8528 \
100+
-v arangodb1:/data \
101+
-v /var/run/docker.sock:/var/run/docker.sock \
102+
arangodb/arangodb-starter \
103+
--docker.container=adb1 \
104+
--starter.address=$IP \
105+
--starter.local \
106+
--cluster.agency-size=1
107+
*/
108+
volID := createDockerID("vol-starter-test-local-cluster-as1-")
109+
createDockerVolume(t, volID)
110+
defer removeDockerVolume(t, volID)
111+
112+
// Cleanup of left over tests
113+
removeDockerContainersByLabel(t, "starter-test=true")
114+
removeStarterCreatedDockerContainers(t)
115+
116+
start := time.Now()
117+
118+
cID := createDockerID("starter-test-local-cluster-as1-")
119+
dockerRun := Spawn(t, strings.Join([]string{
120+
"docker run -i",
121+
"--label starter-test=true",
122+
"--name=" + cID,
123+
"--rm",
124+
fmt.Sprintf("-p %d:%d", basePort, basePort),
125+
fmt.Sprintf("-v %s:/data", volID),
126+
"-v /var/run/docker.sock:/var/run/docker.sock",
127+
"arangodb/arangodb-starter",
128+
"--docker.container=" + cID,
129+
"--starter.address=$IP",
130+
"--starter.local",
131+
"--cluster.agency-size=1",
132+
createEnvironmentStarterOptions(),
133+
}, " "))
134+
defer dockerRun.Close()
135+
defer removeDockerContainer(t, cID)
136+
137+
if ok := WaitUntilStarterReady(t, whatCluster, dockerRun); ok {
138+
t.Logf("Cluster start took %s", time.Since(start))
139+
testCluster(t, insecureStarterEndpoint(0), false)
140+
}
141+
142+
if isVerbose {
143+
t.Log("Waiting for termination")
144+
}
145+
ShutdownStarter(t, insecureStarterEndpoint(0))
146+
}
147+
89148
// TestOldDockerClusterLocal runs the arangodb starter in docker with `--local`
90149
func TestOldDockerClusterLocal(t *testing.T) {
91150
needTestMode(t, testModeDocker)

0 commit comments

Comments
 (0)