Merge pull request #1004 from vieux/fix_api_test

fix api_version test
This commit is contained in:
Alexandre Beslic 2015-06-30 11:59:05 -07:00
commit d766fea7a8
1 changed files with 13 additions and 9 deletions

View File

@ -12,16 +12,20 @@ function teardown() {
# and your host CLI version differs from DOCKER_VERSION. # and your host CLI version differs from DOCKER_VERSION.
@test "api version" { @test "api version" {
start_docker 1 start_docker 1
run docker -H "${HOSTS[0]}" version
# Get version output
out=$(docker -H "${HOSTS[0]}" version)
# Check client version
run bash -c "echo '$out' | grep -i version | grep -v Go | grep -v API"
[ "$status" -eq 0 ] [ "$status" -eq 0 ]
# First line should contain the client version. [[ $(echo "${lines[0]}" | cut -d':' -f2) == $(echo "${lines[1]}" | cut -d':' -f2) ]]
[[ "${lines[0]}" == "Client version: "* ]]
local cli_version=`echo "${lines[0]}" | cut -d':' -f2` # Check API version
[[ "${output}" == *"Server version:$cli_version"* ]] run bash -c "echo '$out' | grep -i version | grep API"
[ "$status" -eq 0 ]
[[ $(echo "${lines[0]}" | cut -d':' -f2) == $(echo "${lines[1]}" | cut -d':' -f2) ]]
# Second line should be client API version.
[[ "${lines[1]}" == "Client API version: "* ]]
local cli_api_version=`echo "${lines[1]}" | cut -d':' -f2`
[[ "${output}" == *"Server API version:$cli_api_version"* ]]
} }