fix: error of concurrent map writes occurred while uploading in boom mode

This commit is contained in:
xucong053
2022-06-30 23:29:16 +08:00
parent 14dc566eea
commit ee8cfcae86
4 changed files with 37 additions and 19 deletions

View File

@@ -9,12 +9,13 @@ import (
func TestCaseUploadFile(t *testing.T) {
testcase := &hrp.TestCase{
Config: hrp.NewConfig("test upload file to httpbin").
SetBaseURL("https://httpbin.org"),
SetBaseURL("https://httpbin.org").
WithVariables(map[string]interface{}{"upload_file": "test.env"}),
TestSteps: []hrp.IStep{
hrp.NewStep("upload file").
WithVariables(map[string]interface{}{
"m_encoder": "${multipart_encoder($m_upload)}",
"m_upload": map[string]interface{}{"file": "test.env"},
"m_upload": map[string]interface{}{"file": "$upload_file"},
}).
POST("/post").
WithHeaders(map[string]string{"Content-Type": "${multipart_content_type($m_encoder)}"}).
@@ -24,7 +25,7 @@ func TestCaseUploadFile(t *testing.T) {
AssertStartsWith("body.files.file", "UserName=test", "check uploaded file"),
hrp.NewStep("upload file with keyword").
POST("/post").
WithUpload(map[string]interface{}{"file": "test.env"}).
WithUpload(map[string]interface{}{"file": "$upload_file"}).
Validate().
AssertEqual("status_code", 200, "check status code").
AssertStartsWith("body.files.file", "UserName=test", "check uploaded file"),