diff --git a/api/v1/testkube.yaml b/api/v1/testkube.yaml index 6faf1a6d48e..425fcad903d 100644 --- a/api/v1/testkube.yaml +++ b/api/v1/testkube.yaml @@ -3432,7 +3432,7 @@ components: description: object name and namespace execution: $ref: "#/components/schemas/Execution" - description: test step execution + description: "test step execution, NOTE: the execution output will be empty, retrieve it directly form the test execution" TestSuiteStepExecutionResultV2: description: execution result returned from executor diff --git a/pkg/api/v1/testkube/model_test_suite_execution_extended.go b/pkg/api/v1/testkube/model_test_suite_execution_extended.go index 6ed2ab60b3f..e8234a4a21d 100644 --- a/pkg/api/v1/testkube/model_test_suite_execution_extended.go +++ b/pkg/api/v1/testkube/model_test_suite_execution_extended.go @@ -243,3 +243,17 @@ func (e *TestSuiteExecution) EscapeDots() *TestSuiteExecution { func (e *TestSuiteExecution) UnscapeDots() *TestSuiteExecution { return e.convertDots(utils.UnescapeDots) } + +func (e *TestSuiteExecution) CleanStepsOutput() *TestSuiteExecution { + for i := range e.StepResults { + if e.StepResults[i].Execution != nil && e.StepResults[i].Execution.ExecutionResult != nil { + e.StepResults[i].Execution.ExecutionResult.Output = "" + for j := range e.ExecuteStepResults[i].Execute { + if e.ExecuteStepResults[i].Execute[j].Execution != nil && e.ExecuteStepResults[i].Execute[j].Execution.ExecutionResult != nil { + e.ExecuteStepResults[i].Execute[j].Execution.ExecutionResult.Output = "" + } + } + } + } + return e +} diff --git a/pkg/repository/testresult/mongo.go b/pkg/repository/testresult/mongo.go index d1d00415708..712aa6fafb8 100644 --- a/pkg/repository/testresult/mongo.go +++ b/pkg/repository/testresult/mongo.go @@ -222,12 +222,14 @@ func (r *MongoRepository) GetExecutions(ctx context.Context, filter Filter) (res func (r *MongoRepository) Insert(ctx context.Context, result testkube.TestSuiteExecution) (err error) { result.EscapeDots() + result.CleanStepsOutput() _, err = r.Coll.InsertOne(ctx, result) return } func (r *MongoRepository) Update(ctx context.Context, result testkube.TestSuiteExecution) (err error) { result.EscapeDots() + result.CleanStepsOutput() _, err = r.Coll.ReplaceOne(ctx, bson.M{"id": result.Id}, result) return }