Skip to content

Commit

Permalink
Merge pull request #205 from acornett21/bump/k8s-1.27
Browse files Browse the repository at this point in the history
removing packagemanifest tests
  • Loading branch information
varshaprasad96 authored Oct 10, 2023
2 parents b38b849 + 172b7e6 commit d573720
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 248 deletions.
49 changes: 0 additions & 49 deletions internal/testutils/olm.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,65 +15,16 @@
package testutils

import (
"fmt"
"os"
"path/filepath"

_ "sigs.k8s.io/kubebuilder/v3/pkg/config/v2" // Register config/v2 for `config.New`
_ "sigs.k8s.io/kubebuilder/v3/pkg/config/v3" // Register config/v3 for `config.New`

"github.com/operator-framework/operator-sdk/internal/util/projutil"
)

const (
OlmVersionForTestSuite = "0.25.0"
)

var makefilePackagemanifestsFragment = `
# Options for "packagemanifests".
ifneq ($(origin FROM_VERSION), undefined)
PKG_FROM_VERSION := --from-version=$(FROM_VERSION)
endif
ifneq ($(origin CHANNEL), undefined)
PKG_CHANNELS := --channel=$(CHANNEL)
endif
ifeq ($(IS_CHANNEL_DEFAULT), 1)
PKG_IS_DEFAULT_CHANNEL := --default-channel
endif
PKG_MAN_OPTS ?= $(PKG_FROM_VERSION) $(PKG_CHANNELS) $(PKG_IS_DEFAULT_CHANNEL)
# Generate package manifests.
packagemanifests: kustomize %s
$(OPERATOR_SDK) generate kustomize manifests -q --interactive=false
cd config/manager && $(KUSTOMIZE) edit set image controller=$(IMG)
$(KUSTOMIZE) build config/manifests | $(OPERATOR_SDK) generate packagemanifests -q --version $(VERSION) $(PKG_MAN_OPTS)
`

// AddPackagemanifestsTarget will append the packagemanifests target to the makefile
// in order to test the steps described in the docs.
// More info: https://v1-0-x.sdk.operatorframework.io/docs/olm-integration/generation/#package-manifests-formats
func (tc TestContext) AddPackagemanifestsTarget(operatorType projutil.OperatorType) error {
makefileBytes, err := os.ReadFile(filepath.Join(tc.Dir, "Makefile"))
if err != nil {
return err
}

// add the manifests target when is a Go project.
replaceTarget := ""
if operatorType == projutil.OperatorTypeGo {
replaceTarget = "manifests"
}
makefilePackagemanifestsFragment = fmt.Sprintf(makefilePackagemanifestsFragment, replaceTarget)

// update makefile by adding the packagemanifests target
makefileBytes = append([]byte(makefilePackagemanifestsFragment), makefileBytes...)
err = os.WriteFile(filepath.Join(tc.Dir, "Makefile"), makefileBytes, 0644)
if err != nil {
return err
}
return nil
}

// DisableManifestsInteractiveMode will update the Makefile to disable the interactive mode
func (tc TestContext) DisableManifestsInteractiveMode() error {
// Todo: check if we cannot improve it since the replace/content will exists in the
Expand Down
58 changes: 0 additions & 58 deletions test/e2e/ansible/olm_test.go

This file was deleted.

58 changes: 0 additions & 58 deletions test/e2e/helm/olm_test.go

This file was deleted.

51 changes: 0 additions & 51 deletions test/integration/packagemanifests_test.go

This file was deleted.

32 changes: 0 additions & 32 deletions test/integration/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import (
"sigs.k8s.io/yaml"

"github.com/operator-framework/operator-sdk/internal/testutils"
"github.com/operator-framework/operator-sdk/internal/util/projutil"
)

// TestIntegration tests operator-sdk projects with OLM.
Expand Down Expand Up @@ -64,9 +63,6 @@ var _ = BeforeSuite(func() {
By("copying sample to a temporary e2e directory")
Expect(exec.Command("cp", "-r", "../../testdata/go/v3/memcached-operator", tc.Dir).Run()).To(Succeed())

By("updating the project configuration")
Expect(tc.AddPackagemanifestsTarget(projutil.OperatorTypeGo)).To(Succeed())

By("installing OLM")
Expect(tc.InstallOLMVersion(testutils.OlmVersionForTestSuite)).To(Succeed())

Expand All @@ -92,16 +88,6 @@ var _ = BeforeSuite(func() {
}
Expect(writeCSV(&tc, "0.0.1", csv, false)).To(Succeed())

// TODO(estroz): enable when bundles can be tested locally.
//
// By("generating the operator bundle")
// err = tc.Make("bundle", "IMG="+tc.ImageName)
// Expect(err).NotTo(HaveOccurred())
//
// By("building the operator bundle image")
// err = tc.Make("bundle-build", "BUNDLE_IMG="+tc.BundleImageName)
// Expect(err).NotTo(HaveOccurred())

By("creating the test namespace")
_, err = tc.Kubectl.Command("create", "namespace", tc.Kubectl.Namespace)
Expect(err).NotTo(HaveOccurred())
Expand All @@ -127,24 +113,6 @@ func warn(output string, err error) {
}
}

func runPackageManifests(tc *testutils.TestContext, args ...string) error {
allArgs := []string{"run", "packagemanifests", "--timeout", "6m", "--namespace", tc.Kubectl.Namespace}
output, err := tc.Run(exec.Command(tc.BinaryName, append(allArgs, args...)...))
if err == nil {
fmt.Fprintln(GinkgoWriter, string(output))
}
return err
}

func cleanup(tc *testutils.TestContext) (string, error) {
allArgs := []string{"cleanup", tc.ProjectName, "--timeout", "4m", "--namespace", tc.Kubectl.Namespace}
output, err := tc.Run(exec.Command(tc.BinaryName, allArgs...))
if err == nil {
fmt.Fprintln(GinkgoWriter, string(output))
}
return string(output), err
}

func readCSV(tc *testutils.TestContext, version string, isBundle bool) (*v1alpha1.ClusterServiceVersion, error) {
b, err := os.ReadFile(csvPath(tc, version, isBundle))
if err != nil {
Expand Down

0 comments on commit d573720

Please sign in to comment.