-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Integration tests for registry, replacing existing #888
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,119 @@ | ||
| kind: Template | ||
| apiVersion: template.openshift.io/v1 | ||
|
|
||
| parameters: | ||
| - name: JOB_NAME_SAFE | ||
| required: true | ||
| - name: IMAGE_CONTROL_PLANE | ||
| required: true | ||
| - name: LOCAL_IMAGE_TEST_BIN | ||
| required: true | ||
| - name: COMMAND | ||
| required: true | ||
| - name: NAMESPACE | ||
| required: true | ||
|
|
||
| objects: | ||
|
|
||
| # We want the cluster to be able to access these images | ||
| - kind: RoleBinding | ||
| apiVersion: authorization.openshift.io/v1 | ||
| metadata: | ||
| name: ${JOB_NAME_SAFE}-image-puller | ||
| namespace: ${NAMESPACE} | ||
| roleRef: | ||
| name: system:image-puller | ||
| subjects: | ||
| - kind: SystemGroup | ||
| name: system:unauthenticated | ||
|
|
||
| # The pod spins up a simple openshift control plane as a sidecar and waits for the | ||
| # COMMAND specified to the template to be executed, before itself exiting. The test | ||
| # container is given access to the generated config and the admin.kubeconfig. | ||
| - kind: Pod | ||
| apiVersion: v1 | ||
| metadata: | ||
| name: ${JOB_NAME_SAFE} | ||
| namespace: ${NAMESPACE} | ||
| spec: | ||
| restartPolicy: Never | ||
| activeDeadlineSeconds: 7200 | ||
| terminationGracePeriodSeconds: 600 | ||
| volumes: | ||
| - name: artifacts | ||
| emptyDir: {} | ||
| - name: shared-tmp | ||
| emptyDir: {} | ||
|
|
||
| containers: | ||
|
|
||
| # Once admin.kubeconfig exists, executes shared tests | ||
| - name: test | ||
| image: ${LOCAL_IMAGE_TEST_BIN} | ||
| volumeMounts: | ||
| - name: shared-tmp | ||
| mountPath: /tmp/shared | ||
| - name: artifacts | ||
| mountPath: /tmp/artifacts | ||
| command: | ||
| - /bin/bash | ||
| - -c | ||
| - | | ||
| #!/bin/bash | ||
| set -euo pipefail | ||
|
|
||
| trap 'touch /tmp/shared/exit' EXIT | ||
| trap 'kill $(jobs -p); exit 0' TERM | ||
|
|
||
| # wait until the master job creates admin.kubeconfig | ||
| while true; do | ||
| if [[ ! -f /tmp/shared/admin.kubeconfig ]]; then | ||
| sleep 5 & wait | ||
| continue | ||
| fi | ||
| break | ||
| done | ||
| echo "Found kubeconfig" | ||
| export KUBECONFIG=/tmp/shared/admin.kubeconfig | ||
|
|
||
| ${COMMAND} | ||
|
|
||
| # Start a standalone master | ||
| - name: control-plane | ||
| image: ${IMAGE_CONTROL_PLANE} | ||
| volumeMounts: | ||
| - name: shared-tmp | ||
| mountPath: /tmp/shared | ||
| - name: artifacts | ||
| mountPath: /tmp/artifacts | ||
| env: | ||
| - name: TYPE | ||
| value: ${CLUSTER_TYPE} | ||
| command: | ||
| - /bin/bash | ||
| - -c | ||
| - | | ||
| #!/bin/bash | ||
| set -euo pipefail | ||
| function teardown() { | ||
| set +e | ||
| echo "Gathering artifacts ..." | ||
| } | ||
| trap 'teardown' EXIT | ||
| trap 'kill $(jobs -p); exit 0' TERM | ||
|
|
||
| ( | ||
| while true; do | ||
| if [[ -f /tmp/shared/exit ]]; then | ||
| echo "Shutting down" | ||
| kill 1 | ||
| exit 0 | ||
| fi | ||
| sleep 5 | ||
| done | ||
| ) & | ||
|
|
||
| mkdir /tmp/cluster && cd /tmp/cluster | ||
| openshift start master --write-config=/tmp/shared | ||
| openshift start master --config=/tmp/shared/master-config.yaml & | ||
| wait $! | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
either use /tmp/admin.kubeconfig or copy from the other container to the right place
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using /tmp/shared consistently.