Skip to content

Commit

Permalink
Fix flaky tests and update TODO
Browse files Browse the repository at this point in the history
Signed-off-by: khanhtc1202 <khanhtc1202@gmail.com>
  • Loading branch information
khanhtc1202 committed Sep 26, 2024
1 parent 0cc2ec4 commit 93b4ec6
Show file tree
Hide file tree
Showing 2 changed files with 110 additions and 129 deletions.
7 changes: 7 additions & 0 deletions pkg/app/pipedv1/controller/planner.go
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,7 @@ func (p *planner) buildQuickSyncStages(ctx context.Context, cfg *config.GenericA
if err != nil {
return nil, fmt.Errorf("failed to build quick sync stage deployment (%w)", err)
}
// TODO: Ensure responsed stages indexies is valid.
for i := range res.Stages {
if res.Stages[i].Rollback {
rollbackStages = append(rollbackStages, res.Stages[i])
Expand All @@ -416,6 +417,11 @@ func (p *planner) buildQuickSyncStages(ctx context.Context, cfg *config.GenericA
}
}
}

// Sort stages by index.
sort.Sort(model.PipelineStages(stages))
sort.Sort(model.PipelineStages(rollbackStages))

stages = append(stages, rollbackStages...)
if len(stages) == 0 {
return nil, fmt.Errorf("unable to build quick sync stages for deployment")
Expand Down Expand Up @@ -467,6 +473,7 @@ func (p *planner) buildPipelineSyncStages(ctx context.Context, cfg *config.Gener
if err != nil {
return nil, fmt.Errorf("failed to build pipeline sync stages for deployment (%w)", err)
}
// TODO: Ensure responsed stages indexies is valid.
for i := range res.Stages {
if res.Stages[i].Rollback {
rollbackStages = append(rollbackStages, res.Stages[i])
Expand Down
Loading

0 comments on commit 93b4ec6

Please sign in to comment.