Skip to content

Commit

Permalink
test: add run cases (#60)
Browse files Browse the repository at this point in the history
Co-authored-by: will-2012-nr <will.nodereal@gmail.com>
  • Loading branch information
will-2012 and xibao-nr committed Feb 10, 2023
1 parent 1a416e9 commit da57b46
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions test/e2e/services/case_driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ func runCase1() {
log.Errorw("get object failed, due to sign signature", "error", err)
return
}

res, err := client.Do(req)
if err != nil {
log.Errorw("get object failed, due to send request", "error", err)
Expand Down Expand Up @@ -207,13 +208,15 @@ func runCase2() {
log.Errorw("put object failed, due to sign signature", "error", err)
return
}

res, err := client.Do(req)
if err != nil {
log.Errorw("put object failed, due to send request", "error", err)
return
}
defer res.Body.Close()
_, err = io.ReadAll(res.Body)

if err != nil {
log.Errorw("put object failed, due to read response body", "error", err)
return
Expand All @@ -227,6 +230,7 @@ func runCase2() {
log.Infow("start get object")
url := "http://" + gatewayAddress + "/case2"
method := getMethod

client := &http.Client{}
req, err := http.NewRequest(method, url, strings.NewReader(""))
if err != nil {
Expand All @@ -238,6 +242,7 @@ func runCase2() {
log.Errorw("get object failed, due to sign signature", "error", err)
return
}

res, err := client.Do(req)
if err != nil {
log.Errorw("get object failed, due to send request", "error", err)
Expand Down Expand Up @@ -307,13 +312,15 @@ func runCase3() {
log.Errorw("put object failed, due to sign signature", "error", err)
return
}

res, err := client.Do(req)
if err != nil {
log.Errorw("put object failed, due to send request", "error", err)
return
}
defer res.Body.Close()
_, err = io.ReadAll(res.Body)

if err != nil {
log.Errorw("put object failed, due to read response body", "error", err)
return
Expand All @@ -327,6 +334,7 @@ func runCase3() {
log.Infow("start get object")
url := "http://" + gatewayAddress + "/case3"
method := getMethod

client := &http.Client{}
req, err := http.NewRequest(method, url, strings.NewReader(""))
if err != nil {
Expand All @@ -338,6 +346,7 @@ func runCase3() {
log.Errorw("get object failed, due to sign signature", "error", err)
return
}

res, err := client.Do(req)
if err != nil {
log.Errorw("get object failed, due to send request", "error", err)
Expand Down

0 comments on commit da57b46

Please sign in to comment.