This repository was archived by the owner on Apr 15, 2025. It is now read-only.
File tree Expand file treeCollapse file tree 1 file changed+45
-0
lines changedFilter options
+45
-0
lines changed Original file line number Diff line number Diff line change
@@ -1381,6 +1381,51 @@ func TestSnapshotAllIndices(t *testing.T) {
1381
1381
}
1382
1382
}
1383
1383
1384
+
func TestSnapshotAllIndicesWithAdditionalParameters(t *testing.T) {
1385
+
testSetup := &ServerSetup{
1386
+
Method: "PUT",
1387
+
Path: "/_snapshot/backup-repo/snapshot1",
1388
+
Body: `{"metadata":{"taken_because":"backup before upgrading","taken_by":"user123"}}`,
1389
+
Response: `{"acknowledged": true }`,
1390
+
}
1391
+
1392
+
host, port, ts := setupTestServers(t, []*ServerSetup{testSetup})
1393
+
defer ts.Close()
1394
+
client := NewClient(host, port)
1395
+
1396
+
bodyParams := map[string]interface{}{
1397
+
"metadata": map[string]interface{}{
1398
+
"taken_by": "user123",
1399
+
"taken_because": "backup before upgrading",
1400
+
},
1401
+
}
1402
+
1403
+
err := client.SnapshotAllIndicesWithBodyParams("backup-repo", "snapshot1", bodyParams)
1404
+
1405
+
if err != nil {
1406
+
t.Fatalf("Got error taking snapshot: %s", err)
1407
+
}
1408
+
}
1409
+
1410
+
func TestSnapshotAllIndicesWithAdditionalParametersErr(t *testing.T) {
1411
+
testSetup := &ServerSetup{
1412
+
Method: "PUT",
1413
+
Path: "/_snapshot/backup-repo/snapshot1",
1414
+
Body: `{"metadata":{"taken_because":"backup before upgrading","taken_by":"user123"}}`,
1415
+
Response: `{"acknowledged": true }`,
1416
+
}
1417
+
1418
+
host, port, ts := setupTestServers(t, []*ServerSetup{testSetup})
1419
+
defer ts.Close()
1420
+
client := NewClient(host, port)
1421
+
1422
+
err := client.SnapshotAllIndicesWithBodyParams("backup-repo", "snapshot1", nil)
1423
+
1424
+
if err == nil {
1425
+
t.Fatalf("should have thrown an error")
1426
+
}
1427
+
}
1428
+
1384
1429
func TestRestoreSnapshotIndices_ErrorConditions(t *testing.T) {
1385
1430
tt := []struct {
1386
1431
Name string
You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4