vulcanizer/script/integration-test

51 строка
2.2 KiB
Bash
Executable File

#!/bin/bash
set -e
# Run regular unit tests first
./script/test
# Make sure everything is clear from previous runs
docker-compose -f integration_data/v5/elasticsearch-cluster-compose.yml down
docker-compose -f integration_data/v6/elasticsearch-cluster-compose.yml down
docker volume rm v5_vulcanizer-backup-volume || echo "OK for volume not to exist"
docker volume rm v6_vulcanizer-backup-volume || echo "OK for volume not to exist"
echo "Running integration tests for Elasticsearch v5"
cd integration_data/v5
docker-compose -f elasticsearch-cluster-compose.yml up -d
echo "Wait for Elasticsearch v5 to start..."
until foo=$(curl -s localhost:49200)
do
sleep 10
done
curl -s -H "Content-Type: application/x-ndjson" -XPOST localhost:49200/_bulk --data-binary "@../documents.dat"; echo
curl -s -XPUT localhost:49200/_snapshot/backup-repo -d '{ "type": "fs", "settings": { "location": "/backups" } }'
curl -s -XPUT localhost:49200/_snapshot/backup-repo/snapshot_1?wait_for_completion=true
curl -s -H "Content-Type: application/json" XPOST localhost:49200/_aliases -d '{ "actions" : [ { "add" : { "index" : "integration_test", "alias" : "integration_test_alias" } } ] }'
# Run tests
go test -v github.com/github/vulcanizer/... -tags integration -count=1
docker-compose -f elasticsearch-cluster-compose.yml down
cd ../v6
echo "Running integration tests for Elasticsearch v6"
docker-compose -f elasticsearch-cluster-compose.yml up -d
# Wait for Elasticsearch to start...
echo "Wait for Elasticsearch v6 to start..."
until foo=$(curl -s localhost:49200)
do
sleep 10
done
curl -s -H "Content-Type: application/x-ndjson" -XPOST localhost:49200/_bulk --data-binary "@../documents.dat"; echo
curl -s -XPUT -H 'Content-Type: application/json' localhost:49200/_snapshot/backup-repo -d '{ "type": "fs", "settings": { "location": "/backups" } }'
curl -s -XPUT localhost:49200/_snapshot/backup-repo/snapshot_1?wait_for_completion=true
curl -s -H "Content-Type: application/json" XPOST localhost:49200/_aliases -d '{ "actions" : [ { "add" : { "index" : "integration_test", "alias" : "integration_test_alias" } } ] }'
# Run tests
go test -v github.com/github/vulcanizer/... -tags integration -count=1
docker-compose -f elasticsearch-cluster-compose.yml down