Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 25 additions & 36 deletions test/extended/olm/olmv1.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,63 +23,47 @@ const (
typeIncompatibelOperatorsUpgradeable = "InstalledOLMOperatorsUpgradeable"
)

var _ = g.Describe("[sig-olmv1] OLMv1 CRDs", func() {
var _ = g.Describe("[sig-olmv1][OCPFeatureGate:NewOLM] OLMv1 CRDs", func() {
defer g.GinkgoRecover()
oc := exutil.NewCLIWithoutNamespace("default")

g.It("should be installed", func(ctx g.SpecContext) {
g.Skip("Test is temporarily disabled while we make anticipated, breaking changes.")
// Check for tech preview, if this is not tech preview, bail
if !exutil.IsTechPreviewNoUpgrade(ctx, oc.AdminConfigClient()) {
g.Skip("Test only runs in tech-preview")
}
checkFeatureCapability(ctx, oc)

// supports multiple versions during transision
providedAPIs := []struct {
group string
version []string
version string
plural string
}{
{
group: olmv1GroupName,
version: []string{"v1alpha1", "v1"},
version: "v1",
plural: "clusterextensions",
},
{
group: olmv1GroupName,
version: []string{"v1alpha1", "v1"},
version: "v1",
plural: "clustercatalogs",
},
}

for _, api := range providedAPIs {
g.By(fmt.Sprintf("checking %s at version %s [apigroup:%s]", api.plural, api.version, api.group))
// Ensure expected version exists in spec.versions and is both served and stored
var err error
var raw string
for _, ver := range api.version {
raw, err = oc.AsAdmin().Run("get").Args("crds", fmt.Sprintf("%s.%s", api.plural, api.group), fmt.Sprintf("-o=jsonpath={.spec.versions[?(@.name==%q)]}", ver)).Output()
if err == nil {
break
}
}
raw, err := oc.AsAdmin().Run("get").Args("crds", fmt.Sprintf("%s.%s", api.plural, api.group), fmt.Sprintf("-o=jsonpath={.spec.versions[?(@.name==%q)]}", api.version)).Output()
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(raw).To(o.MatchRegexp(`served.?:true`))
o.Expect(raw).To(o.MatchRegexp(`storage.?:true`))
}
})
})

var _ = g.Describe("[sig-olmv1] OLMv1 Catalogs", func() {
var _ = g.Describe("[sig-olmv1][OCPFeatureGate:NewOLM] OLMv1 Catalogs", func() {
defer g.GinkgoRecover()
oc := exutil.NewCLIWithoutNamespace("default")

g.It("should be installed", func(ctx g.SpecContext) {
g.Skip("Test is temporarily disabled while we make anticipated, breaking changes.")
// Check for tech preview, if this is not tech preview, bail
if !exutil.IsTechPreviewNoUpgrade(ctx, oc.AdminConfigClient()) {
g.Skip("Test only runs in tech-preview")
}
checkFeatureCapability(ctx, oc)

providedCatalogs := []string{
"openshift-certified-operators",
Expand All @@ -102,7 +86,7 @@ var _ = g.Describe("[sig-olmv1] OLMv1 Catalogs", func() {
})
})

var _ = g.Describe("[sig-olmv1][Serial] OLMv1 operator installation", func() {
var _ = g.Describe("[sig-olmv1][OCPFeatureGate:NewOLM][Serial] OLMv1 operator installation", func() {
defer g.GinkgoRecover()

var (
Expand All @@ -125,15 +109,12 @@ var _ = g.Describe("[sig-olmv1][Serial] OLMv1 operator installation", func() {
})

g.It("should install a cluster extension", func(ctx g.SpecContext) {
g.Skip("Test is temporarily disabled while we make anticipated, breaking changes.")
checkFeatureCapability(ctx, oc)

const (
packageName = "quay-operator"
version = "3.13.0"
)
// Check for tech preview, if this is not tech preview, bail
if !exutil.IsTechPreviewNoUpgrade(ctx, oc.AdminConfigClient()) {
g.Skip("Test only runs in tech-preview")
}

ns := oc.Namespace()
g.By(fmt.Sprintf("Updating the namespace to: %q", ns))
Expand Down Expand Up @@ -164,15 +145,12 @@ var _ = g.Describe("[sig-olmv1][Serial] OLMv1 operator installation", func() {
})

g.It("should block cluster upgrades if an incompatible operator is installed", func(ctx g.SpecContext) {
g.Skip("Test is temporarily disabled while we make anticipated, breaking changes.")
checkFeatureCapability(ctx, oc)

const (
packageName = "elasticsearch-operator"
version = "5.8.13"
)
// Check for tech preview, if this is not tech preview, bail
if !exutil.IsTechPreviewNoUpgrade(ctx, oc.AdminConfigClient()) {
g.Skip("Test only runs in tech-preview")
}

ns := oc.Namespace()
g.By(fmt.Sprintf("Updating the namespace to: %q", ns))
Expand Down Expand Up @@ -205,7 +183,7 @@ var _ = g.Describe("[sig-olmv1][Serial] OLMv1 operator installation", func() {

func updateCe(b []byte, args ...string) string {
s := string(b)
s = strings.ReplaceAll(s, "{REPLACE}", args[0])
s = strings.ReplaceAll(s, "{NAMESPACE}", args[0])
s = strings.ReplaceAll(s, "{PACKAGENAME}", args[1])
s = strings.ReplaceAll(s, "{VERSION}", args[2])
return s
Expand Down Expand Up @@ -253,3 +231,14 @@ func WaitForCondition(oc *exutil.CLI, status bool) (done bool, err error) {
}
return true, nil
}

func checkFeatureCapability(ctx context.Context, oc *exutil.CLI) {
// Hardcoded until openshift/api is updated:
// import ( configv1 "github.com/openshift/api/config/v1" )
// configv1.ClusterVersionCapabilityOperatorLifecycleManagerV1
cap, err := exutil.IsCapabilityEnabled(oc, "OperatorLifecycleManagerV1")
o.Expect(err).NotTo(o.HaveOccurred())
if !cap {
g.Skip("Test only runs with OperatorLifecycleManagerV1 capability")
}
}
15 changes: 7 additions & 8 deletions test/extended/testdata/bindata.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 7 additions & 8 deletions test/extended/testdata/olmv1/install-operator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,29 @@ apiVersion: v1
kind: ServiceAccount
metadata:
name: install-test-sa
namespace: {REPLACE}
namespace: {NAMESPACE}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: crb-{REPLACE}
name: crb-{NAMESPACE}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
subjects:
- kind: ServiceAccount
name: install-test-sa
namespace: {REPLACE}
namespace: {NAMESPACE}
---
apiVersion: olm.operatorframework.io/v1alpha1
apiVersion: olm.operatorframework.io/v1
kind: ClusterExtension
metadata:
name: install-test-ce
spec:
install:
namespace: {REPLACE}
serviceAccount:
name: install-test-sa
namespace: {NAMESPACE}
serviceAccount:
name: install-test-sa
source:
catalog:
packageName: {PACKAGENAME}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions zz_generated.manifests/test-reporting.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,14 @@ spec:
- testName: '[sig-network][OCPFeatureGate:NetworkSegmentation][Feature:UserDefinedPrimaryNetworks]
when using openshift ovn-kubernetes when primary network exist, UserDefinedNetwork
status should report not-ready'
- featureGate: NewOLM
tests:
- testName: '[sig-olmv1][OCPFeatureGate:NewOLM] OLMv1 CRDs should be installed'
- testName: '[sig-olmv1][OCPFeatureGate:NewOLM] OLMv1 Catalogs should be installed'
- testName: '[sig-olmv1][OCPFeatureGate:NewOLM][Serial] OLMv1 operator installation
should block cluster upgrades if an incompatible operator is installed'
- testName: '[sig-olmv1][OCPFeatureGate:NewOLM][Serial] OLMv1 operator installation
should install a cluster extension'
- featureGate: PersistentIPsForVirtualization
tests:
- testName: '[sig-network][OCPFeatureGate:PersistentIPsForVirtualization][Feature:Layer2LiveMigration]
Expand Down