Skip to content

wftest YAML runner: missing schedule and event trigger types #365

@intel352

Description

@intel352

Summary

The YAML test runner (wftest.RunYAMLTests) only supports pipeline and HTTP trigger types. The Harness has FireSchedule() and FireEvent() methods, and the BDD framework wires both via I fire schedule and I fire event steps — but the YAML runner doesn't support them.

Current behavior

tests:
  cleanup-job:
    trigger:
      type: schedule
      name: cleanup-sessions
    assertions:
      - output:
          status: completed

Fails with: RunYAMLTests: unsupported trigger type "schedule"

Expected behavior

Two new trigger types should be supported:

Schedule trigger

trigger:
  type: schedule
  name: cleanup-sessions       # pipeline name
  data:                        # optional params
    param1: value1

Maps to h.FireSchedule(name, data).

Event trigger

trigger:
  type: event
  name: forms.submission.created   # topic
  data:
    affiliate_id: sampleaff1
    form_id: form-uuid-1

Maps to h.FireEvent(topic, data).

Impact

We have 6 scheduled job pipelines and 1 eventbus-triggered pipeline that cannot use the YAML test format. Currently using pipeline triggers as a workaround (same execution but doesn't exercise the schedule/event wiring).

Suggested implementation

Add cases to fireTrigger() in yaml_runner.go:

case "schedule":
    name := tc.Trigger.Name
    if name == "" {
        t.Fatal("RunYAMLTests: trigger.name is required for schedule triggers")
    }
    return h.FireSchedule(name, tc.Trigger.Data)

case "event", "eventbus":
    topic := tc.Trigger.Name
    if topic == "" {
        t.Fatal("RunYAMLTests: trigger.name (topic) is required for event triggers")
    }
    return h.FireEvent(topic, tc.Trigger.Data)

References

  • Harness.FireSchedule(): wftest/events.go:68
  • Harness.FireEvent(): wftest/events.go:20
  • BDD trigger steps: wftest/bdd/steps_trigger.go (lines 13-14, 40-59)

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