From 50bc755b44d00d926dcc8692a5be7316eb98e6ee Mon Sep 17 00:00:00 2001 From: Cesar Celis Hernandez Date: Mon, 18 Apr 2022 10:25:21 -0400 Subject: [PATCH] Test invalid url in getWatchOptionsFromReq() (#1850) --- .github/workflows/jobs.yaml | 2 +- restapi/user_watch_test.go | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/jobs.yaml b/.github/workflows/jobs.yaml index 4a953e97c..de9c610fa 100644 --- a/.github/workflows/jobs.yaml +++ b/.github/workflows/jobs.yaml @@ -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 diff --git a/restapi/user_watch_test.go b/restapi/user_watch_test.go index b80bb7eb0..d0a2b76c6 100644 --- a/restapi/user_watch_test.go +++ b/restapi/user_watch_test.go @@ -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) }