This is an automated email from the ASF dual-hosted git repository.
sshenoy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git
The following commit(s) were added to refs/heads/master by this push:
new 72d793caad HDDS-9060. [snapshot] Add unit-testcase for snapshot fs
-deleteSnapshot (#5101)
72d793caad is described below
commit 72d793caad081d11aaa522fafc89d15b464dab8b
Author: jyotirmoy-gh <[email protected]>
AuthorDate: Tue Jul 25 11:52:57 2023 +0530
HDDS-9060. [snapshot] Add unit-testcase for snapshot fs -deleteSnapshot
(#5101)
---
.../hadoop/fs/ozone/TestOzoneFsSnapshot.java | 45 ++++++++++++++++++----
1 file changed, 38 insertions(+), 7 deletions(-)
diff --git
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestOzoneFsSnapshot.java
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestOzoneFsSnapshot.java
index 4c286e8575..8a3be25b63 100644
---
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestOzoneFsSnapshot.java
+++
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestOzoneFsSnapshot.java
@@ -304,13 +304,44 @@ public class TestOzoneFsSnapshot {
200, 10000);
}
- @Test
- public void testSnapshotDeleteFailure() throws Exception {
- // Delete snapshot that doesn't exist
- String deleteSnapshotOut = execShellCommandAndGetOutput(1,
- new String[]{"-deleteSnapshot", BUCKET_PATH, "testsnap"});
- Assertions.assertTrue(deleteSnapshotOut
- .contains("Snapshot does not exist"));
+ private static Stream<Arguments> deleteSnapshotFailureScenarios() {
+ String invalidBucketPath = "/invalid/uri";
+ return Stream.of(
+ Arguments.of("1st case: invalid snapshot name",
+ BUCKET_PATH,
+ "testsnap",
+ "Snapshot does not exist",
+ 1),
+ Arguments.of("2nd case: invalid bucekt path",
+ invalidBucketPath,
+ "testsnap",
+ "No such file or directory",
+ 1),
+ Arguments.of("3rd case: snapshot name not passed",
+ BUCKET_PATH,
+ "",
+ "snapshot name can't be null or empty",
+ -1),
+ Arguments.of("4th case: all parameters are missing",
+ "",
+ "",
+ "Can not create a Path from an empty string",
+ -1)
+ );
+ }
+
+ @ParameterizedTest(name = "{0}")
+ @MethodSource("deleteSnapshotFailureScenarios")
+ public void testSnapshotDeleteFailure(String description,
+ String paramBucketPath,
+ String snapshotName,
+ String expectedMessage,
+ int expectedResponse) throws Exception
{
+ String errorMessage = execShellCommandAndGetOutput(expectedResponse,
+ new String[]{"-deleteSnapshot", paramBucketPath, snapshotName});
+
+ Assertions.assertTrue(errorMessage
+ .contains(expectedMessage), errorMessage);
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]