Skip to content

Commit 2abc4cd

Browse files
committed
fix
1 parent bb4e3ff commit 2abc4cd

4 files changed

Lines changed: 16 additions & 14 deletions

File tree

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ $(ALL_RESULTS_TARGETS):
4545

4646
.PHONY: build lint clean testrun test dist test-xunit package
4747

48-
build: ## build all components and push them into dist directory
48+
build: clean ## build all components and push them into dist directory
4949
$(info Building Component venom)
5050
$(MAKE) build -C cmd/venom
5151
$(MAKE) dist

executors/tavern/assert.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ func init() {
1818
// AssertResponse compares expected and actual responses and raises an error
1919
// if assertion fails
2020
func AssertResponse(actual interface{}, expected ...interface{}) error {
21+
2122
result, ok := actual.(Result)
2223
if !ok {
2324
return fmt.Errorf("bad actual type: expected: Result, actual: %T", actual)
@@ -209,7 +210,7 @@ func PathToRegexp(path string) string {
209210
}
210211

211212
// ElementInList tells if given path is in filters list
212-
func ElementInList(path string, filters[]string) bool {
213+
func ElementInList(path string, filters []string) bool {
213214
for _, filter := range filters {
214215
if filter == path {
215216
return true
@@ -234,4 +235,4 @@ func CheckAssertions(expected Response) error {
234235
}
235236
}
236237
return nil
237-
}
238+
}

executors/tavern/tavern.go

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ func (Executor) ZeroValueResult() interface{} {
101101

102102
// GetDefaultAssertions return default assertions for this executor
103103
func (Executor) GetDefaultAssertions() *venom.StepAssertions {
104-
return &venom.StepAssertions{Assertions: []venom.Assertion{"result AssertResponse"}}
104+
return &venom.StepAssertions{Assertions: []venom.Assertion{}}
105105
}
106106

107107
// Run execute TestStep
@@ -114,7 +114,10 @@ func (Executor) Run(ctx context.Context, step venom.TestStep) (interface{}, erro
114114

115115
// dirty: mapstructure doesn't like decoding map[interface{}]interface{}, let's force manually
116116
request := step["request"]
117-
mapRequest := request.(map[string]interface{})
117+
mapRequest, ok := request.(map[string]interface{})
118+
if !ok {
119+
return nil, fmt.Errorf("request is not map[string]interface{}")
120+
}
118121
e.Request.MultipartForm = mapRequest["multipart_form"]
119122

120123
r := Result{}
@@ -143,9 +146,9 @@ func (Executor) Run(ctx context.Context, step venom.TestStep) (interface{}, erro
143146
}
144147

145148
if e.Request.TLS.ClientCert != "" {
146-
cert, err := tls.X509KeyPair([]byte(e.Request.TLS.ClientCert), []byte(e.Request.TLS.ClientKey))
147-
if err != nil {
148-
return nil, fmt.Errorf("failed to parse x509 mTLS certificate or key: %s", err)
149+
cert, errB := tls.X509KeyPair([]byte(e.Request.TLS.ClientCert), []byte(e.Request.TLS.ClientKey))
150+
if errB != nil {
151+
return nil, fmt.Errorf("failed to parse x509 mTLS certificate or key: %s", errB)
149152
}
150153
opts = append(opts, httputil.WithTLSClientAuth(cert))
151154
}
@@ -192,9 +195,9 @@ func (Executor) Run(ctx context.Context, step venom.TestStep) (interface{}, erro
192195
}
193196

194197
if len(e.Request.Proxy) > 0 {
195-
proxyURL, err := url.Parse(e.Request.Proxy)
196-
if err != nil {
197-
return nil, err
198+
proxyURL, errB := url.Parse(e.Request.Proxy)
199+
if errB != nil {
200+
return nil, errB
198201
}
199202
tr.Proxy = http.ProxyURL(proxyURL)
200203
}

process.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,15 +167,13 @@ func (v *Venom) Parse(ctx context.Context, path []string) error {
167167
func (v *Venom) Process(ctx context.Context, path []string) error {
168168
v.Tests.Status = StatusRun
169169
v.Tests.Start = time.Now()
170-
var vars H
171170
Debug(ctx, "nb testsuites: %d", len(v.Tests.TestSuites))
172171
for i := range v.Tests.TestSuites {
173172

174-
v.Tests.TestSuites[i].Vars = vars
175173
v.Tests.TestSuites[i].Start = time.Now()
176174
// ##### RUN Test Suite Here
177175
v.runTestSuite(ctx, &v.Tests.TestSuites[i])
178-
vars.AddAll(v.Tests.TestSuites[i].ComputedVars)
176+
v.AddVariables(v.Tests.TestSuites[i].ComputedVars)
179177

180178
v.Tests.TestSuites[i].End = time.Now()
181179
v.Tests.TestSuites[i].Duration = v.Tests.TestSuites[i].End.Sub(v.Tests.TestSuites[i].Start).Seconds()

0 commit comments

Comments
 (0)