Search in sources :

Example 1 with DeleteSnapshotRequest

use of org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.DeleteSnapshotRequest in project hbase by apache.

the class TestSnapshotFromMaster method testDeleteSnapshot.

@Test(timeout = 300000)
public void testDeleteSnapshot() throws Exception {
    String snapshotName = "completed";
    SnapshotDescription snapshot = SnapshotDescription.newBuilder().setName(snapshotName).build();
    DeleteSnapshotRequest request = DeleteSnapshotRequest.newBuilder().setSnapshot(snapshot).build();
    try {
        master.getMasterRpcServices().deleteSnapshot(null, request);
        fail("Master didn't throw exception when attempting to delete snapshot that doesn't exist");
    } catch (org.apache.hadoop.hbase.shaded.com.google.protobuf.ServiceException e) {
    // Expected
    }
    // write one snapshot to the fs
    createSnapshot(snapshotName);
    // then delete the existing snapshot,which shouldn't cause an exception to be thrown
    master.getMasterRpcServices().deleteSnapshot(null, request);
}
Also used : SnapshotDescription(org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.SnapshotDescription) DeleteSnapshotRequest(org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.DeleteSnapshotRequest) Test(org.junit.Test)

Aggregations

SnapshotDescription (org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.SnapshotDescription)1 DeleteSnapshotRequest (org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.DeleteSnapshotRequest)1 Test (org.junit.Test)1