hiero-ledger / hiero-ledger/hiero-consensus-node

Change recently added unit tests to use temporary folders instead of writing files to the main codebase folders

Open
#6,714 1 comment 0 reactions 0 assignees View on GitHub
Platform
Dominant language
Java
Stars
406
Forks
226
Avg merge
3d 4h
Merged PRs (30d)
210

Description

### Problem

Some unit tests are writing files to the following folders.
```
**/swirlds-tmp
swirlds-platform-core/data/**
hedera-node/cli-clients/testFile
hedera-node/hedera-mono-service/temp/**
hedera-node/hedera-mono-service/swirlds-sst-tmp/**
hedera-node/data/
hedera-node/settingsUsed.txt
hedera-node/hedera-node/data/
```

### Solution

These tests need to be changed to use temporary filesystem folders (i.e. use the `@TempDir` annotation in the unit test) so that we are not writing test data to the main codebase and then required to ignore those files via `.gitignore`.

### Alternatives

`.gitignore` is updated currently, but this is only acceptable on a temporary basis.

Contributor guide

Open the contributing guide

Research direction

Search the unit tests that write to the listed swirlds-tmp, data, testFile, and settingsUsed.txt paths, then identify which tests create those files. Read the relevant test setup and use the @TempDir approach described in the issue; run the affected unit tests and confirm they no longer write into repository folders.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
testing-qa
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.