Skip to content

HDDS-14627. Code cleanup in TestVolumeSet#9769

Merged
sarvekshayr merged 4 commits intoapache:masterfrom
Russole:HDDS-14627
Feb 17, 2026
Merged

HDDS-14627. Code cleanup in TestVolumeSet#9769
sarvekshayr merged 4 commits intoapache:masterfrom
Russole:HDDS-14627

Conversation

@Russole
Copy link
Contributor

@Russole Russole commented Feb 15, 2026

What changes were proposed in this pull request?

  • Rename dataDirKey, since it's a config value, not key
  • Remove useless messages from assertions
  • Remove comments that repeat code in other words
  • Remove reference to "Add Volume", which no longer exists

What is the link to the Apache JIRA

https://issues.apache.org/jira/browse/HDDS-14627

How was this patch tested?

Copy link
Contributor

@Gargi-jais11 Gargi-jais11 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Russole for the patch. Overall LGTM!
Just one comment to resolve.

assertEquals(2, volumeSet.getVolumesList().size());

// Add a volume to VolumeSet
String volume3 = baseDir + "disk3";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Let's make this consistent with how other volumes are added.

Suggested change
String volume3 = baseDir + "disk3";
String volume3 = baseDir.resolve("disk3").toString();

@Russole
Copy link
Contributor Author

Russole commented Feb 16, 2026

Thanks @Gargi-jais11 for the review.
I've updated it based on the comment.

@Russole Russole requested a review from Gargi-jais11 February 16, 2026 02:44
Copy link
Contributor

@Gargi-jais11 Gargi-jais11 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link
Contributor

@sarvekshayr sarvekshayr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@sreejasahithi sreejasahithi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Russole , left few minor comments

Comment on lines 166 to 167
File volume = new File(volume3);
FileUtils.deleteDirectory(volume);
Copy link
Contributor

@sreejasahithi sreejasahithi Feb 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Since this variable is only used when calling deleteDirectory, we can avoid creating a separate variable

Suggested change
File volume = new File(volume3);
FileUtils.deleteDirectory(volume);
FileUtils.deleteDirectory(new File(volume3));

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sreejasahithi Please ensure the suggested changes follow the correct indentation, as applying them directly may introduce formatting issues.

Copy link
Contributor

@sreejasahithi sreejasahithi Feb 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @sarvekshayr , done

System.out.println("new volume root: " + newVolume);
assertTrue(newVolume.mkdirs());
assertTrue(newVolume.exists(), "Failed to create new volume root");
assertTrue(newVolume.exists());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mkdirs() returns true on success, so the exists() check immediately after is redundant

@Russole
Copy link
Contributor Author

Russole commented Feb 16, 2026

Thanks @sarvekshayr, @sreejasahithi for the review.
I’ve updated the patch based on the comments.

assertTrue(newVolume.exists(), "Failed to create new volume root");
File dataDir = new File(newVolume, "chunks");
assertTrue(dataDir.mkdirs());
assertTrue(dataDir.exists());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's remove the redundant check here as well.

Suggested change
assertTrue(dataDir.exists());

@Russole Russole requested a review from sarvekshayr February 16, 2026 17:07
@sarvekshayr sarvekshayr merged commit 5331a6b into apache:master Feb 17, 2026
29 checks passed
@sarvekshayr
Copy link
Contributor

Thanks @Russole for the patch, @Gargi-jais11 and @sreejasahithi for the review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants