зеркало из https://github.com/github/vulcanizer.git
Add a shared backup volume so that integration tests can test snapshots/backups
This commit is contained in:
Родитель
051409df01
Коммит
8cf6c8baf9
|
@ -1,9 +0,0 @@
|
|||
docker compose up
|
||||
|
||||
write documents
|
||||
|
||||
create repository
|
||||
|
||||
make snapshot
|
||||
|
||||
restore snapshot
|
|
@ -11,6 +11,7 @@ services:
|
|||
- cluster.name=vulcanizer-elasticsearch-v5
|
||||
- node.name=vulcanizer-elasticsearch-v5
|
||||
- bootstrap.memory_lock=true
|
||||
- "path.repo=/backups"
|
||||
- "ES_JAVA_OPTS=-Xms512M -Xmx512M"
|
||||
- xpack.security.enabled=false
|
||||
- xpack.monitoring.enabled=false
|
||||
|
@ -30,6 +31,8 @@ services:
|
|||
- 49200:9200
|
||||
networks:
|
||||
- esnet
|
||||
volumes:
|
||||
- backup-volume:/backups
|
||||
|
||||
elasticsearch-v5-2:
|
||||
build:
|
||||
|
@ -43,6 +46,7 @@ services:
|
|||
- cluster.name=vulcanizer-elasticsearch-v5
|
||||
- bootstrap.memory_lock=true
|
||||
- node.name=vulcanizer-elasticsearch-v5-2
|
||||
- "path.repo=/backups"
|
||||
- "discovery.zen.ping.unicast.hosts=vulcanizer-elasticsearch-v5"
|
||||
- "ES_JAVA_OPTS=-Xms512M -Xmx512M"
|
||||
- xpack.security.enabled=false
|
||||
|
@ -61,6 +65,11 @@ services:
|
|||
- IPC_LOCK
|
||||
networks:
|
||||
- esnet
|
||||
volumes:
|
||||
- backup-volume:/backups
|
||||
|
||||
networks:
|
||||
esnet:
|
||||
|
||||
volumes:
|
||||
backup-volume:
|
|
@ -39,3 +39,31 @@ func TestIndices(t *testing.T) {
|
|||
t.Fatalf("Expected 10 docs, got: %v", indices[0].DocumentCount)
|
||||
}
|
||||
}
|
||||
|
||||
func TestVerifyRepository(t *testing.T) {
|
||||
c := vulcanizer.NewClient("localhost", 49200)
|
||||
|
||||
verified, err := c.VerifyRepository("backup-repo")
|
||||
|
||||
if err != nil {
|
||||
t.Fatalf("Error verifying repositories: %s", err)
|
||||
}
|
||||
|
||||
if !verified {
|
||||
t.Fatalf("Expected to backup-repo to be a verified repository")
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetSnapshotStatus(t *testing.T) {
|
||||
c := vulcanizer.NewClient("localhost", 49200)
|
||||
|
||||
snapshot, err := c.GetSnapshotStatus("backup-repo", "snapshot_1")
|
||||
|
||||
if err != nil {
|
||||
t.Fatalf("Error getting snapshot status: %s", err)
|
||||
}
|
||||
|
||||
if snapshot.State != "SUCCESS" {
|
||||
t.Fatalf("Expected snapshot to be a success: %+v", snapshot)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,10 +3,12 @@ set -e
|
|||
|
||||
./script/build
|
||||
|
||||
cd integration_data/
|
||||
cd integration_data/v5
|
||||
docker-compose -f elasticsearch-cluster-v5-compose.yml up -d
|
||||
sleep 20
|
||||
curl -H "Content-Type: application/x-ndjson" -XPOST localhost:49200/_bulk --data-binary "@documents.dat"; echo
|
||||
sleep 10
|
||||
curl --retry 5 --retry-delay 5 --retry-connrefused -H "Content-Type: application/x-ndjson" -XPOST localhost:49200/_bulk --data-binary "@../documents.dat"; echo
|
||||
curl -XPUT localhost:49200/_snapshot/backup-repo -d '{ "type": "fs", "settings": { "location": "/backups" } }'
|
||||
curl -XPUT localhost:49200/_snapshot/backup-repo/snapshot_1?wait_for_completion=true
|
||||
|
||||
# Run tests
|
||||
go test -v github.com/github/vulcanizer/... -tags integration
|
||||
|
|
Загрузка…
Ссылка в новой задаче