docker-archive / classicswarm

Swarm Classic: a container clustering system. Not to be confused with Docker Swarm which is at https://github.com/docker/swarmkit
Apache License 2.0
5.76k stars 1.08k forks source link

swarm test failing for API version matching #918

Closed Pensu closed 8 years ago

Pensu commented 9 years ago

Hi all,

So my swarm test for API version matching is failing as the client version is 1.6.2 and server version is 1.7.0-dev. Here is the output that comes in api_version.bats file:

Client version: 1.6.2 Client API version: 1.18 Go version (client): go1.4.2 Git commit (client): 7c8fca2 OS/Arch (client): linux/amd64 Server version: 1.7.0-dev Server API version: 1.20 Go version (server): go1.4.2 Git commit (server): a63c7c7 OS/Arch (server): linux/amd64

Is there anything we need to do, so that the test can be passed?

Pensu commented 9 years ago

@aluzzardi Could you please have a look? Thanks.

vieux commented 9 years ago

@Pensu something is wrong in your setup. Server version: 1.7.0-dev is likely the version of a docker daemon. The test is supposed ot run against a swarm daemon (the version should be like swarm/0.3.0)

Pensu commented 9 years ago

@vieux I guess the test is running through api_version.bats, which has line 15: run docker -H "${HOSTS[0]}" version, so I guess it's checking against docker version only. Please correct me if there is anything wrong. Because my setup has docker server as 1.6.2 only.

vieux commented 9 years ago

@Pensu my bad, the failure is expected as you don't use the same version for client (1.6.2) and server (1.7.0-dev)

Pensu commented 9 years ago

@vieux That is the thing, here is the output on my machine for "docker version":

vagrant@vagrant-ubuntu-trusty-64:~/gocode/src/github.com/docker/swarm$ sudo docker version Client version: 1.6.2 Client API version: 1.18 Go version (client): go1.4.2 Git commit (client): 7c8fca2 OS/Arch (client): linux/amd64 Server version: 1.6.2 Server API version: 1.18 Go version (server): go1.4.2 Git commit (server): 7c8fca2 OS/Arch (server): linux/amd64

It says both server and client versions are 1.6.2

aluzzardi commented 9 years ago

@Pensu, hey, yes indeed, that's "supposed" to happen.

Your CLI is 1.6 while the server is docker master (the server is created by the integration tests and is always docker master).

Just run your tests using test/integration/run.sh (you can specify just a file ton run, such as test/integration/run.sh api_version.bats).

run.sh will run the tests in a docker container (instead of directly on your machine) and will make sure that both the client and the server are the same.

Pensu commented 9 years ago

@aluzzardi Thanks for the response, I tried that already. But I keep getting an even stranger error.

vagrant@vagrant-ubuntu-trusty-64:~/gocode/src/github.com/docker/swarm$ sudo test/integration/run.sh Unable to find image ' #:latest' locally time="2015-06-10T15:13:54Z" level=fatal msg="Invalid repository name ( #), only [a-z0-9-_.] are allowed" test/integration/run.sh: line 25: -v: command not found

Seems like there is an issue with my environment only, I just can't pinpoint what exactly.

aluzzardi commented 9 years ago

@Pensu Very weird - could you do an env | grep INTEGRATION_IMAGE?

run.sh can use the INTEGRATION_IMAGE environment variable to override which test image to use (defaults to dockerswarm/swarm-test-env). It looks like in your environment it's defined to # and therefore it's trying to pull #:latest.

You can either remove that INTEGRATION_IMAGE from your environment or run: INTEGRATION_IMAGE=dockerswarm/swarm-test-env test/integration/run.sh

Pensu commented 9 years ago

@aluzzardi Did it, It's the same result again!

vagrant@vagrant-ubuntu-trusty-64:~/gocode/src/github.com/docker/swarm$ env | grep INTEGRATION_IMAGE INTEGRATIONIMAGE=dockerswarm/swarm-test-env vagrant@vagrant-ubuntu-trusty-64:~/gocode/src/github.com/docker/swarm$ sudo test/integration/run.sh Unable to find image ' #:latest' locally time="2015-06-10T18:00:48Z" level=fatal msg="Invalid repository name ( #), only [a-z0-9-.] are allowed" test/integration/run.sh: line 25: -v: command not found

Pensu commented 9 years ago

@aluzzardi @vieux Any other suggestions?

aluzzardi commented 9 years ago
vagrant@vagrant-ubuntu-trusty-64:~/gocode/src/github.com/docker/swarm$ env | grep INTEGRATION_IMAGE
INTEGRATION_IMAGE=dockerswarm/swarm-test-env

You have to get rid of that first INTEGRATION_IMAGE - not sure how it ended up in your environment.

Try: unset INTEGRATION_IMAGE

Pensu commented 9 years ago

@aluzzardi Hi, so I tried to run tests again with a fresh installation, and the API test is still failing:

vagrant@vagrant-ubuntu-vivid-64:~/go.bld/src/github.com/docker/swarm$ sudo bats test/integration/
 ✓ container affinty
 ✓ image affinity
 ✓ label affinity
 ✗ api version
   (in test file test/integration/api_version.bats, line 23)
     `[[ $(echo "${lines[0]}" | cut -d':' -f2) == $(echo "${lines[1]}" | cut -d':' -f2) ]]' failed
   Stopping 58f3dbc4f11a006a6947f2377cb1e003ac2732394941cca0f27314beaccb926a
 ✓ swarm create doesn't accept any arguments
 ✓ swarm version
 ✓ node constraint
 ✓ label constraints
 ✓ shared volumes dependency
 ✓ links dependency
 ✓ shared network stack dependency
 ✓ port filter: host mode
 ✓ port filter: bridge mode
 ✓ resource limitation: memory
 ✓ resource limitation: cpu
 ✓ swarm id generation

16 tests, 1 failure

Though this time it looks like a different error. And there is no INTEGRATION_IMAGE either!

vagrant@vagrant-ubuntu-vivid-64:~/go.bld/src/github.com/docker/swarm$ env | grep INTEGRATION_IMAGE
vagrant@vagrant-ubuntu-vivid-64:~/go.bld/src/github.com/docker/swarm$ 
vieux commented 8 years ago

When you run bats on your machine like this: bats test/integration/ it's going to use the docker from your machine, it might be too old to work with swarm.

The proper way to run tests is to use ./test/integration/run.sh this is going to run everything inside a docker container, with a compatible docker version (usually the latest stable one, 1.9 nowadays)