From 53657d74317f83b8fbc2340c7716762cb72c6d60 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 24 Mar 2026 16:18:14 +0000 Subject: [PATCH 1/2] Initial plan From c0c3f3c5e9e9b29af3beca435607716f81446321 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 24 Mar 2026 16:25:42 +0000 Subject: [PATCH 2/2] feat(wftest): add schedule and event trigger types to YAML runner Co-authored-by: intel352 <77607+intel352@users.noreply.github.com> Agent-Logs-Url: https://github.com/GoCodeAlone/workflow/sessions/9b9c11ba-fdb7-42ff-92d6-aee0baa7bc65 --- wftest/yaml_runner.go | 14 +++++ wftest/yaml_runner_test.go | 115 +++++++++++++++++++++++++++++++++++++ 2 files changed, 129 insertions(+) diff --git a/wftest/yaml_runner.go b/wftest/yaml_runner.go index 216abaee..6ee851fd 100644 --- a/wftest/yaml_runner.go +++ b/wftest/yaml_runner.go @@ -199,6 +199,20 @@ func fireTrigger(t *testing.T, h *Harness, tc *TestCase) *Result { } return h.POST(tc.Trigger.Path, body, reqOpts...) + 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) + default: t.Fatalf("RunYAMLTests: unsupported trigger type %q", tc.Trigger.Type) return nil diff --git a/wftest/yaml_runner_test.go b/wftest/yaml_runner_test.go index 408214ea..9fee1521 100644 --- a/wftest/yaml_runner_test.go +++ b/wftest/yaml_runner_test.go @@ -221,6 +221,121 @@ func TestYAMLRunner_StatefulTestData(t *testing.T) { wftest.RunYAMLTests(t, "testdata/stateful_test.yaml") } +func TestRunYAMLTests_ScheduleTrigger(t *testing.T) { + tmpDir := t.TempDir() + writeFile(t, tmpDir+"/schedule_test.yaml", ` +yaml: | + pipelines: + cleanup-sessions: + steps: + - name: run + type: step.set + config: + values: + status: completed +tests: + cleanup-job: + trigger: + type: schedule + name: cleanup-sessions + assertions: + - output: + status: completed +`) + wftest.RunYAMLTests(t, tmpDir+"/schedule_test.yaml") +} + +func TestRunYAMLTests_ScheduleTriggerWithData(t *testing.T) { + tmpDir := t.TempDir() + writeFile(t, tmpDir+"/schedule_data_test.yaml", ` +yaml: | + pipelines: + parameterized-job: + steps: + - name: echo + type: step.set + config: + values: + got: "{{ .param1 }}" +tests: + job-with-params: + trigger: + type: schedule + name: parameterized-job + data: + param1: value1 + assertions: + - output: + got: value1 +`) + wftest.RunYAMLTests(t, tmpDir+"/schedule_data_test.yaml") +} + +func TestRunYAMLTests_EventTrigger(t *testing.T) { + tmpDir := t.TempDir() + writeFile(t, tmpDir+"/event_test.yaml", ` +yaml: | + pipelines: + on-submission: + trigger: + type: eventbus + config: + topic: forms.submission.created + steps: + - name: process + type: step.set + config: + values: + handled: true + form_id: "{{ .form_id }}" +tests: + submission-event: + trigger: + type: event + name: forms.submission.created + data: + affiliate_id: sampleaff1 + form_id: form-uuid-1 + assertions: + - output: + handled: true + form_id: form-uuid-1 +`) + wftest.RunYAMLTests(t, tmpDir+"/event_test.yaml") +} + +func TestRunYAMLTests_EventbusTriggerAlias(t *testing.T) { + tmpDir := t.TempDir() + writeFile(t, tmpDir+"/eventbus_test.yaml", ` +yaml: | + pipelines: + on-user-created: + trigger: + type: eventbus + config: + topic: user.created + steps: + - name: log_event + type: step.set + config: + values: + handled: true + user_id: "{{ .user_id }}" +tests: + user-created: + trigger: + type: eventbus + name: user.created + data: + user_id: "123" + assertions: + - output: + handled: true + user_id: "123" +`) + wftest.RunYAMLTests(t, tmpDir+"/eventbus_test.yaml") +} + func writeFile(t *testing.T, path, content string) { t.Helper() if err := os.WriteFile(path, []byte(content), 0o644); err != nil {