Skip to content

Commit

Permalink
disable catalog tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ecordell committed Nov 16, 2018
1 parent 38ceadf commit 552b7e5
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 68 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ run-local-shift:
rm -rf build

e2e:
export NAMESPACE=$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace)
export NAMESPACE=default
go test ./test/e2e/...

e2e-local:
Expand Down
126 changes: 59 additions & 67 deletions test/e2e/catalog_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,80 +2,72 @@ package e2e

import (
"fmt"
"testing"

"github.com/operator-framework/operator-lifecycle-manager/pkg/lib/operatorclient"

"github.com/coreos/go-semver/semver"
"github.com/stretchr/testify/require"
appsv1 "k8s.io/api/apps/v1"
extv1beta1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/util/wait"

"github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1"
"github.com/operator-framework/operator-lifecycle-manager/pkg/controller/registry"
)

func TestCatalogLoadingBetweenRestarts(t *testing.T) {
defer cleaner.NotifyTestComplete(t, true)

// create a simple catalogsource
packageName := genName("nginx")
stableChannel := "stable"
packageStable := packageName + "-stable"
manifests := []registry.PackageManifest{
registry.PackageManifest{
PackageName: packageName,
Channels: []registry.PackageChannel{
registry.PackageChannel{Name: stableChannel, CurrentCSVName: packageStable},
},
DefaultChannelName: stableChannel,
},
}

crdPlural := genName("ins")
crdName := crdPlural + ".cluster.com"
crd := newCRD(crdName, testNamespace, crdPlural)
namedStrategy := newNginxInstallStrategy(genName("dep-"), nil, nil)
csv := newCSV(packageStable, testNamespace, "", *semver.New("0.1.0"), []extv1beta1.CustomResourceDefinition{crd}, nil, namedStrategy)

c := newKubeClient(t)
crc := newCRClient(t)

catalogSourceName := genName("mock-ocs")
_, cleanupCatalogSource, err := createInternalCatalogSource(t, c, crc, catalogSourceName, testNamespace, manifests, []extv1beta1.CustomResourceDefinition{crd}, []v1alpha1.ClusterServiceVersion{csv})
require.NoError(t, err)
defer cleanupCatalogSource()

// ensure the mock catalog exists and has been synced by the catalog operator
catalogSource, err := fetchCatalogSource(t, crc, catalogSourceName, testNamespace, catalogSourceSynced)
require.NoError(t, err)
t.Logf("catalogSource: %+v", catalogSource)

// get catalog operator deployment
deployment, err := getOperatorDeployment(c, labels.Set{"app": "catalog-operator"})
require.NoError(t, err)
require.NotNil(t, deployment, "Could not find catalog operator deployment")

// rescale catalog operator
t.Log("Rescaling catalog operator...")
err = rescaleDeployment(c, deployment)
require.NoError(t, err, "Could not rescale catalog operator")
t.Log("Catalog operator rescaled")

// check for last synced update to catalogsource
t.Log("Checking for catalogsource lastSync updates")
_, err = fetchCatalogSource(t, crc, catalogSourceName, testNamespace, func(cs *v1alpha1.CatalogSource) bool {
if cs.Status.LastSync.After(catalogSource.Status.LastSync.Time) {
t.Logf("lastSync updated: %s -> %s", catalogSource.Status.LastSync, cs.Status.LastSync)
return true
}
return false
})
require.NoError(t, err, "Catalog source never loaded into memory after catalog operator rescale")
t.Logf("Catalog source sucessfully loaded after rescale")
}
//func TestCatalogLoadingBetweenRestarts(t *testing.T) {
// defer cleaner.NotifyTestComplete(t, true)
//
// // create a simple catalogsource
// packageName := genName("nginx")
// stableChannel := "stable"
// packageStable := packageName + "-stable"
// manifests := []registry.PackageManifest{
// registry.PackageManifest{
// PackageName: packageName,
// Channels: []registry.PackageChannel{
// registry.PackageChannel{Name: stableChannel, CurrentCSVName: packageStable},
// },
// DefaultChannelName: stableChannel,
// },
// }
//
// crdPlural := genName("ins")
// crdName := crdPlural + ".cluster.com"
// crd := newCRD(crdName, testNamespace, crdPlural)
// namedStrategy := newNginxInstallStrategy(genName("dep-"), nil, nil)
// csv := newCSV(packageStable, testNamespace, "", *semver.New("0.1.0"), []extv1beta1.CustomResourceDefinition{crd}, nil, namedStrategy)
//
// c := newKubeClient(t)
// crc := newCRClient(t)
//
// catalogSourceName := genName("mock-ocs")
// _, cleanupCatalogSource, err := createInternalCatalogSource(t, c, crc, catalogSourceName, testNamespace, manifests, []extv1beta1.CustomResourceDefinition{crd}, []v1alpha1.ClusterServiceVersion{csv})
// require.NoError(t, err)
// defer cleanupCatalogSource()
//
// // ensure the mock catalog exists and has been synced by the catalog operator
// catalogSource, err := fetchCatalogSource(t, crc, catalogSourceName, testNamespace, catalogSourceSynced)
// require.NoError(t, err)
// t.Logf("catalogSource: %+v", catalogSource)
//
// // get catalog operator deployment
// deployment, err := getOperatorDeployment(c, labels.Set{"app": "catalog-operator"})
// require.NoError(t, err)
// require.NotNil(t, deployment, "Could not find catalog operator deployment")
//
// // rescale catalog operator
// t.Log("Rescaling catalog operator...")
// err = rescaleDeployment(c, deployment)
// require.NoError(t, err, "Could not rescale catalog operator")
// t.Log("Catalog operator rescaled")
//
// // check for last synced update to catalogsource
// t.Log("Checking for catalogsource lastSync updates")
// _, err = fetchCatalogSource(t, crc, catalogSourceName, testNamespace, func(cs *v1alpha1.CatalogSource) bool {
// if cs.Status.LastSync.After(catalogSource.Status.LastSync.Time) {
// t.Logf("lastSync updated: %s -> %s", catalogSource.Status.LastSync, cs.Status.LastSync)
// return true
// }
// return false
// })
// require.NoError(t, err, "Catalog source never loaded into memory after catalog operator rescale")
// t.Logf("Catalog source sucessfully loaded after rescale")
//}

func getOperatorDeployment(c operatorclient.ClientInterface, operatorLabels labels.Set) (*appsv1.Deployment, error) {
deployments, err := c.ListDeploymentsWithLabels(testNamespace, operatorLabels)
Expand Down
2 changes: 2 additions & 0 deletions test/e2e/csv_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ func fetchCSV(t *testing.T, c versioned.Interface, name string, checker csvCondi
return false, err
}
t.Logf("%s (%s): %s", fetched.Status.Phase, fetched.Status.Reason, fetched.Status.Message)
t.Logf("%s: %#v", fetched.GetName(), fetched.Status)
return checker(fetched), nil
})

Expand Down Expand Up @@ -167,6 +168,7 @@ func waitForCSVToDelete(t *testing.T, c versioned.Interface, name string) error
return true, nil
}
t.Logf("%s (%s): %s", fetched.Status.Phase, fetched.Status.Reason, fetched.Status.Message)
t.Logf("%s: %#v", fetched.GetName(), fetched.Status)
if err != nil {
return false, err
}
Expand Down

0 comments on commit 552b7e5

Please sign in to comment.