Test invalid url in getWatchOptionsFromReq() (#1850)

This commit is contained in:
Cesar Celis Hernandez
2022-04-18 10:25:21 -04:00
committed by GitHub
parent f02461097b
commit 50bc755b44
2 changed files with 9 additions and 1 deletions

View File

@@ -1142,7 +1142,7 @@ jobs:
result=${result%\%}
echo "result:"
echo $result
threshold=35.60
threshold=35.9
if (( $(echo "$result >= $threshold" |bc -l) )); then
echo "It is equal or greater than threshold, passed!"
else

View File

@@ -289,4 +289,12 @@ func TestWatch(t *testing.T) {
assert.Equal(expectedOptions.Suffix, opts.Suffix)
assert.Equal(expectedOptions.Events, opts.Events)
}
// Test-9: getWatchOptionsFromReq invalid url
u, err = url.Parse("http://localhost/api/v1/wach/bucket2?prefix=&suffix=")
req = &http.Request{
URL: u,
}
opts, err = getWatchOptionsFromReq(req)
assert.Error(err)
}