Skip to content

Commit

Permalink
MGMT-15126: Add missing incompatible features in some of the feature-…
Browse files Browse the repository at this point in the history
…support feature (#5327)
  • Loading branch information
eliorerz committed Jun 29, 2023
1 parent 5d319db commit a6fd277
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 60 deletions.
79 changes: 21 additions & 58 deletions internal/featuresupport/feature_support_test.go
Expand Up @@ -182,7 +182,6 @@ var _ = Describe("V2ListFeatureSupportLevels API", func() {
Expect(value).To(Equal(models.SupportLevelSupported))
}
}

})
})

Expand Down Expand Up @@ -540,9 +539,7 @@ var _ = Describe("V2ListFeatureSupportLevels API", func() {
Context("getIncompatibleFeatures", func() {
It("Features without any restrictions", func() {
features := []models.FeatureSupportLevelID{
models.FeatureSupportLevelIDVIPAUTOALLOC,
models.FeatureSupportLevelIDCUSTOMMANIFEST,
models.FeatureSupportLevelIDDUALSTACKVIPS,
models.FeatureSupportLevelIDSINGLENODEEXPANSION,
models.FeatureSupportLevelIDCNV,
}
Expand All @@ -551,6 +548,27 @@ var _ = Describe("V2ListFeatureSupportLevels API", func() {
}
})

It("incompatibleFeatures - all features - no openshift version", func() {
for featureId, feature := range featuresList {
featureId := featureId
feature := feature

incompatibleFeatures := feature.getIncompatibleFeatures("")
if incompatibleFeatures != nil {
for _, incompatibleFeatureId := range *incompatibleFeatures {
incompatibleFeature := featuresList[incompatibleFeatureId]
By(fmt.Sprintf("Feature %s with incompatible feature %s", featureId, incompatibleFeatureId), func() {
incompatibleFeatures2 := incompatibleFeature.getIncompatibleFeatures("")
if incompatibleFeatures2 == nil {
incompatibleFeatures2 = &[]models.FeatureSupportLevelID{}
}
Expect(*incompatibleFeatures2).To(ContainElement(featureId))
})
}
}
}
})

It("vSphere with dual-stack", func() {
dualStackFeature := featuresList[models.FeatureSupportLevelIDDUALSTACK]
vsphereFeature := featuresList[models.FeatureSupportLevelIDVSPHEREINTEGRATION]
Expand All @@ -565,61 +583,6 @@ var _ = Describe("V2ListFeatureSupportLevels API", func() {
Expect(isDualStackIncompatibleWithVsphere).To(BeNil())
Expect(isVsphereIncompatibleWithDualStack).To(BeNil())
})

It("Features with restrictions - Nutanix and UserManagedNetworking", func() {
umnFeature := featuresList[models.FeatureSupportLevelIDUSERMANAGEDNETWORKING]
nutanixFeature := featuresList[models.FeatureSupportLevelIDNUTANIXINTEGRATION]

isUmnIncompatibleWithNutanix := isFeatureCompatible("", umnFeature, nutanixFeature)
isNutanixIncompatibleWithUmn := isFeatureCompatible("", nutanixFeature, umnFeature)

Expect((*isUmnIncompatibleWithNutanix).getId()).To(Equal(nutanixFeature.getId()))
Expect((*isNutanixIncompatibleWithUmn).getId()).To(Equal(umnFeature.getId()))
})

It("Features with restrictions - OCI and CMN", func() {
cmnFeature := featuresList[models.FeatureSupportLevelIDCLUSTERMANAGEDNETWORKING]
ociFeature := featuresList[models.FeatureSupportLevelIDEXTERNALPLATFORMOCI]

isCmnIncompatibleWithOci := isFeatureCompatible("", cmnFeature, ociFeature)
isOciIncompatibleWithUmn := isFeatureCompatible("", ociFeature, cmnFeature)

Expect((*isCmnIncompatibleWithOci).getId()).To(Equal(ociFeature.getId()))
Expect((*isOciIncompatibleWithUmn).getId()).To(Equal(cmnFeature.getId()))
})

It("Features with restrictions - OCI and Full ISO", func() {
fullIsoFeature := featuresList[models.FeatureSupportLevelIDFULLISO]
ociFeature := featuresList[models.FeatureSupportLevelIDEXTERNALPLATFORMOCI]

isFullIsoIncompatibleWithOci := isFeatureCompatible("", fullIsoFeature, ociFeature)
isOciIncompatibleWithUmn := isFeatureCompatible("", ociFeature, fullIsoFeature)

Expect((*isFullIsoIncompatibleWithOci).getId()).To(Equal(ociFeature.getId()))
Expect((*isOciIncompatibleWithUmn).getId()).To(Equal(fullIsoFeature.getId()))
})

It("Features with restrictions - Sno", func() {
snoFeature := featuresList[models.FeatureSupportLevelIDSNO]
nutanixFeature := featuresList[models.FeatureSupportLevelIDNUTANIXINTEGRATION]
vsphereFeature := featuresList[models.FeatureSupportLevelIDVSPHEREINTEGRATION]
cmnFeature := featuresList[models.FeatureSupportLevelIDCLUSTERMANAGEDNETWORKING]

isSnoIncompatibleWithNutanix := isFeatureCompatible("", snoFeature, nutanixFeature)
isSnoIncompatibleWithVsphere := isFeatureCompatible("", snoFeature, vsphereFeature)
isSnoIncompatibleWithCmn := isFeatureCompatible("", snoFeature, cmnFeature)

isNutanixIncompatibleWithSno := isFeatureCompatible("", nutanixFeature, snoFeature)
isVsphereIncompatibleWithSno := isFeatureCompatible("", vsphereFeature, snoFeature)
isCmnIncompatibleWithSno := isFeatureCompatible("", cmnFeature, snoFeature)

Expect((*isSnoIncompatibleWithNutanix).getId()).To(Equal(nutanixFeature.getId()))
Expect((*isSnoIncompatibleWithVsphere).getId()).To(Equal(vsphereFeature.getId()))
Expect((*isSnoIncompatibleWithCmn).getId()).To(Equal(cmnFeature.getId()))
Expect((*isNutanixIncompatibleWithSno).getId()).To(Equal(snoFeature.getId()))
Expect((*isVsphereIncompatibleWithSno).getId()).To(Equal(snoFeature.getId()))
Expect((*isCmnIncompatibleWithSno).getId()).To(Equal(snoFeature.getId()))
})
})
})
})
Expand Down
12 changes: 10 additions & 2 deletions internal/featuresupport/features.go
Expand Up @@ -146,7 +146,11 @@ func (feature *VipAutoAllocFeature) getSupportLevel(_ SupportLevelFilters) model
}

func (feature *VipAutoAllocFeature) getIncompatibleFeatures(string) *[]models.FeatureSupportLevelID {
return nil
return &[]models.FeatureSupportLevelID{
models.FeatureSupportLevelIDSNO,
models.FeatureSupportLevelIDEXTERNALPLATFORMOCI,
models.FeatureSupportLevelIDLVM,
}
}

func (feature *VipAutoAllocFeature) getIncompatibleArchitectures(_ *string) *[]models.ArchitectureSupportLevelID {
Expand Down Expand Up @@ -262,6 +266,7 @@ func (feature *ClusterManagedNetworkingFeature) getIncompatibleFeatures(string)
models.FeatureSupportLevelIDSNO,
models.FeatureSupportLevelIDUSERMANAGEDNETWORKING,
models.FeatureSupportLevelIDEXTERNALPLATFORMOCI,
models.FeatureSupportLevelIDLVM,
}
}

Expand Down Expand Up @@ -354,7 +359,9 @@ func (feature *DualStackVipsFeature) getFeatureActiveLevel(cluster *common.Clust
}

func (feature *DualStackVipsFeature) getIncompatibleFeatures(string) *[]models.FeatureSupportLevelID {
return nil
return &[]models.FeatureSupportLevelID{
models.FeatureSupportLevelIDEXTERNALPLATFORMOCI,
}
}

func (feature *DualStackVipsFeature) getIncompatibleArchitectures(_ *string) *[]models.ArchitectureSupportLevelID {
Expand Down Expand Up @@ -553,6 +560,7 @@ func (feature *NutanixIntegrationFeature) getIncompatibleFeatures(string) *[]mod
models.FeatureSupportLevelIDSNO,
models.FeatureSupportLevelIDUSERMANAGEDNETWORKING,
models.FeatureSupportLevelIDLVM,
models.FeatureSupportLevelIDMCE,
}
}

Expand Down

0 comments on commit a6fd277

Please sign in to comment.