Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,8 @@ func (o *runOption) runSuite(loader testing.Loader, dataContext map[string]inter
default:
o.limiter.Accept()

ctxWithTimeout, _ := context.WithTimeout(ctx, o.requestTimeout)
ctxWithTimeout, cancel := context.WithTimeout(ctx, o.requestTimeout)
defer cancel() // Ensure context is always cancelled when leaving this scope
ctxWithTimeout = context.WithValue(ctxWithTimeout, runner.ContextKey("").ParentDir(), loader.GetContext())

output, err = suiteRunner.RunTestCase(&testCase, dataContext, ctxWithTimeout)
Expand Down
74 changes: 37 additions & 37 deletions pkg/mock/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,65 +16,65 @@ limitations under the License.
package mock

type Object struct {
Name string `yaml:"name" json:"name"`
InitCount *int `yaml:"initCount" json:"initCount"`
Sample string `yaml:"sample" json:"sample"`
Name string `yaml:"name" json:"name"`
InitCount *int `yaml:"initCount" json:"initCount"`
Sample string `yaml:"sample" json:"sample"`
}

type Item struct {
Name string `yaml:"name" json:"name"`
Request Request `yaml:"request" json:"request"`
Response Response `yaml:"response" json:"response"`
Param map[string]interface{}
Name string `yaml:"name" json:"name"`
Request Request `yaml:"request" json:"request"`
Response Response `yaml:"response" json:"response"`
Param map[string]interface{}
}

type Request struct {
Protocol string `yaml:"protocol" json:"protocol"`
Path string `yaml:"path" json:"path"`
Method string `yaml:"method" json:"method"`
Header map[string]string `yaml:"header" json:"header"`
Body string `yaml:"body" json:"body"`
Protocol string `yaml:"protocol" json:"protocol"`
Path string `yaml:"path" json:"path"`
Method string `yaml:"method" json:"method"`
Header map[string]string `yaml:"header" json:"header"`
Body string `yaml:"body" json:"body"`
}

type RequestWithAuth struct {
Request `yaml:",inline"`
BearerAPI string `yaml:"bearerAPI" json:"bearerAPI"`
Username string `yaml:"username" json:"username"`
Password string `yaml:"password" json:"password"`
Request `yaml:",inline"`
BearerAPI string `yaml:"bearerAPI" json:"bearerAPI"`
Username string `yaml:"username" json:"username"`
Password string `yaml:"password" json:"password"`
}

type Response struct {
Encoder string `yaml:"encoder" json:"encoder"`
Body string `yaml:"body" json:"body"`
BodyFromFile string `yaml:"bodyFromFile" json:"bodyFromFile"`
Header map[string]string `yaml:"header" json:"header"`
StatusCode int `yaml:"statusCode" json:"statusCode"`
BodyData []byte
Encoder string `yaml:"encoder" json:"encoder"`
Body string `yaml:"body" json:"body"`
BodyFromFile string `yaml:"bodyFromFile" json:"bodyFromFile"`
Header map[string]string `yaml:"header" json:"header"`
StatusCode int `yaml:"statusCode" json:"statusCode"`
BodyData []byte
}

type Webhook struct {
Name string `yaml:"name" json:"name"`
Timer string `yaml:"timer" json:"timer"`
Param map[string]string `yaml:"param" json:"param"`
Request RequestWithAuth `yaml:"request" json:"request"`
Name string `yaml:"name" json:"name"`
Timer string `yaml:"timer" json:"timer"`
Param map[string]string `yaml:"param" json:"param"`
Request RequestWithAuth `yaml:"request" json:"request"`
}

type Proxy struct {
Prefix string `yaml:"prefix" json:"prefix"`
Port int `yaml:"port" json:"port"`
Path string `yaml:"path" json:"path"`
Target string `yaml:"target" json:"target"`
RequestAmend RequestAmend `yaml:"requestAmend" json:"requestAmend"`
Protocol string `yaml:"protocol" json:"protocol"`
Prefix string `yaml:"prefix" json:"prefix"`
Port int `yaml:"port" json:"port"`
Path string `yaml:"path" json:"path"`
Target string `yaml:"target" json:"target"`
RequestAmend RequestAmend `yaml:"requestAmend" json:"requestAmend"`
Protocol string `yaml:"protocol" json:"protocol"`
}

type RequestAmend struct {
BodyPatch string `yaml:"bodyPatch" json:"bodyPatch"`
BodyPatch string `yaml:"bodyPatch" json:"bodyPatch"`
}

type Server struct {
Objects []Object `yaml:"objects" json:"objects"`
Items []Item `yaml:"items" json:"items"`
Proxies []Proxy `yaml:"proxies" json:"proxies"`
Webhooks []Webhook `yaml:"webhooks" json:"webhooks"`
Objects []Object `yaml:"objects" json:"objects"`
Items []Item `yaml:"items" json:"items"`
Proxies []Proxy `yaml:"proxies" json:"proxies"`
Webhooks []Webhook `yaml:"webhooks" json:"webhooks"`
}
Loading