Add descriptions to create snapshot and restore snapshot tasks.

Related to #21768
This commit is contained in:
Igor Motov 2016-11-30 20:39:25 -05:00
parent c6efd4eb42
commit bb9317253a
3 changed files with 27 additions and 0 deletions

View File

@ -478,4 +478,9 @@ public class CreateSnapshotRequest extends MasterNodeRequest<CreateSnapshotReque
out.writeBoolean(waitForCompletion);
out.writeBoolean(partial);
}
@Override
public String getDescription() {
return "snapshot [" + repository + ":" + snapshot + "]";
}
}

View File

@ -646,4 +646,10 @@ public class RestoreSnapshotRequest extends MasterNodeRequest<RestoreSnapshotReq
writeSettingsToStream(indexSettings, out);
out.writeStringArray(ignoreIndexSettings);
}
@Override
public String getDescription() {
return "snapshot [" + repository + ":" + snapshot + "]";
}
}

View File

@ -19,6 +19,8 @@
package org.elasticsearch.snapshots;
import org.elasticsearch.action.admin.cluster.snapshots.create.CreateSnapshotRequest;
import org.elasticsearch.action.admin.cluster.snapshots.restore.RestoreSnapshotRequest;
import org.elasticsearch.common.UUIDs;
import org.elasticsearch.common.io.stream.BytesStreamOutput;
import org.elasticsearch.test.ESTestCase;
@ -51,4 +53,18 @@ public class SnapshotTests extends ESTestCase {
assertThat(new Snapshot(out.bytes().streamInput()), equalTo(original));
}
public void testCreateSnapshotRequestDescrptions() {
CreateSnapshotRequest createSnapshotRequest = new CreateSnapshotRequest();
createSnapshotRequest.snapshot("snapshot_name");
createSnapshotRequest.repository("repo_name");
assertEquals("snapshot [repo_name:snapshot_name]", createSnapshotRequest.getDescription());
}
public void testRestoreSnapshotRequestDescrptions() {
RestoreSnapshotRequest restoreSnapshotRequest = new RestoreSnapshotRequest();
restoreSnapshotRequest.snapshot("snapshot_name");
restoreSnapshotRequest.repository("repo_name");
assertEquals("snapshot [repo_name:snapshot_name]", restoreSnapshotRequest.getDescription());
}
}