Skip to content

BITMAG-1266-prevent-permanent-test-files - #96

Open
Knud-Aage wants to merge 3 commits into
masterfrom
BITMAG-1266-prevent-permanent-rest-files
Open

BITMAG-1266-prevent-permanent-test-files#96
Knud-Aage wants to merge 3 commits into
masterfrom
BITMAG-1266-prevent-permanent-rest-files

Conversation

@Knud-Aage

Copy link
Copy Markdown
Contributor

Removed that the test files got stored mainly by adding @tempdir

Knud-Aage added 3 commits May 20, 2026 09:27
…-permanent-rest-files

# Conflicts:
#	bitrepository-reference-pillar/src/test/java/org/bitrepository/pillar/integration/perf/GetFileStressIT.java
@Knud-Aage
Knud-Aage requested a review from ole-v-v August 13, 2026 09:58
@ole-v-v ole-v-v changed the title BITMAG-1266-prevent-permanent-rest-files BITMAG-1266-prevent-permanent-test-files Aug 13, 2026

@ole-v-v ole-v-v left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I suggest making the temporary directory a parameter to the test method rather than a static field. I have a couple of other minor suggestions.

The change is carried out nicely and elegantly.


@Test
@Tag(PillarTestGroups.PILLAR_STRESS_TEST)
void noIdentfyGetFilePerformanceTest() throws Exception {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

My comment above implied:

    void noIdentifyGetFilePerformanceTest(@TempDir Path tempDir) throws Exception {

I have taken the opportunity to correct the typo in Identfy. You may correct in line 141 too if you like.

Depending on taste one may also narrow down the exception type thrown to IOException.

public class GetFileStressIT extends PillarPerformanceIT {
public static final String FOLDER_NAME = "src/test/resources";
@TempDir
static Path tempDir;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Rather than a field here would we want to reduce the scope by making it a parameter to the method that uses it? See my comment to the method header.

httpServerConfiguration.getURL(fileName).toExternalForm(),
defaultFileId, null, getPillarID(), getPillarID(),
settingsForTestClient.getReceiverDestinationID(), pillarDestination);
getRequest.setFileAddress("file:" + tempDir.toAbsolutePath().toString()+"/"+fileName);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is this necessary? The test is also green without it.

If we want it (for one reason or another), conventions say to put a space before and after each +, which I also find nicer to read.

Matter of taste, we don’t need the toString() call since toString() is implicitly called in the string concatenation.

getLimiter.addJob(correlationID);
String fileName = nonDefaultFileId + "-" + i;

// Ensure the source file exists in the temp directory so the server can serve it

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is this necessary? The test is also green without it.

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.

2 participants