From 83100a879006dde55ace09a5dfd99b37e62f5a3f Mon Sep 17 00:00:00 2001 From: Lukasz <120112546+lukaszcl@users.noreply.github.com> Date: Tue, 24 Sep 2024 13:44:37 +0200 Subject: [PATCH] citool: Rename workflows to triggers (#1152) --- tools/citool/cmd/csv_export_cmd.go | 6 +++--- tools/citool/cmd/filter_cmd.go | 4 ++-- tools/citool/cmd/filter_cmd_test.go | 6 +++--- tools/citool/cmd/types.go | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/tools/citool/cmd/csv_export_cmd.go b/tools/citool/cmd/csv_export_cmd.go index 29e16397b..a86a446a5 100644 --- a/tools/citool/cmd/csv_export_cmd.go +++ b/tools/citool/cmd/csv_export_cmd.go @@ -55,14 +55,14 @@ func exportConfigToCSV(configFile string) error { defer writer.Flush() // Write CSV headers - headers := []string{"ID", "Test Path", "Test Env Type", "Runs On", "Test Cmd", "Test Config Override Required", "Test Secrets Required", "Remote Runner Memory", "Pyroscope Env", "Workflows", "Test Inputs"} + headers := []string{"ID", "Test Path", "Test Env Type", "Runs On", "Test Cmd", "Test Config Override Required", "Test Secrets Required", "Remote Runner Memory", "Pyroscope Env", "Triggers", "Test Inputs"} if err := writer.Write(headers); err != nil { return err } // Iterate over Tests and write data to CSV for _, test := range config.Tests { - workflows := strings.Join(test.Workflows, ", ") // Combine workflows into a single CSV field + triggers := strings.Join(test.Triggers, ", ") // Combine workflow triggers into a single CSV field // Serialize TestInputs testInputs := serializeMap(test.TestEnvVars) @@ -76,7 +76,7 @@ func exportConfigToCSV(configFile string) error { fmt.Sprintf("%t", test.TestSecretsRequired), test.RemoteRunnerMemory, test.PyroscopeEnv, - workflows, + triggers, testInputs, } if err := writer.Write(record); err != nil { diff --git a/tools/citool/cmd/filter_cmd.go b/tools/citool/cmd/filter_cmd.go index 20ba6b2a4..36f4558aa 100644 --- a/tools/citool/cmd/filter_cmd.go +++ b/tools/citool/cmd/filter_cmd.go @@ -24,7 +24,7 @@ func filterTests(allTests []CITestConf, workflow, testType, ids string, envresol var filteredTests []CITestConf for _, test := range allTests { - workflowMatch := workflow == "" || contains(test.Workflows, workflowFilter) + workflowMatch := workflow == "" || contains(test.Triggers, workflowFilter) typeMatch := testType == "" || test.TestEnvType == typeFilter idMatch := ids == "*" || ids == "" || contains(idFilter, test.ID) @@ -60,7 +60,7 @@ func filterAndMergeTests(allTests []CITestConf, workflow, testType, base64Tests var filteredTests []CITestConf for _, test := range allTests { - workflowMatch := workflow == "" || contains(test.Workflows, workflow) + workflowMatch := workflow == "" || contains(test.Triggers, workflow) typeMatch := testType == "" || test.TestEnvType == testType if decodedTest, exists := idFilter[test.ID]; exists && workflowMatch && typeMatch { diff --git a/tools/citool/cmd/filter_cmd_test.go b/tools/citool/cmd/filter_cmd_test.go index ff6e9c981..81c9c6307 100644 --- a/tools/citool/cmd/filter_cmd_test.go +++ b/tools/citool/cmd/filter_cmd_test.go @@ -34,9 +34,9 @@ func TestFilterTestsByID(t *testing.T) { func TestFilterTestsIntegration(t *testing.T) { tests := []CITestConf{ - {ID: "run_all_in_ocr_tests_go", TestEnvType: "docker", Workflows: []string{"Run Nightly E2E Tests"}}, - {ID: "run_all_in_ocr2_tests_go", TestEnvType: "docker", Workflows: []string{"Run PR E2E Tests"}}, - {ID: "run_all_in_ocr3_tests_go", TestEnvType: "k8s_remote_runner", Workflows: []string{"Run PR E2E Tests"}}, + {ID: "run_all_in_ocr_tests_go", TestEnvType: "docker", Triggers: []string{"Run Nightly E2E Tests"}}, + {ID: "run_all_in_ocr2_tests_go", TestEnvType: "docker", Triggers: []string{"Run PR E2E Tests"}}, + {ID: "run_all_in_ocr3_tests_go", TestEnvType: "k8s_remote_runner", Triggers: []string{"Run PR E2E Tests"}}, } cases := []struct { diff --git a/tools/citool/cmd/types.go b/tools/citool/cmd/types.go index 3508f9a15..acdd18adc 100644 --- a/tools/citool/cmd/types.go +++ b/tools/citool/cmd/types.go @@ -5,7 +5,7 @@ type Test struct { Path string } -// CITestConf defines the configuration for running a test in a CI environment, specifying details like test ID, path, type, runner settings, command, and associated workflows. +// CITestConf defines the configuration for running a test in a CI environment, specifying details like test ID, path, type, runner settings, command, and associated triggers. type CITestConf struct { ID string `yaml:"id" json:"id"` IDSanitized string `json:"id_sanitized"` @@ -19,7 +19,7 @@ type CITestConf struct { TestEnvVars map[string]string `yaml:"test_env_vars" json:"test_env_vars"` RemoteRunnerMemory string `yaml:"remote_runner_memory" json:"remote_runner_memory"` PyroscopeEnv string `yaml:"pyroscope_env" json:"pyroscope_env"` - Workflows []string `yaml:"workflows" json:"workflows"` + Triggers []string `yaml:"triggers" json:"triggers"` } type Config struct {