Get objects in a bucket for a rewind date Test (#1766)
* Get objects in a bucket for a rewind date Test * Incrementing the coverage
This commit is contained in:
committed by
GitHub
parent
d22f345d4a
commit
2765fb0c97
2
.github/workflows/jobs.yaml
vendored
2
.github/workflows/jobs.yaml
vendored
@@ -1065,7 +1065,7 @@ jobs:
|
||||
result=${result%\%}
|
||||
echo "result:"
|
||||
echo $result
|
||||
threshold=52.7
|
||||
threshold=53.00
|
||||
if (( $(echo "$result >= $threshold" |bc -l) )); then
|
||||
echo "It is equal or greater than threshold, passed!"
|
||||
else
|
||||
|
||||
@@ -3573,3 +3573,47 @@ func TestAccessRule(t *testing.T) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func GetBucketRewind(bucketName string, date string) (*http.Response, error) {
|
||||
/*
|
||||
Helper function to get objects in a bucket for a rewind date
|
||||
HTTP Verb: GET
|
||||
URL: /buckets/{bucket_name}/rewind/{date}
|
||||
*/
|
||||
request, err := http.NewRequest(
|
||||
"GET",
|
||||
"http://localhost:9090/api/v1/buckets/"+bucketName+"/rewind/"+date,
|
||||
nil,
|
||||
)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
|
||||
request.Header.Add("Content-Type", "application/json")
|
||||
client := &http.Client{
|
||||
Timeout: 2 * time.Second,
|
||||
}
|
||||
response, err := client.Do(request)
|
||||
return response, err
|
||||
}
|
||||
|
||||
func TestGetBucketRewind(t *testing.T) {
|
||||
|
||||
// Variables
|
||||
assert := assert.New(t)
|
||||
bucketName := "test-get-bucket-rewind"
|
||||
date := "2006-01-02T15:04:05Z"
|
||||
|
||||
// Test
|
||||
resp, err := GetBucketRewind(bucketName, date)
|
||||
assert.Nil(err)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
if resp != nil {
|
||||
assert.Equal(
|
||||
200, resp.StatusCode, inspectHTTPResponse(resp))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user