forked from docker-archive/classicswarm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapi_version.bats
31 lines (22 loc) · 857 Bytes
/
api_version.bats
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
#!/usr/bin/env bats
load helpers
function teardown() {
stop_docker
}
# Ensure that the client and server are running the same version.
#
# If this test is failing, it means that your test environment is misconfigured
# and your host CLI version differs from DOCKER_VERSION.
@test "api version" {
start_docker 1
# Get version output
out=$(docker -H "${HOSTS[0]}" version)
# Check client version
run bash -c "echo '$out' | egrep -i '^\s*Version'"
[ "$status" -eq 0 ]
[[ $(echo "${lines[0]}" | cut -d':' -f2 | awk -F' ' '{print $1}') == $(echo "${lines[1]}" | cut -d':' -f2 | awk -F' ' '{print $1}') ]]
# Check API version
run bash -c "echo '$out' | egrep -i '^\s*API version:'"
[ "$status" -eq 0 ]
[[ $(echo "${lines[0]}" | cut -d':' -f2 | awk -F' ' '{print $1}') == $(echo "${lines[1]}" | cut -d':' -f2 | awk -F' ' '{print $1}') ]]
}