-
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feat/339-multiple-asserts-on-standalone
- Loading branch information
Showing
85 changed files
with
2,277 additions
and
714 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,13 @@ | ||
BASHUNIT_DEFAULT_PATH= | ||
BASHUNIT_LOG_JUNIT= | ||
BASHUNIT_REPORT_HTML= | ||
BASHUNIT_LOAD_FILE= | ||
|
||
# Booleans | ||
BASHUNIT_PARALLEL_RUN= | ||
BASHUNIT_SHOW_HEADER= | ||
BASHUNIT_HEADER_ASCII_ART= | ||
BASHUNIT_SIMPLE_OUTPUT= | ||
BASHUNIT_STOP_ON_FAILURE= | ||
BASHUNIT_SHOW_EXECUTION_TIME= | ||
BASHUNIT_LOG_JUNIT= | ||
BASHUNIT_REPORT_HTML= | ||
BASHUNIT_LOAD_FILE= | ||
BASHUNIT_DEV_MODE= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,3 +18,4 @@ report.html | |
|
||
# internal | ||
local/ | ||
out.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# Title: Using native bash booleans | ||
|
||
* Status: accepted | ||
* Authors: @Chemaclass | ||
* Date: 2024-10-03 | ||
|
||
Technical Story: | ||
- Pull Request: [TypedDevs/bashunit#345](https://github.com/TypedDevs/bashunit/pull/345#discussion_r1782226289) | ||
|
||
## Context and Problem Statement | ||
|
||
We are using booleans with different syntax in different parts of the project. | ||
|
||
## Considered Options | ||
|
||
* Use true and false as `0`, `1` native shell booleans | ||
* Use true and false as strings: `"true"`, `"false"` | ||
* Use true and false as native programs: `true`, `false` | ||
|
||
## Decision Outcome | ||
|
||
To keep consistency in the project, we want to use the standard and best practices of booleans while | ||
keeping a great DX. | ||
|
||
When using return, we must use a number: | ||
- `return 0` # for success | ||
- `return 1` # for failure | ||
|
||
When using variables, we must use `true` and `false` as commands (not strings!): | ||
- `true` is a command that always returns a successful exit code (0) | ||
- `false` is a command that always returns a failure exit code (1) | ||
|
||
When possible, extract a condition into a function. For example: | ||
```bash | ||
function env::is_show_header_enabled() { | ||
# this is a string comparison because it is coming from the .env | ||
[[ "$BASHUNIT_SHOW_HEADER" == "true" ]] | ||
} | ||
``` | ||
Usage | ||
```bash | ||
if env::is_show_header_enabled; then | ||
# ... | ||
fi | ||
``` | ||
|
||
### Positive Consequences | ||
|
||
We keep the native shell boolean syntax in conditions. | ||
|
||
### Negative Consequences | ||
|
||
Not that I am aware of. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# Title: Parallel testing | ||
|
||
* Status: accepted | ||
* Authors: @Chemaclass | ||
* Date: 2024-10-11 | ||
|
||
Technical Story: | ||
- Pull Request: [TypedDevs/bashunit#358](https://github.com/TypedDevs/bashunit/pull/358) | ||
|
||
## Context and Problem Statement | ||
|
||
We aim to enhance testing performance by running tests in parallel processes while capturing and aggregating results effectively. | ||
|
||
## Considered Options | ||
|
||
- Implement parallel execution using subprocesses. | ||
- Aggregate test results from temporary files. | ||
- Use a spinner for user feedback during result aggregation. | ||
|
||
## Decision Outcome | ||
|
||
- Implemented parallel test execution using subprocesses. | ||
- Each test creates a temporary directory to store results, later aggregated. | ||
|
||
### Positive Consequences | ||
|
||
- Reduced test execution time considerably. | ||
- Clear feedback via a spinner during aggregation. | ||
|
||
### Negative Consequences | ||
|
||
- Potential complexity | ||
- with handling temporary files during interruptions. | ||
- in handling temporary files and managing subprocesses. | ||
|
||
## Technical Details | ||
|
||
When the `--parallel` flag is used, each test is run in its own subprocess by calling: | ||
|
||
> runner::call_test_functions "$test_file" "$filter" 2>/dev/null & | ||
Each test script creates a temporary directory and stores individual test results in temp files. | ||
After all tests finish, the results are aggregated by traversing these directories and files. | ||
This approach ensures isolation of test execution while improving performance by running tests concurrently. | ||
|
||
The aggregation (which collects all test outcomes into a final result set) is handled by the function: | ||
|
||
> parallel::aggregate_test_results "$TEMP_DIR_PARALLEL_TEST_SUITE" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.