Skip to content
This repository has been archived by the owner on Oct 22, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1071 from pohly/operator-update
Browse files Browse the repository at this point in the history
operator update + OLM workaround
  • Loading branch information
pohly authored Apr 18, 2022
2 parents ffc8e4b + 0dd60ab commit 707d0dc
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 5 deletions.
2 changes: 1 addition & 1 deletion operator/operator.make
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# https://github.com/operator-framework/operator-sdk/releases
OPERATOR_SDK_VERSION=1.17.0
OPERATOR_SDK_VERSION=1.19.1
# https://github.com/kubernetes-sigs/controller-tools/releases
CONTROLLER_GEN_VERSION=v0.8.0
CONTROLLER_GEN=_work/bin/controller-gen-$(CONTROLLER_GEN_VERSION)
Expand Down
32 changes: 29 additions & 3 deletions test/e2e/deploy/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -1483,9 +1483,12 @@ var tests = map[string]map[string][]func(d *Deployment){}

// Describe remembers a certain test. The actual registration in
// Ginkgo happens in DefineTests, ordered such that all tests with the
// same "deployment" string are defined on after the after with the
// same "deployment" string are defined one after the after with the
// given "describe" string.
//
// An empty deployment is valid. Those tests will run after the ones
// which use deployments. Their callback is passed a nil Deployment.
//
// When "describe" is already unique, "what" can be left empty.
func Describe(deployment, describe, what string, f func(d *Deployment)) bool {
group := tests[deployment]
Expand All @@ -1509,12 +1512,26 @@ func Describe(deployment, describe, what string, f func(d *Deployment)) bool {

// DefineTests must be called to register all tests defined so far via Describe.
func DefineTests() {
for deploymentName, group := range tests {
all := allDeployments[:]
for deploymentName := range tests {
if !haveDeployment(all, deploymentName) {
all = append(all, deploymentName)
}
}

for _, deploymentName := range all {
group, ok := tests[deploymentName]
if !ok {
continue
}
deploymentName := deploymentName
for describe, funcs := range group {
funcs := funcs
ginkgo.Describe(describe, func() {
deployment := EnsureDeployment(deploymentName)
var deployment *Deployment
if deploymentName != "" {
deployment = EnsureDeployment(deploymentName)
}
for _, f := range funcs {
f(deployment)
}
Expand All @@ -1523,6 +1540,15 @@ func DefineTests() {
}
}

func haveDeployment(all []string, one string) bool {
for _, a := range all {
if a == one {
return true
}
}
return false
}

// waitForPodDeletion returns an error if it takes too long for the pod to fully terminate.
func waitForPodDeletion(c *Cluster, pod v1.Pod) error {
return wait.PollImmediate(2*time.Second, time.Minute, func() (bool, error) {
Expand Down
3 changes: 2 additions & 1 deletion test/e2e/imagefile/imagefilee2e.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"github.com/onsi/ginkgo"

"github.com/intel/pmem-csi/pkg/imagefile/test"
"github.com/intel/pmem-csi/test/e2e/deploy"
)

type tImplementation struct {
Expand All @@ -39,7 +40,7 @@ func (t *tImplementation) Skipf(format string, args ...interface{}) {
ginkgo.Skip(fmt.Sprintf(format, args...))
}

var _ = ginkgo.Describe("imagefile", func() {
var _ = deploy.Describe("", "imagefile", "", func(d *deploy.Deployment) {
// Our Outer and Inner implementation do not need a valid pointer.
test.ImageFile((*tImplementation)(nil))
})

0 comments on commit 707d0dc

Please sign in to comment.