Skip to content

Commit

Permalink
OPRUN-3576: Add OLMv1 origin tests
Browse files Browse the repository at this point in the history
This is the initial test. Only works on tech-preview.
Checks for presence of OLMv1 CRDs.

Signed-off-by: Todd Short <[email protected]>
  • Loading branch information
tmshort committed Oct 15, 2024
1 parent 935bfac commit f15e4ed
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 0 deletions.
1 change: 1 addition & 0 deletions test/extended/include.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import (
_ "github.com/openshift/origin/test/extended/node_tuning"
_ "github.com/openshift/origin/test/extended/oauth"
_ "github.com/openshift/origin/test/extended/olm"
_ "github.com/openshift/origin/test/extended/olmv1"
_ "github.com/openshift/origin/test/extended/operators"
_ "github.com/openshift/origin/test/extended/poddisruptionbudget"
_ "github.com/openshift/origin/test/extended/pods"
Expand Down
18 changes: 18 additions & 0 deletions test/extended/olmv1/OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
reviewers:
- grokspawn
- m1kola
- everettraven
- tmshort
- perdasilva
- LalatenduMohanty
- dtfranz
- anik120
- ankitathomas
- joelanford
approvers:
- joelanford
- perdasilva
- m1kola
- tmshort
- grokspawn
- LalatenduMohanty
60 changes: 60 additions & 0 deletions test/extended/olmv1/olmv1.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
package operatorsv1

import (
"fmt"

g "github.com/onsi/ginkgo/v2"
o "github.com/onsi/gomega"

exutil "github.com/openshift/origin/test/extended/util"
)

const (
operatorsGroupName = "olm.operatorframework.io"
)

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

g.It("should be installed", func(ctx g.SpecContext) {
// 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")
}

// supports multiple versions during transision
providedAPIs := []struct {
group string
version []string
plural string
}{
{
group: operatorsGroupName,
version: []string{"v1alpha1", "v1"},
plural: "clusterextensions",
},
{
group: operatorsGroupName,
version: []string{"v1alpha1", "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==\"%s\")]}", ver)).Output()
if err == nil {
break
}
}
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(raw).To(o.MatchRegexp(`served.?:true`))
o.Expect(raw).To(o.MatchRegexp(`storage.?:true`))
}
})
})

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

0 comments on commit f15e4ed

Please sign in to comment.