From e2d76aaa20e0ccab4452b263a5718b23e46d9c75 Mon Sep 17 00:00:00 2001 From: szroland Date: Mon, 29 Jun 2015 21:55:52 +0200 Subject: [PATCH] remove _create from POST to match PUT path --- .../create/RestCreateSnapshotAction.java | 2 +- .../rest-api-spec/api/snapshot.create.json | 2 +- .../test/snapshot.create/10_basic.yaml | 36 +++++++++++++++++++ 3 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 rest-api-spec/src/main/resources/rest-api-spec/test/snapshot.create/10_basic.yaml diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/snapshots/create/RestCreateSnapshotAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/snapshots/create/RestCreateSnapshotAction.java index c62be2b3db6..4bdef344d3f 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/snapshots/create/RestCreateSnapshotAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/snapshots/create/RestCreateSnapshotAction.java @@ -40,7 +40,7 @@ public class RestCreateSnapshotAction extends BaseRestHandler { public RestCreateSnapshotAction(Settings settings, RestController controller, Client client) { super(settings, controller, client); controller.registerHandler(PUT, "/_snapshot/{repository}/{snapshot}", this); - controller.registerHandler(POST, "/_snapshot/{repository}/{snapshot}/_create", this); + controller.registerHandler(POST, "/_snapshot/{repository}/{snapshot}", this); } @Override diff --git a/rest-api-spec/src/main/resources/rest-api-spec/api/snapshot.create.json b/rest-api-spec/src/main/resources/rest-api-spec/api/snapshot.create.json index ee00c77918f..29ae2206c85 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/api/snapshot.create.json +++ b/rest-api-spec/src/main/resources/rest-api-spec/api/snapshot.create.json @@ -4,7 +4,7 @@ "methods": ["PUT", "POST"], "url": { "path": "/_snapshot/{repository}/{snapshot}", - "paths": ["/_snapshot/{repository}/{snapshot}", "/_snapshot/{repository}/{snapshot}/_create"], + "paths": ["/_snapshot/{repository}/{snapshot}"], "parts": { "repository": { "type": "string", diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/snapshot.create/10_basic.yaml b/rest-api-spec/src/main/resources/rest-api-spec/test/snapshot.create/10_basic.yaml new file mode 100644 index 00000000000..b341564e9b5 --- /dev/null +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/snapshot.create/10_basic.yaml @@ -0,0 +1,36 @@ +--- +setup: + + - do: + snapshot.create_repository: + repository: test_repo1 + body: + type: fs + settings: + location: "test_repo1" + + - do: + indices.create: + index: test_index + body: + settings: + number_of_shards: 1 + number_of_replicas: 1 + + - do: + cluster.health: + wait_for_status: yellow + +--- +"Create a snapshot": + + - do: + snapshot.create: + repository: test_repo1 + snapshot: test_snapshot + wait_for_completion: true + + - match: { snapshot.snapshot: test_snapshot } + - match: { snapshot.state : SUCCESS } + - match: { snapshot.shards.successful: 1 } + - match: { snapshot.shards.failed : 0 }