add integration test for token discovery

Signed-off-by: Chanwit Kaewkasi <chanwit@gmail.com>
This commit is contained in:
Chanwit Kaewkasi 2015-05-04 22:25:16 +07:00
parent 89fe217e12
commit 6ecf51f458
1 changed files with 29 additions and 0 deletions

View File

@ -0,0 +1,29 @@
#!/usr/bin/env bats
load helpers
function token_cleanup() {
curl -X DELETE https://discovery-stage.hub.docker.com/v1/clusters/$1
}
function teardown() {
swarm_join_cleanup
swarm_manage_cleanup
stop_docker
}
@test "token discovery should be working properly" {
start_docker 2
TOKEN=$(swarm create)
[ "$status" -eq 0 ]
[[ ${TOKEN} =~ ^[0-9a-f]{32}$ ]]
swarm_manage token://$TOKEN
swarm_join token://$TOKEN
run docker_swarm info
[[ "${lines[3]}" == *"Nodes: 2"* ]]
token_cleanup $TOKEN
}