Skip to content
This repository has been archived by the owner on Oct 3, 2019. It is now read-only.

Test operator source #181

Merged
merged 23 commits into from
May 10, 2019
Merged

Conversation

pmacik
Copy link
Contributor

@pmacik pmacik commented May 6, 2019

This PR:

  • Adds a make target (test-operator-source) to execute a simple test for verifying that the operator is successfully installed from application registry on Quay.io.

It is a functional test for OperatorSource. The files included in the pull request define the OperatorSource itself and it's corresponding CatalogSource, and Subscription.

It depends on the push-operator-app-registry make target from #174 that creates a CSV for the operator and pushes it to quay.io. The test-operator-source make target runs the test to verify the creation of the Subscription, InstallPlan, and verifies that the operator's pod has started.

@pmacik
Copy link
Contributor Author

pmacik commented May 6, 2019

This PR replaces and extends the #135.

@pmacik pmacik force-pushed the test-operator-source branch from 9db44f6 to 005cb96 Compare May 6, 2019 13:58
@ldimaggi
Copy link
Contributor

ldimaggi commented May 6, 2019

Small syntax error in make file:

Line 106 should be:

$(eval INSTALL_PLAN := $(shell oc get sub devconsole -n openshift-operators -o jsonpath='{.status.installplan.name}'))

@ldimaggi
Copy link
Contributor

ldimaggi commented May 6, 2019

I'd also be interested in seeing the state of the pod - so that the test will cover these steps:

.PHONY: test-operator-source
test-operator-source: push-operator-app-registry
	$(eval OPSRC_NAME := devconsole-operators-$(TAG))
	$(Q)oc project openshift-marketplace 
	$(Q)sed -e "s,REPLACE_NAMESPACE,$(DEVCONSOLE_APPR_NAMESPACE)," ./test/opsrc/operator_source.yaml | sed -e "s,REPLACE_OPERATOR_SOURCE_NAME,$(OPSRC_NAME)," | oc apply -f -
	$(Q)oc apply -f ./test/opsrc/catalog_source.yaml
	$(Q)oc apply -f ./test/opsrc/subscription.yaml
	$(Q)oc get sub devconsole -n openshift-operators
	$(eval INSTALL_PLAN := $(shell oc get sub devconsole -n openshift-operators -o jsonpath='{.status.installplan.name}'))
	$(Q)oc get installplan $(INSTALL_PLAN) -n openshift-operators
	$(Q)oc get pods  -l name=devconsole-operator -n openshift-operators -o jsonpath='{.items[*].status.phase}{"\n"}'
	$(Q)go test -vet off ${V_FLAG} $(shell go list ./... | grep /test/opsrc) -failfast

We will want to wrap the actual test steps in Go so that the perform asserts.

simple_test.zip

@sbose78
Copy link
Member

sbose78 commented May 6, 2019

/retest

@pmacik pmacik changed the title WIP: Test operator source Test operator source May 9, 2019
@sbose78
Copy link
Member

sbose78 commented May 9, 2019

Add a description please :)

@ldimaggi
Copy link
Contributor

ldimaggi commented May 9, 2019

Add a description please :)

This pull request implements a functional test for OperatorSource. The files included in the pull request define the Operator Source, it's corresponding CatalogSource, and Subscription.

The push-operator-app-registry make target creates the OperatorSouce and pushes the Operator to quay.io. The test-operator-source make target runs the test to verify the creation of the OperatirSubscription, install plan, and verifies that the Operator's pod has started.

@pmacik
Copy link
Contributor Author

pmacik commented May 9, 2019

@sbose78, @ldimaggi: I updated the PR's description.

Copy link
Contributor

@ldimaggi ldimaggi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Final changes LGTM.

test/opsrc/catalog_source.yaml Outdated Show resolved Hide resolved
test/opsrc/basic_test.go Outdated Show resolved Hide resolved
@sbose78
Copy link
Member

sbose78 commented May 10, 2019

Nice work @pmacik and @ldimaggi !

@baijum
Copy link
Member

baijum commented May 10, 2019

/ok-to-test

@openshift-ci-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: baijum, ldimaggi

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@baijum baijum merged commit 4328441 into redhat-developer:master May 10, 2019
@pmacik pmacik deleted the test-operator-source branch May 13, 2019 05:54
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants