Skip to content

Commit c1b32b8

Browse files
committed
tests 5
Signed-off-by: Julio Jimenez <julio@clickhouse.com>
1 parent 30c73f0 commit c1b32b8

2 files changed

Lines changed: 40 additions & 0 deletions

File tree

license-mappings.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -543,6 +543,12 @@
543543
"github.com/joho/godotenv": "MIT",
544544
"github.com/jonboulle/clockwork": "Apache-2.0",
545545
"github.com/josharian/intern": "MIT",
546+
"github.com/josharian/native": "MIT",
547+
"github.com/jpillora/backoff": "MIT",
548+
"github.com/jsimonetti/rtnetlink": "MIT",
549+
"github.com/json-iterator/go": "MIT",
550+
"github.com/jsummers/gobmp": "MIT",
551+
"github.com/julz/importas": "Apache-2.0",
546552
"github.com/klauspost/compress": "BSD-3-Clause",
547553
"github.com/lufia/plan9stats": "BSD-3-Clause",
548554
"github.com/magiconair/properties": "BSD-2-Clause",

test/advanced.bats

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -651,6 +651,40 @@ EOF
651651
[[ "$output" == *"Input sanitization completed successfully"* ]]
652652
}
653653

654+
# Test 22a: Diagnostic test for range checking
655+
@test "diagnostic test for range checking" {
656+
export MEND_MAX_WAIT_TIME="8000" # Too high (max is 7200)
657+
export DEBUG="true" # Enable debug output
658+
659+
run sanitize_inputs
660+
661+
# Debug output
662+
echo "Status: $status"
663+
echo "Output: $output"
664+
665+
# This should fail if range checking works
666+
[ "$status" -eq 1 ]
667+
[[ "$output" == *"out of range"* ]]
668+
}
669+
670+
# Test 22b: Test with valid value to ensure function works
671+
@test "sanitize_inputs accepts valid numeric values" {
672+
export MEND_MAX_WAIT_TIME="1800" # Valid (within 60-7200 range)
673+
674+
run sanitize_inputs
675+
[ "$status" -eq 0 ]
676+
[[ "$output" == *"Input sanitization completed successfully"* ]]
677+
}
678+
679+
# Test 22c: Test with value below minimum
680+
@test "sanitize_inputs rejects value below minimum" {
681+
export MEND_MAX_WAIT_TIME="30" # Too low (min is 60)
682+
683+
run sanitize_inputs
684+
[ "$status" -eq 1 ]
685+
[[ "$output" == *"out of range"* ]]
686+
}
687+
654688
# Test 23: sanitize_inputs skips empty values
655689
@test "sanitize_inputs skips empty values" {
656690
export REPOSITORY=""

0 commit comments

Comments
 (0)