Galsza commented on code in PR #3788:
URL: https://github.com/apache/ozone/pull/3788#discussion_r1005385575
##########
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/dn/scanner/TestDataScanner.java:
##########
@@ -121,111 +119,126 @@ public static void shutdown() throws IOException {
}
}
+ //This test performs 2 separate tests because creating
+ // and running a cluster is expensive.
@Test
- public void testOpenContainerIntegrity() throws Exception {
+ public void testScannersMarkContainerUnhealthy() throws Exception {
String volumeName = UUID.randomUUID().toString();
String bucketName = UUID.randomUUID().toString();
- Instant testStartTime = Instant.now();
-
- String value = "sample value";
+ String value = "sample key value";
store.createVolume(volumeName);
OzoneVolume volume = store.getVolume(volumeName);
volume.createBucket(bucketName);
OzoneBucket bucket = volume.getBucket(bucketName);
- for (int i = 0; i < 10; i++) {
- String keyName = UUID.randomUUID().toString();
-
- OzoneOutputStream out = bucket.createKey(keyName,
- value.getBytes(UTF_8).length, RATIS,
- ONE, new HashMap<>());
- out.write(value.getBytes(UTF_8));
- out.close();
- OzoneKey key = bucket.getKey(keyName);
- Assert.assertEquals(keyName, key.getName());
- OzoneInputStream is = bucket.readKey(keyName);
- byte[] fileContent = new byte[value.getBytes(UTF_8).length];
- is.read(fileContent);
- Assert.assertTrue(verifyRatisReplication(volumeName, bucketName,
- keyName, RATIS,
- ONE));
- Assert.assertEquals(value, new String(fileContent, UTF_8));
- Assert.assertFalse(key.getCreationTime().isBefore(testStartTime));
- Assert.assertFalse(key.getModificationTime().isBefore(testStartTime));
- }
-
+ String keyNameInClosedContainer = "keyNameInClosedContainer";
+ OzoneOutputStream key = createKey(volumeName, bucketName,
+ keyNameInClosedContainer);
+ // write data more than 1 chunk
+ int sizeLargerThanOneChunk = (int) (OzoneConsts.MB + OzoneConsts.MB / 2);
Review Comment:
I'm not sure about the inner workings of the test environment but trying to
write less than one chunk results in the waitForContainerClose method timing
out. I guess the reason for that is that data less than one chunk gets buffered
and the buffer waits until more data is added. So no container is created
without a whole chunk being written. (Other tests do this too, I'm not sure how
to fix this. Do you have a recommendation? I'm leaving it like this for now)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]