Skip to content

Commit

Permalink
fix(STONEINTG-646): Identify un-triggered ITS to apply snapshot recon…
Browse files Browse the repository at this point in the history
…cile
  • Loading branch information
kasemAlem committed Nov 26, 2023
1 parent 5bd1ba4 commit fc8a9a5
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions controllers/statusreport/statusreport_adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package statusreport
import (
"context"
"fmt"

"github.com/redhat-appstudio/integration-service/api/v1beta1"
"github.com/redhat-appstudio/integration-service/gitops"
"github.com/redhat-appstudio/integration-service/metrics"
Expand Down Expand Up @@ -109,6 +110,10 @@ func (a *Adapter) EnsureSnapshotFinishedAllTests() (controller.OperationResult,
return controller.RequeueWithError(err)
}

a.logger.Info("Running determineIfAllIntegrationTestsNotTriggered***")
a.determineIfAllIntegrationTestsNotTriggered(integrationTestScenarios, testStatuses)
a.logger.Info("Done running determineIfAllIntegrationTestsNotTriggered***")

allIntegrationTestsFinished, allIntegrationTestsPassed := a.determineIfAllIntegrationTestsFinishedAndPassed(integrationTestScenarios, testStatuses)
if err != nil {
a.logger.Error(err, "Failed to determine outcomes for Integration Tests",
Expand Down Expand Up @@ -298,3 +303,26 @@ func (a *Adapter) getComponentSourceFromSnapshotComponent(snapshot *applicationa
}
return nil, fmt.Errorf("couldn't find the requested component source info in the given Snapshot")
}

// determineIfAllIntegrationTestsNotTriggered checks if we have at least one integrationTestScenario that is not triggered yet.
func (a *Adapter) determineIfAllIntegrationTestsNotTriggered(integrationTestScenarios *[]v1beta1.IntegrationTestScenario, testStatuses *intgteststat.SnapshotIntegrationTestStatuses) bool {
foundIntegrationTestScenarioNotTriggered := true
fmt.Println("*********************************************************************")
fmt.Println("******** Test Statuses ********")
fmt.Println(testStatuses)
fmt.Println("******** Integration Tes Scenarios ********")
fmt.Println(integrationTestScenarios)
fmt.Println("*********************************************************************")
// for _, integrationTestScenario := range *integrationTestScenarios {
// integrationTestScenario := integrationTestScenario // G601
// testDetails, ok := testStatuses.GetScenarioStatus(integrationTestScenario.Name)
// if !ok || (testDetails.Status != intgteststat.IntegrationTestStatusTestPassed && testDetails.Status != intgteststat.IntegrationTestStatusTestFail && testDetails.Status != intgteststat.IntegrationTestStatusDeleted) {
// allIntegrationTestsFinished = false
// }
// if ok && testDetails.Status != intgteststat.IntegrationTestStatusTestPassed {
// allIntegrationTestsPassed = false
// }

// }
return foundIntegrationTestScenarioNotTriggered
}

0 comments on commit fc8a9a5

Please sign in to comment.