Skip to content

Commit

Permalink
Switch to v2 registry for e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Andy Goldstein committed Apr 16, 2015
1 parent a243c99 commit 3736115
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 13 deletions.
32 changes: 20 additions & 12 deletions hack/test-end-to-end.sh
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ openshift admin policy add-role-to-user view e2e-user --namespace=default
openshift admin new-project test --description="This is an example project to demonstrate OpenShift v3" --admin="e2e-user"
openshift admin new-project docker --description="This is an example project to demonstrate OpenShift v3" --admin="e2e-user"
openshift admin new-project custom --description="This is an example project to demonstrate OpenShift v3" --admin="e2e-user"
openshift admin new-project cache --description="This is an example project to demonstrate OpenShift v3" --admin="e2e-user"

echo "The console should be available at ${API_SCHEME}://${PUBLIC_MASTER_HOST}:${API_PORT}/console."
echo "Log in as 'e2e-user' to see the 'test' project."
Expand All @@ -257,13 +258,10 @@ openshift admin router --create --credentials="${CERT_DIR}/openshift-router/.kub

# install the registry. The --mount-host option is provided to reuse local storage.
echo "[INFO] Installing the registry"
# TODO: add --images="${USE_IMAGES}" when the Docker registry is built alongside OpenShift
openshift admin registry --create --credentials="${CERT_DIR}/openshift-registry/.kubeconfig" --mount-host="/tmp/openshift.local.registry" --images='openshift/origin-${component}:latest'
openshift admin registry --create --credentials="${CERT_DIR}/openshift-registry/.kubeconfig" --mount-host="/tmp/openshift.local.registry" --images="${USE_IMAGES}"

echo "[INFO] Pre-pulling and pushing ruby-20-centos7"
docker pull openshift/ruby-20-centos7:latest
# TODO: remove after this becomes part of the build
docker pull openshift/origin-docker-registry
echo "[INFO] Pulled ruby-20-centos7"

echo "[INFO] Waiting for Docker registry pod to start"
Expand All @@ -274,30 +272,40 @@ wait_for_command '[[ "$(osc get endpoints docker-registry --output-version=v1bet
DOCKER_REGISTRY=$(osc get --output-version=v1beta1 --template="{{ .portalIP }}:{{ .port }}" service docker-registry)

echo "[INFO] Verifying the docker-registry is up at ${DOCKER_REGISTRY}"
wait_for_url_timed "http://${DOCKER_REGISTRY}" "[INFO] Docker registry says: " $((2*TIME_MIN))
wait_for_url_timed "http://${DOCKER_REGISTRY}/healthz" "[INFO] Docker registry says: " $((2*TIME_MIN))

[ "$(dig @${API_HOST} "docker-registry.default.local." A)" ]

docker tag -f openshift/ruby-20-centos7:latest ${DOCKER_REGISTRY}/test/ruby-20-centos7:latest
docker push ${DOCKER_REGISTRY}/test/ruby-20-centos7:latest
# Client setup (log in as e2e-user and set 'test' as the default project)
# This is required to be able to push to the registry!
echo "[INFO] Logging in as a regular user (e2e-user:pass) with project 'test'..."
osc login -u e2e-user -p pass
osc project cache
token=$(osc config view --flatten -o template -t '{{range .users}}{{if eq .name "e2e-user"}}{{.user.token}}{{end}}{{end}}')
[[ -n ${token} ]]

docker login -u e2e-user -p ${token} -e e2e-user@openshift.com ${DOCKER_REGISTRY}
docker tag -f openshift/ruby-20-centos7:latest ${DOCKER_REGISTRY}/cache/ruby-20-centos7:latest
docker push ${DOCKER_REGISTRY}/cache/ruby-20-centos7:latest
echo "[INFO] Pushed ruby-20-centos7"

echo "[INFO] Back to 'master' context with 'admin' user..."
osc project default

# Process template and create
echo "[INFO] Submitting application template json for processing..."
osc process -n test -f examples/sample-app/application-template-stibuild.json > "${STI_CONFIG_FILE}"
osc process -n docker -f examples/sample-app/application-template-dockerbuild.json > "${DOCKER_CONFIG_FILE}"
osc process -n custom -f examples/sample-app/application-template-custombuild.json > "${CUSTOM_CONFIG_FILE}"

# Client setup (log in as e2e-user and set 'test' as the default project)
echo "[INFO] Logging in as a regular user (e2e-user:pass) with project 'test'..."
osc login -u e2e-user -p pass
echo "[INFO] Back to 'test' context with 'e2e-user' user"
osc project test

echo "[INFO] Applying STI application config"
osc create -f "${STI_CONFIG_FILE}"


# this needs to be done before waiting fo the build because right now only cluster-admins can see build logs, because that uses proxy
# this needs to be done before waiting for the build because right now only cluster-admins can see build logs, because that uses proxy
echo "[INFO] Back to 'master' context with 'admin' user..."
osc project default

Expand Down Expand Up @@ -336,7 +344,7 @@ osc exec -p ${registry_pod} whoami | grep root
# Port forwarding
echo "[INFO] Validating port-forward"
osc port-forward -p ${registry_pod} 5001:5000 &> "${LOG_DIR}/port-forward.log" &
wait_for_url_timed "http://localhost:5001/" "[INFO] Docker registry says: " $((10*TIME_SEC))
wait_for_url_timed "http://localhost:5001/healthz" "[INFO] Docker registry says: " $((10*TIME_SEC))

# UI e2e tests can be found in assets/test/e2e
if [[ "$TEST_ASSETS" == "true" ]]; then
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/server/bootstrappolicy/policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ func GetBootstrapMasterRoles(masterNamespace string) []authorizationapi.Role {
},
{
Verbs: util.NewStringSet("create"),
Resources: util.NewStringSet("imagerepositorymappings"),
Resources: util.NewStringSet("imagerepositorymappings", "imagestreammappings"),
},
},
},
Expand Down

0 comments on commit 3736115

Please sign in to comment.