Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

citool: Rename workflows to triggers #1152

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions tools/citool/cmd/csv_export_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions tools/citool/cmd/filter_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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 {
Expand Down
6 changes: 3 additions & 3 deletions tools/citool/cmd/filter_cmd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions tools/citool/cmd/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand All @@ -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 {
Expand Down
Loading