Skip to content

Commit

Permalink
update test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
linkxzhou committed Feb 22, 2024
1 parent 32b9637 commit 2688035
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,10 @@ Function:
Example:
Client Request Example:
./http_bench -c 1 -n 1 "https://127.0.0.1:18090?data={{ randomDate \"YMD\"}}" -verbose 0
./http_bench -c 1 -n 1 "https://127.0.0.1:18090?data={{ randomDate 'YMD' }}" -verbose 0
Body Request Example:
./http_bench -c 1 -n 1 "https://127.0.0.1:18090" -body "data={{ randomDate \"YMD\" }}" -verbose 0
./http_bench -c 1 -n 1 "https://127.0.0.1:18090" -body "data={{ randomDate 'YMD' }}" -verbose 0
```

**(4) randomString**
Expand Down Expand Up @@ -221,10 +221,10 @@ Function:
Example:
Client Request Example:
./http_bench -c 1 -n 1 "https://127.0.0.1:18090?data={{ date \"YMD\" }}" -verbose 0
./http_bench -c 1 -n 1 "https://127.0.0.1:18090?data={{ date 'YMD' }}" -verbose 0
Body Request Example:
./http_bench -c 1 -n 1 "https://127.0.0.1:18090" -body "data={{ date \"YMD\" }}" -verbose 0
./http_bench -c 1 -n 1 "https://127.0.0.1:18090" -body "data={{ date 'YMD' }}" -verbose 0
```

**(7) UUID**
Expand Down
8 changes: 4 additions & 4 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,10 @@ Function:
Example:
Client Request Example:
./http_bench -c 1 -n 1 "https://127.0.0.1:18090?data={{ randomDate \"YMD\"}}" -verbose 0
./http_bench -c 1 -n 1 "https://127.0.0.1:18090?data={{ randomDate 'YMD' }}" -verbose 0
Body Request Example:
./http_bench -c 1 -n 1 "https://127.0.0.1:18090" -body "data={{ randomDate \"YMD\" }}" -verbose 0
./http_bench -c 1 -n 1 "https://127.0.0.1:18090" -body "data={{ randomDate 'YMD' }}" -verbose 0
```

**(4) 生成指定大小的随机字符串**
Expand Down Expand Up @@ -212,10 +212,10 @@ Function:
Example:
Client Request Example:
./http_bench -c 1 -n 1 "https://127.0.0.1:18090?data={{ date \"YMD\" }}" -verbose 0
./http_bench -c 1 -n 1 "https://127.0.0.1:18090?data={{ date 'YMD' }}" -verbose 0
Body Request Example:
./http_bench -c 1 -n 1 "https://127.0.0.1:18090" -body "data={{ date \"YMD\" }}" -verbose 0
./http_bench -c 1 -n 1 "https://127.0.0.1:18090" -body "data={{ date 'YMD' }}" -verbose 0
```

**(7) UUID标识(如果异常返回一个唯一随机字符串)**
Expand Down
3 changes: 2 additions & 1 deletion http_bench_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@ func tcpHandleConnection(conn net.Conn) error {
func TestStressTCP(t *testing.T) {
name := "tcp"
body := "this is stress body"
bodyHex := "746869732069732073747265737320626f6479"
listen := "127.0.0.1:18091"
srv, err := net.Listen("tcp", listen)
if err != nil {
Expand Down Expand Up @@ -389,7 +390,7 @@ func TestStressTCP(t *testing.T) {
isErr: false,
},
{
args: fmt.Sprintf(`-c 1 -d %ds -p %s -body "{{ stringToHex '%s' }}" -url %s`, duration, name, body, listen),
args: fmt.Sprintf(`-c 1 -d %ds -p %s -bodytype hex -body %s -url %s`, duration, name, bodyHex, listen),
isErr: false,
},
} {
Expand Down
3 changes: 1 addition & 2 deletions http_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,7 @@ func hexToString(hexStr string) string {

func stringToHex(s string) string {
data := []byte(s)
hexStr := hex.EncodeToString(data)
return hexStr
return hex.EncodeToString(data)
}

func parseTime(timeStr string) int64 {
Expand Down

0 comments on commit 2688035

Please sign in to comment.