Skip to content
Open
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
20 changes: 12 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,10 @@ PROMETHEUS_RULES_NAMESPACE ?= "__NAMESPACE__"
all: manager

# Run all tests
test: test-unit test-e2e test-crds test-manifests-version
test: test-unit test-integration test-e2e test-crds test-manifests-version

# Run unit tests
TEST_UNIT_PKGS = $(shell $(GO) list ./... | grep -E 'github.com/3scale/3scale-operator/pkg|github.com/3scale/3scale-operator/apis|github.com/3scale/3scale-operator/test/unitcontrollers|github.com/3scale/3scale-operator/controllers/capabilities')
TEST_UNIT_PKGS = $(shell $(GO) list ./... | grep -Ev 'github.com/3scale/3scale-operator/test/(e2e|integration|crds|manifests-version)')
TEST_UNIT_COVERPKGS = $(shell $(GO) list ./... | grep -v github.com/3scale/3scale-operator/test | tr "\n" ",") # Exclude test directories as coverpkg does not accept only-tests packages
test-unit: clean-cov generate fmt vet manifests
mkdir -p "$(PROJECT_PATH)/_output"
Expand All @@ -123,12 +123,16 @@ test-manifests-version:
$(GO) test -v $(TEST_MANIFESTS_VERSION_PKGS)

# Run e2e tests
TEST_E2E_PKGS_APPS = $(shell $(GO) list ./... | grep 'github.com/3scale/3scale-operator/controllers/apps')
TEST_E2E_PKGS_CAPABILITIES = $(shell $(GO) list ./... | grep 'github.com/3scale/3scale-operator/controllers/capabilities')
test-e2e: generate fmt vet manifests setup-envtest
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" USE_EXISTING_CLUSTER=true $(GO) test $(TEST_E2E_PKGS_APPS) -coverprofile cover.out -ginkgo.v -v -timeout 0
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" USE_EXISTING_CLUSTER=true $(GO) test $(TEST_E2E_PKGS_CAPABILITIES) -coverprofile cover.out -v -timeout 0

TEST_E2E_PKGS = $(shell $(GO) list ./... | grep 'github.com/3scale/3scale-operator/test/e2e')
.PHONY: test-e2e
test-e2e:
$(GO) test $(TEST_E2E_PKGS) -ginkgo.v -v -timeout 0

# Run integration tests
TEST_INTEGRATION_PKGS = $(shell $(GO) list ./... | grep 'github.com/3scale/3scale-operator/test/integration')
.PHONY: test-integration
test-integration: generate fmt vet manifests setup-envtest
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" USE_EXISTING_CLUSTER=true $(GO) test $(TEST_INTEGRATION_PKGS) -coverprofile cover.out -ginkgo.v -v -timeout 0

# Build manager binary
manager: generate fmt vet
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package controllers
package integration

import (
"context"
Expand All @@ -10,6 +10,7 @@ import (

"github.com/3scale/3scale-operator/apis/apps"
appsv1alpha1 "github.com/3scale/3scale-operator/apis/apps/v1alpha1"
controllers "github.com/3scale/3scale-operator/controllers/apps"
"github.com/3scale/3scale-operator/pkg/3scale/amp/component"
"github.com/3scale/3scale-operator/pkg/helper"
"github.com/google/uuid"
Expand Down Expand Up @@ -975,7 +976,7 @@ func waitForAPIManagerLabels(namespace string, retryInterval time.Duration, time
}

expectedLabels := map[string]string{
fmt.Sprintf("%s%s", APImanagerSecretLabelPrefix, string(customEnvSecret.GetUID())): "true",
fmt.Sprintf("%s%s", controllers.APImanagerSecretLabelPrefix, string(customEnvSecret.GetUID())): "true",
}

// Then verify that the hash matches the hashed config secret
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package controllers
package integration

import (
"context"
Expand All @@ -37,6 +37,7 @@ import (
appsv1alpha1 "github.com/3scale/3scale-operator/apis/apps/v1alpha1"
capabilitiesv1alpha1 "github.com/3scale/3scale-operator/apis/capabilities/v1alpha1"
capabilitiesv1beta1 "github.com/3scale/3scale-operator/apis/capabilities/v1beta1"
controllers "github.com/3scale/3scale-operator/controllers/apps"
"github.com/3scale/3scale-operator/pkg/reconcilers"
grafanav1alpha1 "github.com/grafana-operator/grafana-operator/v4/api/integreatly/v1alpha1"
configv1 "github.com/openshift/api/config/v1"
Expand Down Expand Up @@ -125,7 +126,7 @@ var _ = BeforeSuite(func() {
discoveryClientAPIManager, err := discovery.NewDiscoveryClientForConfig(mgr.GetConfig())
Expect(err).ToNot(HaveOccurred())

err = (&APIManagerReconciler{
err = (&controllers.APIManagerReconciler{
BaseReconciler: reconcilers.NewBaseReconciler(
context.Background(),
mgr.GetClient(),
Expand Down
Loading