I don’t understand the behavior of my .yml file, my .travis.yml:
language: go
go:
- "1.10.x"
- "1.11.x"
env:
matrix:
- MONGO_SETTINGS=--auth
- MONGO_SETTINGS=
matrix:
include:
- env: MONGO_SETTINGS=--auth
before_script:
- mongorestore -h 127.0.0.1 --port 27017 -d data integration
- mongo data --eval 'db.createUser({user:"travis", pwd:"test", roles:["readWrite"]});'
- mongod --dbpath=data/db --shutdown
- sleep 10
- mongod --dbpath=data/db $MONGO_SETTINGS &
- sleep 3
- mongo data --username travis --password test --eval "db.getCollection('data').find({})"
script:
- go test ./... -tags=authentication
- env: MONGO_SETTINGS=
before_script:
- mongorestore -h 127.0.0.1 --port 27017 -d data integration
- mongo data --eval "db.getCollection('data').find({})"
script:
- go test ./...
install:
- wget http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-3.4.18.tgz
- tar xfz mongodb-linux-x86_64-3.4.18.tgz
- export PATH=`pwd`/mongodb-linux-x86_64-3.4.18/bin:$PATH
- mkdir -p data/db
- mongod --dbpath=data/db &
- sleep 3
The matrix returns 6 jobs
- 1.1 Go: 1.10.x MONGO_SETTINGS=–auth
- 1.2 Go: 1.10.x MONGO_SETTINGS=
- 1.3 Go: 1.11.x MONGO_SETTINGS=–auth
- 1.4 Go: 1.11.x MONGO_SETTINGS=
- 1.5 Go: 1.10.x MONGO_SETTINGS=–auth
- 1.6 Go: 1.10.x MONGO_SETTINGS=
Why there are 1.5 and 1.6 jobs ?
To my mind, 1.5 and 1.6 are equal to 1.1 and 1.2.
The expected matrix is :
- 1.1 Go: 1.10.x MONGO_SETTINGS=–auth
- 1.2 Go: 1.10.x MONGO_SETTINGS=
- 1.3 Go: 1.11.x MONGO_SETTINGS=–auth
- 1.4 Go: 1.11.x MONGO_SETTINGS=
language: go
go:
- "1.10.x"
- "1.11.x"
env:
matrix:
- MONGO_SETTINGS=--auth
- MONGO_SETTINGS=
install:
- wget http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-3.4.18.tgz
- tar xfz mongodb-linux-x86_64-3.4.18.tgz
- export PATH=`pwd`/mongodb-linux-x86_64-3.4.18/bin:$PATH
- mkdir -p data/db
- mongod --dbpath=data/db &
- sleep 3
before_script:
- if [[ ${MONGO_SETTINGS} = "--auth" ]]; then
mongorestore -h 127.0.0.1 --port 27017 -d data integration;
mongo data --eval 'db.createUser({user:"travis", pwd:"test", roles:["readWrite"]})';
mongod --dbpath=data/db --shutdown;
sleep 10;
mongod --dbpath=data/db --fork --logpath mongodb.log "$MONGO_SETTINGS";
sleep 3;
mongo data --username travis --password test --eval "db.getCollection('data').find({})";
else
mongorestore -h 127.0.0.1 --port 27017 -d data integration;
mongo data --eval "db.getCollection('data').find({})";
fi
script:
- if [[ ${MONGO_SETTINGS} = "--auth" ]]; then
go test ./... -tags=authentication;
else
go test ./...;
fi
this makes no sense and is causing problems getting our new release out…