forked from adamlaska/machine
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathswarm-options.bats
More file actions
55 lines (45 loc) · 1.64 KB
/
swarm-options.bats
File metadata and controls
55 lines (45 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/usr/bin/env bats
load ${BASE_TEST_DIR}/helpers.bash
export TOKEN=$(curl -sS -X POST "https://discovery.hub.docker.com/v1/clusters")
@test "create swarm master" {
run machine create -d $DRIVER --swarm --swarm-master --swarm-discovery "token://$TOKEN" --swarm-strategy binpack --swarm-opt heartbeat=5s queenbee
echo ${output}
[[ "$status" -eq 0 ]]
}
@test "create swarm node" {
run machine create -d $DRIVER --swarm --swarm-discovery "token://$TOKEN" workerbee
[[ "$status" -eq 0 ]]
}
@test "ensure strategy is correct" {
strategy=$(docker $(machine config --swarm queenbee) info | grep "Strategy:" | awk '{ print $2 }')
echo ${strategy}
[[ "$strategy" == "binpack" ]]
}
@test "ensure heartbeat" {
heartbeat_arg=$(docker $(machine config queenbee) inspect -f '{{index .Args}}' swarm-agent-master)
echo ${heartbeat_arg}
[[ "$heartbeat_arg" =~ "--heartbeat=5s" ]]
}
@test "ls command should not show as swarm active if normal active" {
eval $(machine env queenbee)
run machine ls --filter name=queenbee
[[ ${lines[1]} != *"* (swarm)"* ]]
}
@test "ls command should show as swarm active" {
eval $(machine env --swarm queenbee)
run machine ls --filter name=queenbee
echo ${output}
[[ ${lines[1]} == *"* (swarm)"* ]]
}
@test "active command should show the host as active if normal active" {
eval $(machine env queenbee)
run machine active
echo ${output}
[[ ${lines[0]} == "queenbee" ]]
}
@test "active command should show the host as active if swarm active" {
eval $(machine env --swarm queenbee)
run machine active
echo ${output}
[[ ${lines[0]} == "queenbee" ]]
}