Skip to content

Commit 6f502d3

Browse files
author
Eric Stroczynski
authored
internal/olm/operator: OLM operator manager (#2320)
* internal/olm/operator: logic to load an operator bundle into a registry Deployment from a ConfigMap and serve that bundle from an operator-registry server to OLM * test/integration,hack/tests/integration.sh: integration tests for internal/olm/operator * Makefile,.travis.yml: run integration tests * go.mod,go.sum,test/test-framework/go.sum: revendor
1 parent 98d86ac commit 6f502d3

File tree

10 files changed

+1260
-5
lines changed

10 files changed

+1260
-5
lines changed

.travis.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,9 @@ jobs:
103103
# Build and test go
104104
- <<: *test
105105
name: Go on Kubernetes
106-
script: make test-e2e-go
106+
script:
107+
- make test-e2e-go
108+
- make test-integration
107109

108110
# Build and test ansible and test ansible using molecule
109111
- <<: *test

Makefile

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ test-markdown test/markdown:
190190
test-sanity test/sanity: tidy build/operator-sdk lint
191191
./hack/tests/sanity-check.sh
192192

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

@@ -213,8 +213,8 @@ test-subcommand-scorecard:
213213
test-subcommand-olm-install:
214214
./hack/tests/subcommand-olm-install.sh
215215

216-
# E2E tests.
217-
.PHONY: test-e2e test-e2e-go test-e2e-ansible test-e2e-ansible-molecule test-e2e-helm
216+
# E2E and integration tests.
217+
.PHONY: test-e2e test-e2e-go test-e2e-ansible test-e2e-ansible-molecule test-e2e-helm test-integration
218218

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

@@ -229,3 +229,6 @@ test-e2e-ansible-molecule: image-build-ansible
229229

230230
test-e2e-helm: image-build-helm
231231
./hack/tests/e2e-helm.sh
232+
233+
test-integration:
234+
./hack/tests/integration.sh

hack/tests/integration.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/usr/bin/env bash
2+
3+
set -eu
4+
5+
source hack/lib/image_lib.sh
6+
7+
export OSDK_INTEGRATION_IMAGE="quay.io/example/memcached-operator:v0.0.1"
8+
9+
# Build the operator image.
10+
pushd test/test-framework
11+
operator-sdk build "$OSDK_INTEGRATION_IMAGE"
12+
# If using a kind cluster, load the image into all nodes.
13+
load_image_if_kind "$OSDK_INTEGRATION_IMAGE"
14+
popd
15+
16+
# Install OLM on the cluster if not installed.
17+
olm_latest_exists=0
18+
if ! operator-sdk alpha olm status > /dev/null 2>&1; then
19+
operator-sdk alpha olm install
20+
olm_latest_exists=1
21+
fi
22+
23+
# Integration tests will use default loading rules for the kubeconfig if
24+
# KUBECONFIG is not set.
25+
go test -v ./test/integration
26+
27+
# Uninstall OLM if it was installed for test purposes.
28+
if eval "(( $olm_latest_exists ))"; then
29+
operator-sdk alpha olm uninstall
30+
fi
31+
32+
echo -e "\n=== Integration tests succeeded ===\n"

0 commit comments

Comments
 (0)