Skip to content

Commit

Permalink
feat: remove assertion random str as test_id
Browse files Browse the repository at this point in the history
  • Loading branch information
Chemaclass committed Oct 13, 2024
1 parent 5e21e78 commit 85c255a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 27 deletions.
20 changes: 3 additions & 17 deletions src/runner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ function runner::run_test() {
subshell_output=$line
fi

local runtime_output="${test_execution_result%%##TEST_ID=*}"
local runtime_output="${test_execution_result%%##ASSERTIONS_=*}"

local runtime_error=""
for error in "command not found" "unbound variable" "permission denied" \
Expand Down Expand Up @@ -281,14 +281,7 @@ function runner::parse_result_parallel() {
count=$((count + 1))
done

if env::is_dev_mode_enabled; then
local test_id=$(\
echo "$execution_result" |\
tail -n 1 |\
sed -E -e 's/.*##TEST_ID=([a-zA-Z0-9]*)##.*/\1/g'\
)
log "debug" "[PARA] test_id:$test_id" "function_name:$function_name" "execution_result:$execution_result"
fi
log "debug" "[PARA]" "function_name:$function_name" "execution_result:$execution_result"

runner::parse_result_sync "$function_name" "$execution_result"

Expand Down Expand Up @@ -329,14 +322,7 @@ function runner::parse_result_sync() {
sed -E -e 's/.*##ASSERTIONS_SNAPSHOT=([0-9]*)##.*/\1/g'\
)

if env::is_dev_mode_enabled; then
local test_id=$(\
echo "$execution_result" |\
tail -n 1 |\
sed -E -e 's/.*##TEST_ID=([a-zA-Z0-9]*)##.*/\1/g'\
)
log "debug" "[SYNC] test_id:$test_id" "function_name:$function_name" "execution_result:$execution_result"
fi
log "debug" "[SYNC]" "function_name:$function_name" "execution_result:$execution_result"

((_ASSERTIONS_PASSED += assertions_passed)) || true
((_ASSERTIONS_FAILED += assertions_failed)) || true
Expand Down
4 changes: 0 additions & 4 deletions src/state.sh
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,7 @@ function state::export_subshell_context() {
encoded_test_output=$(echo -n "$_TEST_OUTPUT" | base64)
fi

local test_id
test_id=$(LC_ALL=C tr -dc A-Za-z0-9 </dev/urandom | head -c 8)

cat <<EOF
##TEST_ID=$test_id\
##ASSERTIONS_FAILED=$_ASSERTIONS_FAILED\
##ASSERTIONS_PASSED=$_ASSERTIONS_PASSED\
##ASSERTIONS_SKIPPED=$_ASSERTIONS_SKIPPED\
Expand Down
9 changes: 3 additions & 6 deletions tests/unit/state_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,7 @@ function test_initialize_assertions_count() {
)

assert_same\
"##TEST_ID=abc123\
##ASSERTIONS_FAILED=0\
"##ASSERTIONS_FAILED=0\
##ASSERTIONS_PASSED=0\
##ASSERTIONS_SKIPPED=0\
##ASSERTIONS_INCOMPLETE=0\
Expand All @@ -277,8 +276,7 @@ function test_export_assertions_count() {
)

assert_same\
"##TEST_ID=abc123\
##ASSERTIONS_FAILED=5\
"##ASSERTIONS_FAILED=5\
##ASSERTIONS_PASSED=10\
##ASSERTIONS_SKIPPED=42\
##ASSERTIONS_INCOMPLETE=12\
Expand All @@ -288,8 +286,7 @@ function test_export_assertions_count() {
}

function test_calculate_total_assertions() {
local input="##TEST_ID=abc123\
##ASSERTIONS_FAILED=1\
local input="##ASSERTIONS_FAILED=1\
##ASSERTIONS_PASSED=2\
##ASSERTIONS_SKIPPED=3\
##ASSERTIONS_INCOMPLETE=4\
Expand Down

0 comments on commit 85c255a

Please sign in to comment.