Skip to content
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

Adds tests for crosspulls #9731

Merged
merged 2 commits into from
Jul 8, 2016
Merged
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
53 changes: 49 additions & 4 deletions test/end-to-end/core.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ function wait_for_app() {

echo "[INFO] Waiting for database service to start"
os::cmd::try_until_text "oc get -n $1 services" 'database' "$(( 2 * TIME_MIN ))"
DB_IP=$(oc get -n "$1" --output-version=v1beta3 --template="{{ .spec.portalIP }}" service database)
DB_IP=$(oc get -n "$1" --template="{{ .spec.portalIP }}" service database)

echo "[INFO] Waiting for frontend pod to start"
os::cmd::try_until_text "oc get -n $1 pods" 'frontend.+Running' "$(( 2 * TIME_MIN ))"
os::cmd::expect_success "oc logs dc/frontend -n $1"

echo "[INFO] Waiting for frontend service to start"
os::cmd::try_until_text "oc get -n $1 services" 'frontend' "$(( 2 * TIME_MIN ))"
FRONTEND_IP=$(oc get -n "$1" --output-version=v1beta3 --template="{{ .spec.portalIP }}" service frontend)
FRONTEND_IP=$(oc get -n "$1" --template="{{ .spec.portalIP }}" service frontend)

echo "[INFO] Waiting for database to start..."
wait_for_url_timed "http://${DB_IP}:5434" "[INFO] Database says: " $((3*TIME_MIN))
Expand Down Expand Up @@ -90,7 +90,7 @@ os::cmd::expect_success_and_text "oc rsh dc/docker-registry cat config.yml" "500
os::cmd::expect_success_and_text "oc rsh rc/docker-registry-1 cat config.yml" "5000"

# services can end up on any IP. Make sure we get the IP we need for the docker registry
DOCKER_REGISTRY=$(oc get --output-version=v1beta3 --template="{{ .spec.portalIP }}:{{ with index .spec.ports 0 }}{{ .port }}{{ end }}" service docker-registry)
DOCKER_REGISTRY=$(oc get --template="{{ .spec.portalIP }}:{{ (index .spec.ports 0).port }}" service docker-registry)

os::cmd::expect_success_and_text "dig @${API_HOST} docker-registry.default.svc.cluster.local. +short A | head -n 1" "${DOCKER_REGISTRY/:5000}"

Expand Down Expand Up @@ -132,6 +132,51 @@ os::cmd::expect_success "docker pull ${DOCKER_REGISTRY}/cache/mysql:pullthrough"
echo "[INFO] Docker start with GCS"
os::cmd::expect_failure_and_text "docker run -e REGISTRY_STORAGE=\"gcs: {}\" openshift/origin-docker-registry:${TAG}" "No bucket parameter provided"

# verify we can pull from tagged image (using tag)
imageid=$(docker images | grep centos/ruby-22-centos7 | awk '{ print $3 }')
os::cmd::expect_success "docker rmi -f ${imageid}"
echo "[INFO] Tagging ruby-22-centos7:latest to the same image stream and pulling it"
os::cmd::expect_success "oc tag ruby-22-centos7:latest ruby-22-centos7:new-tag"
os::cmd::expect_success "docker pull ${DOCKER_REGISTRY}/cache/ruby-22-centos7:new-tag"
echo "[INFO] The same image stream pull successful"

imageid=$(docker images | grep cache/ruby-22-centos7 | awk '{ print $3 }')
os::cmd::expect_success "docker rmi -f ${imageid}"
echo "[INFO] Tagging ruby-22-centos7:latest to cross repository and pulling it"
os::cmd::expect_success "oc tag ruby-22-centos7:latest cross:repo-pull"
os::cmd::expect_success "docker pull ${DOCKER_REGISTRY}/cache/cross:repo-pull"
echo "[INFO] Cross repository pull successful"

imageid=$(docker images | grep cache/cross | awk '{ print $3 }')
Copy link

Choose a reason for hiding this comment

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

👍 I'd do the same.

os::cmd::expect_success "docker rmi -f ${imageid}"
echo "[INFO] Tagging ruby-22-centos7:latest to cross namespace and pulling it"
os::cmd::expect_success "oc tag cache/ruby-22-centos7:latest cross:namespace-pull -n custom"
os::cmd::expect_success "docker pull ${DOCKER_REGISTRY}/custom/cross:namespace-pull"
echo "[INFO] Cross namespace pull successful"

# verify we can pull from tagged image (using imageid)
imageid=$(docker images | grep custom/cross | awk '{ print $3 }')
os::cmd::expect_success "docker rmi -f ${imageid}"
tagid=$(oc get istag ruby-22-centos7:latest --template={{.image.metadata.name}})
echo "[INFO] Tagging ruby-22-centos7@${tagid} to the same image stream and pulling it"
os::cmd::expect_success "oc tag ruby-22-centos7@${tagid} ruby-22-centos7:new-id-tag"
os::cmd::expect_success "docker pull ${DOCKER_REGISTRY}/cache/ruby-22-centos7:new-id-tag"
echo "[INFO] The same image stream pull successful"

imageid=$(docker images | grep cache/ruby-22-centos7 | awk '{ print $3 }')
os::cmd::expect_success "docker rmi -f ${imageid}"
echo "[INFO] Tagging ruby-22-centos7@${tagid} to cross repository and pulling it"
os::cmd::expect_success "oc tag ruby-22-centos7@${tagid} cross:repo-pull-id"
os::cmd::expect_success "docker pull ${DOCKER_REGISTRY}/cache/cross:repo-pull-id"
echo "[INFO] Cross repository pull successful"

imageid=$(docker images | grep cache/cross | awk '{ print $3 }')
os::cmd::expect_success "docker rmi -f ${imageid}"
echo "[INFO] Tagging ruby-22-centos7@${tagid} to cross namespace and pulling it"
os::cmd::expect_success "oc tag cache/ruby-22-centos7@${tagid} cross:namespace-pull-id -n custom"
os::cmd::expect_success "docker pull ${DOCKER_REGISTRY}/custom/cross:namespace-pull-id"
echo "[INFO] Cross namespace pull successful"

# check to make sure an image-pusher can push an image
os::cmd::expect_success 'oc policy add-role-to-user system:image-pusher pusher'
os::cmd::expect_success 'oc login -u pusher -p pass'
Expand Down Expand Up @@ -297,7 +342,7 @@ os::cmd::expect_success "oc project ${CLUSTER_ADMIN_CONTEXT}"

# ensure the router is started
# TODO: simplify when #4702 is fixed upstream
os::cmd::try_until_text "oc get endpoints router --output-version=v1beta3 --template='{{ if .subsets }}{{ len .subsets }}{{ else }}0{{ end }}'" '[1-9]+' $((5*TIME_MIN))
os::cmd::try_until_text "oc get endpoints router --template='{{ if .subsets }}{{ len .subsets }}{{ else }}0{{ end }}'" '[1-9]+' $((5*TIME_MIN))
echo "[INFO] Waiting for router to start..."
router_pod=$(oc get pod -n default -l deploymentconfig=router --template='{{(index .items 0).metadata.name}}')
healthz_uri="http://$(oc get pod "${router_pod}" --template='{{.status.podIP}}'):1936/healthz"
Expand Down