Skip to content

Commit

Permalink
#81 - add test for not allowed component downgrades
Browse files Browse the repository at this point in the history
  • Loading branch information
meiserloh committed Nov 5, 2024
1 parent 1427d70 commit 21b7564
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions pkg/domain/blueprintSpec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,40 @@ func TestBlueprintSpec_DetermineStateDiff(t *testing.T) {
assert.Equal(t, StatusPhaseInvalid, spec.Status)
assert.ErrorContains(t, err, "action \"component namespace switch\" is not allowed")
})
t.Run("should return error with not allowed component downgrade action", func(t *testing.T) {
// given
spec := BlueprintSpec{
EffectiveBlueprint: EffectiveBlueprint{
Components: []Component{
{
Name: common.QualifiedComponentName{
Namespace: testComponentName.Namespace,
SimpleName: testComponentName.SimpleName,
},
Version: compVersion3210,
},
},
},
Status: StatusPhaseValidated,
}
clusterState := ecosystem.EcosystemState{
InstalledDogus: map[common.SimpleDoguName]*ecosystem.DoguInstallation{},
InstalledComponents: map[common.SimpleComponentName]*ecosystem.ComponentInstallation{
testComponentName.SimpleName: {
Name: testComponentName,
ExpectedVersion: compVersion3211,
},
},
}

// when
err := spec.DetermineStateDiff(clusterState)

// then
require.Error(t, err)
assert.Equal(t, StatusPhaseInvalid, spec.Status)
assert.ErrorContains(t, err, "action \"downgrade\" is not allowed")
})
}

func TestBlueprintSpec_CheckEcosystemHealthUpfront(t *testing.T) {
Expand Down

0 comments on commit 21b7564

Please sign in to comment.