devmadhuu commented on code in PR #11926:
URL: https://github.com/apache/ozone/pull/11926#discussion_r4467316078
##########
hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/container/replication/TestReplicationManager.java:
##########
@@ -1219,26 +1221,46 @@ public void testSendDatanodeReconstructCommand() throws
NotLeaderException {
* target has the correct deadline and that ContainerReplicaOp for
* replica ADD is created correctly.
*/
- @Test
- public void testReplicateContainerCommandToTarget()
- throws NotLeaderException {
- // create a closed EC container
- ECReplicationConfig ecRepConfig = new ECReplicationConfig(3, 2);
+ @ParameterizedTest
+ @CsvSource({
+ "0, SSD, ARCHIVE, ARCHIVE",
+ "1, SSD, ARCHIVE, ARCHIVE",
+ "0, ARCHIVE, SSD, SSD",
+ "1, ARCHIVE, SSD, SSD",
+ "0, SSD, DISK, DISK",
+ "1, SSD, DISK, DISK",
+ "0, SSD, , SSD",
+ "1, SSD, , SSD",
+ "0, , ARCHIVE, ARCHIVE",
+ "1, , ARCHIVE, ARCHIVE",
+ "0, EMPTY, SSD, SSD",
+ "1, EMPTY, SSD, SSD",
+ "0, , , ",
+ "1, , , ",
+ "0, EMPTY, , ",
+ "1, EMPTY, , "
+ })
+ public void testReplicateContainerCommandToTarget(int replicaIndex,
StorageTier storageTier,
+ StorageType commandStorageType, StorageType expectedStorageType) throws
NotLeaderException {
Review Comment:
For the normal case, the command type should agree with the type resolved by
the balancer or replication manager repair caller. However, this test
specifically checks pending-copy accounting, so I would keep commandStorageType
independent of storageTier.
For example, a legacy container can have `ContainerInfo.storageTier = null`,
while its source replica reports an SSD volume. The follow-up PRs can resolve
SSD and issue an SSD copy command. SCM must then account for the pending copy
against SSD, even though the container tier is absent.
The intended behavior tested here is: use the command’s destination type
when supplied, and retain the existing container-tier fallback when it is
absent. Deriving the command type from the container tier would remove coverage
for that distinction.
The differing-type rows also retain the regression coverage requested in
#11399 for accounting against the command’s destination type. They test
accounting independently of the policy decisions made by the caller.
--
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]