diff --git a/api/v1/testkube.yaml b/api/v1/testkube.yaml index 8cc267bc08..fbedd3782f 100644 --- a/api/v1/testkube.yaml +++ b/api/v1/testkube.yaml @@ -8244,7 +8244,7 @@ components: description: running context for the test workflow execution (Pro edition only) $ref: "#/components/schemas/TestWorkflowRunningContext" config: - $ref: "#/components/schemas/TestWorkflowConfigValue" + $ref: "#/components/schemas/TestWorkflowExecutionConfig" required: - id - name @@ -8283,7 +8283,7 @@ components: description: running context for the test workflow execution (Pro edition only) $ref: "#/components/schemas/TestWorkflowRunningContext" config: - $ref: "#/components/schemas/TestWorkflowConfigValue" + $ref: "#/components/schemas/TestWorkflowExecutionConfig" required: - id - name @@ -9518,6 +9518,24 @@ components: items: $ref: "#/components/schemas/VolumeMount" + TestWorkflowExecutionConfig: + type: object + description: map of configuration values used in the test workflow execution + additionalProperties: + $ref: "#/components/schemas/TestWorkflowExecutionConfigValue" + + TestWorkflowExecutionConfigValue: + type: object + description: configuration values used in the test workflow execution + properties: + value: + type: string + description: configuration value + defaultValue: + type: string + description: configuration value default + + TestWorkflowConfigValue: type: object description: configuration values to pass to the template diff --git a/pkg/api/v1/testkube/model_test_workflow_execution.go b/pkg/api/v1/testkube/model_test_workflow_execution.go index 35fdd19bdb..0a518fa08f 100644 --- a/pkg/api/v1/testkube/model_test_workflow_execution.go +++ b/pkg/api/v1/testkube/model_test_workflow_execution.go @@ -40,8 +40,8 @@ type TestWorkflowExecution struct { // test workflow execution name started the test workflow execution TestWorkflowExecutionName string `json:"testWorkflowExecutionName,omitempty"` // whether webhooks on the execution of this test workflow are disabled - DisableWebhooks bool `json:"disableWebhooks,omitempty"` - Tags map[string]string `json:"tags,omitempty"` - RunningContext *TestWorkflowRunningContext `json:"runningContext,omitempty"` - Config map[string]string `json:"config,omitempty"` + DisableWebhooks bool `json:"disableWebhooks,omitempty"` + Tags map[string]string `json:"tags,omitempty"` + RunningContext *TestWorkflowRunningContext `json:"runningContext,omitempty"` + Config map[string]TestWorkflowExecutionConfigValue `json:"config,omitempty"` } diff --git a/pkg/api/v1/testkube/model_test_workflow_execution_config.go b/pkg/api/v1/testkube/model_test_workflow_execution_config.go new file mode 100644 index 0000000000..2a44e2fd0b --- /dev/null +++ b/pkg/api/v1/testkube/model_test_workflow_execution_config.go @@ -0,0 +1,18 @@ +/* + * Testkube API + * + * Testkube provides a Kubernetes-native framework for test definition, execution and results + * + * API version: 1.0.0 + * Contact: testkube@kubeshop.io + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package testkube + +// configuration values used in the test workflow execution +type TestWorkflowExecutionConfig struct { + // configuration value + Value string `json:"value,omitempty"` + // configuration value + DefaultValue string `json:"defaultValue,omitempty"` +} diff --git a/pkg/api/v1/testkube/model_test_workflow_execution_config_value.go b/pkg/api/v1/testkube/model_test_workflow_execution_config_value.go new file mode 100644 index 0000000000..d4e046dc38 --- /dev/null +++ b/pkg/api/v1/testkube/model_test_workflow_execution_config_value.go @@ -0,0 +1,18 @@ +/* + * Testkube API + * + * Testkube provides a Kubernetes-native framework for test definition, execution and results + * + * API version: 1.0.0 + * Contact: testkube@kubeshop.io + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package testkube + +// configuration values used in the test workflow execution +type TestWorkflowExecutionConfigValue struct { + // configuration value + Value string `json:"value,omitempty"` + // configuration value default + DefaultValue string `json:"defaultValue,omitempty"` +} diff --git a/pkg/api/v1/testkube/model_test_workflow_execution_summary.go b/pkg/api/v1/testkube/model_test_workflow_execution_summary.go index 2b80e5db8c..4a2e5fa43d 100644 --- a/pkg/api/v1/testkube/model_test_workflow_execution_summary.go +++ b/pkg/api/v1/testkube/model_test_workflow_execution_summary.go @@ -23,10 +23,10 @@ type TestWorkflowExecutionSummary struct { // when the execution has been scheduled to run ScheduledAt time.Time `json:"scheduledAt,omitempty"` // when the execution result's status has changed last time (queued, passed, failed) - StatusAt time.Time `json:"statusAt,omitempty"` - Result *TestWorkflowResultSummary `json:"result,omitempty"` - Workflow *TestWorkflowSummary `json:"workflow"` - Tags map[string]string `json:"tags,omitempty"` - RunningContext *TestWorkflowRunningContext `json:"runningContext,omitempty"` - Config map[string]string `json:"config,omitempty"` + StatusAt time.Time `json:"statusAt,omitempty"` + Result *TestWorkflowResultSummary `json:"result,omitempty"` + Workflow *TestWorkflowSummary `json:"workflow"` + Tags map[string]string `json:"tags,omitempty"` + RunningContext *TestWorkflowRunningContext `json:"runningContext,omitempty"` + Config map[string]TestWorkflowExecutionConfigValue `json:"config,omitempty"` } diff --git a/pkg/api/v1/testkube/model_test_workflow_step_execute_test_workflow_ref.go b/pkg/api/v1/testkube/model_test_workflow_step_execute_test_workflow_ref.go index be1e4454f7..b3da4c48f3 100644 --- a/pkg/api/v1/testkube/model_test_workflow_step_execute_test_workflow_ref.go +++ b/pkg/api/v1/testkube/model_test_workflow_step_execute_test_workflow_ref.go @@ -18,11 +18,11 @@ type TestWorkflowStepExecuteTestWorkflowRef struct { ExecutionName string `json:"executionName,omitempty"` Tarball map[string]TestWorkflowTarballRequest `json:"tarball,omitempty"` Config map[string]string `json:"config,omitempty"` + Selector *LabelSelector `json:"selector,omitempty"` Count *BoxedString `json:"count,omitempty"` MaxCount *BoxedString `json:"maxCount,omitempty"` // matrix of parameters to spawn instances Matrix map[string]interface{} `json:"matrix,omitempty"` // parameters that should be distributed across sharded instances - Shards map[string]interface{} `json:"shards,omitempty"` - Selector *LabelSelector `json:"selector,omitempty"` + Shards map[string]interface{} `json:"shards,omitempty"` } diff --git a/pkg/testworkflows/testworkflowexecutor/executor.go b/pkg/testworkflows/testworkflowexecutor/executor.go index e0bb794af5..4f0bd8883e 100644 --- a/pkg/testworkflows/testworkflowexecutor/executor.go +++ b/pkg/testworkflows/testworkflowexecutor/executor.go @@ -474,20 +474,19 @@ func (e *executor) initialize(ctx context.Context, workflow *testworkflowsv1.Tes if testworkflows.CountMapBytes(request.Config) < ConfigSizeLimit { storeConfig := true schema := workflow.Spec.Config - config := make(map[string]string) - for k, v := range schema { + config := make(map[string]testkube.TestWorkflowExecutionConfigValue) + for _, v := range schema { if v.Sensitive { storeConfig = false break } - if v.Default != nil { - config[k] = v.Default.String() - } } for k, v := range request.Config { if _, ok := schema[k]; ok { - config[k] = v + config[k] = testkube.TestWorkflowExecutionConfigValue{ + Value: v, + } } }