Skip to content

wftest YAML runner: missing PUT, PATCH, DELETE, HEAD HTTP trigger types #364

@intel352

Description

@intel352

Summary

The YAML test runner (wftest.RunYAMLTests) only supports pipeline, http.get/get, and http.post/post trigger types. The Harness already has methods for PUT, PATCH, DELETE, and HEAD, and the BDD framework (wftest/bdd) wires all of them — but the YAML runner's fireTrigger() switch doesn't dispatch to them.

Current behavior

tests:
  update-resource:
    trigger:
      type: http.put
      path: /v1/resource/123
      data:
        name: updated
    assertions:
      - response:
          status: 200

Fails with: RunYAMLTests: unsupported trigger type "http.put"

Expected behavior

All HTTP methods supported by the Harness should be available as YAML trigger types:

Trigger type Harness method
http.put / put h.PUT(path, body, opts...)
http.patch / patch h.PATCH(path, body, opts...)
http.delete / delete h.DELETE(path, opts...)
http.head / head h.HEAD(path, opts...)

Impact

We have ~15 BDD scenarios using PUT, PATCH, DELETE, and HEAD triggers that cannot be expressed in the YAML test format. These are currently covered by Gherkin features only.

Suggested implementation

Add cases to fireTrigger() in yaml_runner.go (lines 168–206), following the same pattern as the existing GET/POST cases:

case "http.put", "put":
    body := ""
    if tc.Trigger.Data != nil {
        b, _ := json.Marshal(tc.Trigger.Data)
        body = string(b)
    }
    var reqOpts []RequestOption
    for k, v := range tc.Trigger.Headers {
        reqOpts = append(reqOpts, Header(k, v))
    }
    return h.PUT(tc.Trigger.Path, body, reqOpts...)

case "http.patch", "patch":
    // same pattern as PUT
    return h.PATCH(tc.Trigger.Path, body, reqOpts...)

case "http.delete", "delete":
    var reqOpts []RequestOption
    for k, v := range tc.Trigger.Headers {
        reqOpts = append(reqOpts, Header(k, v))
    }
    return h.DELETE(tc.Trigger.Path, reqOpts...)

case "http.head", "head":
    var reqOpts []RequestOption
    for k, v := range tc.Trigger.Headers {
        reqOpts = append(reqOpts, Header(k, v))
    }
    return h.HEAD(tc.Trigger.Path, reqOpts...)

References

  • Harness methods: wftest/http.go (PUT line 38, DELETE line 45, PATCH line 53, HEAD line 60)
  • BDD HTTP steps: wftest/bdd/steps_http.go (all methods wired)
  • YAML runner: wftest/yaml_runner.go:fireTrigger() (only GET/POST)

Metadata

Metadata

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions