Skip to content
Merged
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
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,9 @@ jobs:
# Build and test go
- <<: *test
name: Go on Kubernetes
script: make test-e2e-go
script:
- make test-e2e-go
- make test-integration

# Build and test ansible and test ansible using molecule
- <<: *test
Expand Down
9 changes: 6 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ test-sanity test/sanity: tidy build/operator-sdk
./hack/tests/sanity-check.sh
./hack/tests/check-lint.sh ci

TEST_PKGS:=$(shell go list ./... | grep -v -P 'github.com/operator-framework/operator-sdk/(hack|test/e2e)')
TEST_PKGS:=$(shell go list ./... | grep -v -P 'github.com/operator-framework/operator-sdk/(hack/|test/)')
test-unit test/unit: ## Run the unit tests
$(Q)go test -coverprofile=coverage.out -covermode=count -count=1 -short ${TEST_PKGS}

Expand All @@ -208,8 +208,8 @@ test-subcommand-scorecard:
test-subcommand-olm-install:
./hack/tests/subcommand-olm-install.sh

# E2E tests.
.PHONY: test-e2e test-e2e-go test-e2e-ansible test-e2e-ansible-molecule test-e2e-helm
# E2E and integration tests.
.PHONY: test-e2e test-e2e-go test-e2e-ansible test-e2e-ansible-molecule test-e2e-helm test-integration

test-e2e: test-e2e-go test-e2e-ansible test-e2e-ansible-molecule test-e2e-helm ## Run the e2e tests

Expand All @@ -224,3 +224,6 @@ test-e2e-ansible-molecule: image-build-ansible

test-e2e-helm: image-build-helm
./hack/tests/e2e-helm.sh

test-integration:
./hack/tests/integration.sh
32 changes: 32 additions & 0 deletions hack/tests/integration.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env bash

set -eu

source hack/lib/image_lib.sh

export OSDK_INTEGRATION_IMAGE="quay.io/example/memcached-operator:v0.0.1"

# Build the operator image.
pushd test/test-framework
operator-sdk build "$OSDK_INTEGRATION_IMAGE"
# If using a kind cluster, load the image into all nodes.
load_image_if_kind "$OSDK_INTEGRATION_IMAGE"
popd

# Install OLM on the cluster if not installed.
olm_latest_exists=0
if ! operator-sdk alpha olm status > /dev/null 2>&1; then
operator-sdk alpha olm install
olm_latest_exists=1
fi

# Integration tests will use default loading rules for the kubeconfig if
# KUBECONFIG is not set.
go test -v ./test/integration

# Uninstall OLM if it was installed for test purposes.
if eval "(( $olm_latest_exists ))"; then
operator-sdk alpha olm uninstall
fi

echo -e "\n=== Integration tests succeeded ===\n"
Loading