Skip to content

Commit

Permalink
Fix bug in provider validations for workload (#7365)
Browse files Browse the repository at this point in the history
* Fix bug in provider validations for workload

* fix controller workflow upgrade tests

* fix test
  • Loading branch information
tatlat authored Jan 24, 2024
1 parent 63527b4 commit 370bdfd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions pkg/workflows/workload/upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func newUpgradeTest(t *testing.T) *upgradeTestSetup {

func (c *upgradeTestSetup) expectSetup() {
c.clusterManager.EXPECT().GetCurrentClusterSpec(c.ctx, c.clusterSpec.ManagementCluster, c.clusterSpec.Cluster.Name).Return(c.currentClusterSpec, nil)
c.provider.EXPECT().SetupAndValidateUpgradeCluster(c.ctx, c.workloadCluster, c.clusterSpec, c.currentClusterSpec)
c.provider.EXPECT().SetupAndValidateUpgradeCluster(c.ctx, c.clusterSpec.ManagementCluster, c.clusterSpec, c.currentClusterSpec)
c.provider.EXPECT().Name()
c.gitOpsManager.EXPECT().Validations(c.ctx, c.clusterSpec)
}
Expand Down Expand Up @@ -200,7 +200,7 @@ func TestUpgradeRunValidateFail(t *testing.T) {
test.clusterManager.EXPECT().GetCurrentClusterSpec(test.ctx, test.clusterSpec.ManagementCluster, test.clusterSpec.Cluster.Name).AnyTimes().Return(test.currentClusterSpec, nil)
test.provider.EXPECT().Name().AnyTimes()
test.gitOpsManager.EXPECT().Validations(test.ctx, test.clusterSpec).AnyTimes()
test.provider.EXPECT().SetupAndValidateUpgradeCluster(test.ctx, test.workloadCluster, test.clusterSpec, test.currentClusterSpec).Return(fmt.Errorf("boom"))
test.provider.EXPECT().SetupAndValidateUpgradeCluster(test.ctx, test.clusterSpec.ManagementCluster, test.clusterSpec, test.currentClusterSpec).Return(fmt.Errorf("boom"))
test.expectPreflightValidationsToPass()
test.expectWrite()

Expand Down
2 changes: 1 addition & 1 deletion pkg/workflows/workload/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func (s *setAndValidateUpgradeWorkloadTask) providerValidation(ctx context.Conte
func() *validations.ValidationResult {
return &validations.ValidationResult{
Name: fmt.Sprintf("workload cluster's %s Provider setup is valid", commandContext.Provider.Name()),
Err: commandContext.Provider.SetupAndValidateUpgradeCluster(ctx, commandContext.WorkloadCluster, commandContext.ClusterSpec, commandContext.CurrentClusterSpec),
Err: commandContext.Provider.SetupAndValidateUpgradeCluster(ctx, commandContext.ManagementCluster, commandContext.ClusterSpec, commandContext.CurrentClusterSpec),
}
},
}
Expand Down

0 comments on commit 370bdfd

Please sign in to comment.