Skip to content

Commit

Permalink
Merge pull request #17029 from bparees/clusterup_extended
Browse files Browse the repository at this point in the history
Automatic merge from submit-queue.

fix cluster up extended test
  • Loading branch information
openshift-merge-robot committed Oct 26, 2017
2 parents adce86e + e01bb9b commit 4d27cb3
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 20 deletions.
4 changes: 4 additions & 0 deletions pkg/oc/bootstrap/docker/openshift/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -709,6 +709,10 @@ func (h *Helper) updateConfig(configDir string, opt *StartOptions) error {
cfg.AdmissionConfig.PluginConfig["GenericAdmissionWebhook"] = configapi.AdmissionPluginConfig{
Configuration: &configapi.DefaultAdmissionConfig{},
}

if cfg.KubernetesMasterConfig.APIServerArguments == nil {
cfg.KubernetesMasterConfig.APIServerArguments = configapi.ExtendedArguments{}
}
cfg.KubernetesMasterConfig.APIServerArguments["runtime-config"] = append(cfg.KubernetesMasterConfig.APIServerArguments["runtime-config"], "apis/admissionregistration.k8s.io/v1alpha1=true")

if len(opt.RoutingSuffix) > 0 {
Expand Down
92 changes: 72 additions & 20 deletions test/extended/clusterup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ os::util::environment::setup_all_server_vars "test-extended/clusterup"

os::util::ensure::built_binary_exists 'oc'
os::util::environment::use_sudo
os::util::environment::setup_time_vars

function os::test::extended::clusterup::run_test () {
local test="${1}"
Expand Down Expand Up @@ -129,7 +130,8 @@ function os::test::extended::clusterup::internal::hostdirs () {
--host-data-dir="${data_dir}" \
--host-config-dir="${config_dir}" \
--host-pv-dir="${pv_dir}" \
${volumes_arg}
${volumes_arg} \
--version="$ORIGIN_COMMIT"

local sudo="${USE_SUDO:+sudo}"
os::cmd::expect_success "${sudo} ls ${config_dir}/master/master-config.yaml"
Expand All @@ -139,7 +141,7 @@ function os::test::extended::clusterup::internal::hostdirs () {

# Tests the simplest case, no arguments specified
function os::test::extended::clusterup::noargs () {
os::test::extended::clusterup::standard_test
os::test::extended::clusterup::standard_test "--version=$ORIGIN_COMMIT"
}

# Tests creating a cluster with specific host directories
Expand All @@ -155,76 +157,110 @@ function os::test::extended::clusterup::hostdirs () {

# Tests bringing up the service catalog and provisioning a template
function os::test::extended::clusterup::service_catalog() {
os::cmd::expect_success "oc cluster up --service-catalog --version=latest"
os::cmd::expect_success "oc cluster up --service-catalog --version=$ORIGIN_COMMIT"
os::test::extended::clusterup::verify_router_and_registry
os::test::extended::clusterup::verify_image_streams
os::cmd::expect_success "oc login -u system:admin"
os::cmd::expect_success "oc adm policy add-cluster-role-to-group system:openshift:templateservicebroker-client system:unauthenticated system:authenticated"
# this is only to allow for the retrieval of the TSB service IP, not actual use of the TSB endpoints
os::cmd::expect_success "oc policy add-role-to-user view developer -n openshift-template-service-broker"
os::cmd::expect_success "oc login -u developer"
os::cmd::expect_success "pushd ${OS_ROOT}/pkg/template/servicebroker/test-scripts; serviceUUID=`oc get template jenkins-ephemeral -n openshift -o template --template '{{.metadata.uid}}'` ./provision.sh"
os::cmd::expect_success "pushd ${OS_ROOT}/pkg/templateservicebroker/servicebroker/test-scripts; serviceUUID=`oc get template jenkins-ephemeral -n openshift -o template --template '{{.metadata.uid}}'` ./provision.sh"
os::cmd::try_until_text "oc get pods" "jenkins-1-deploy" $(( 2*minute )) 1
os::cmd::expect_success "pushd ${OS_ROOT}/pkg/template/servicebroker/test-scripts; serviceUUID=`oc get template jenkins-ephemeral -n openshift -o template --template '{{.metadata.uid}}'` ./bind.sh"
os::cmd::expect_success "pushd ${OS_ROOT}/pkg/template/servicebroker/test-scripts; serviceUUID=`oc get template jenkins-ephemeral -n openshift -o template --template '{{.metadata.uid}}'` ./unbind.sh"
os::cmd::expect_success "pushd ${OS_ROOT}/pkg/template/servicebroker/test-scripts; serviceUUID=`oc get template jenkins-ephemeral -n openshift -o template --template '{{.metadata.uid}}'` ./deprovision.sh"
os::cmd::expect_success "pushd ${OS_ROOT}/pkg/templateservicebroker/servicebroker/test-scripts; serviceUUID=`oc get template jenkins-ephemeral -n openshift -o template --template '{{.metadata.uid}}'` ./bind.sh"
os::cmd::expect_success "pushd ${OS_ROOT}/pkg/templateservicebroker/servicebroker/test-scripts; serviceUUID=`oc get template jenkins-ephemeral -n openshift -o template --template '{{.metadata.uid}}'` ./unbind.sh"
os::cmd::expect_success "pushd ${OS_ROOT}/pkg/templateservicebroker/servicebroker/test-scripts; serviceUUID=`oc get template jenkins-ephemeral -n openshift -o template --template '{{.metadata.uid}}'` ./deprovision.sh"
os::cmd::try_until_text "oc get pods" "Terminating" $(( 2*minute )) 1
}



# Tests creating a cluster with an alternate image and tag
function os::test::extended::clusterup::image () {
function os::test::extended::clusterup::image::ose3.3 () {
os::test::extended::clusterup::standard_test \
--image="registry.access.redhat.com/openshift3/ose" \
--version="v3.3"
os::cmd::expect_success_and_text "docker inspect -f '{{ .Config.Image }}' origin" "registry.access.redhat.com/openshift3/ose:v3.3"
}

# Tests creating a cluster with an alternate image and tag
function os::test::extended::clusterup::image::ose3.4 () {
os::test::extended::clusterup::standard_test \
--image="registry.access.redhat.com/openshift3/ose" \
--version="v3.4"
os::cmd::expect_success_and_text "docker inspect -f '{{ .Config.Image }}' origin" "registry.access.redhat.com/openshift3/ose:v3.4"
}

# Tests creating a cluster with an alternate image and tag
function os::test::extended::clusterup::image::ose3.5 () {
os::test::extended::clusterup::standard_test \
--image="registry.access.redhat.com/openshift3/ose" \
--version="v3.5"
os::cmd::expect_success_and_text "docker inspect -f '{{ .Config.Image }}' origin" "registry.access.redhat.com/openshift3/ose:v3.5"
}

# Tests creating a cluster with an alternate image and tag
function os::test::extended::clusterup::image::ose3.6 () {
os::test::extended::clusterup::standard_test \
--image="registry.access.redhat.com/openshift3/ose" \
--version="v3.6"
os::cmd::expect_success_and_text "docker inspect -f '{{ .Config.Image }}' origin" "registry.access.redhat.com/openshift3/ose:v3.6"
}

# make sure the defaults (which will use the latest tagged origin release images) work.
function os::test::extended::clusterup::default () {
os::test::extended::clusterup::standard_test
}

# Tests creating a cluster with a public hostname
function os::test::extended::clusterup::publichostname () {
os::test::extended::clusterup::standard_test \
--public-hostname="my.server.name"
os::cmd::expect_success_and_text "docker exec origin cat /var/lib/origin/openshift.local.config/master/master-config.yaml" "masterPublicURL.*my\.server\.name"
--public-hostname="myserver.127.0.0.1.nip.io" \
--version="$ORIGIN_COMMIT"
os::cmd::expect_success_and_text "docker exec origin cat /var/lib/origin/openshift.local.config/master/master-config.yaml" "masterPublicURL.*myserver\.127\.0\.0\.1\.nip\.io"
}

# Tests creating a cluster with a numeric public hostname
function os::test::extended::clusterup::numerichostname () {
os::test::extended::clusterup::standard_test \
--public-hostname="127.0.0.1"
--public-hostname="127.0.0.1" \
--version="$ORIGIN_COMMIT"
os::cmd::expect_success_and_text "docker exec origin cat /var/lib/origin/openshift.local.config/master/master-config.yaml" "masterPublicURL.*127\.0\.0\.1"
}

# Tests installation of metrics components
function os::test::extended::clusterup::metrics () {
os::test::extended::clusterup::standard_test --metrics
os::test::extended::clusterup::standard_test --metrics --version="$ORIGIN_COMMIT"
os::test::extended::clusterup::verify_metrics
}

# Tests installation of aggregated logging components
function os::test::extended::clusterup::logging () {
os::test::extended::clusterup::standard_test --logging
os::test::extended::clusterup::standard_test --logging --version="$ORIGIN_COMMIT"
os::test::extended::clusterup::verify_logging
}

# Verifies that a service can be accessed by a peer pod
# and by the pod running the service
function os::test::extended::clusterup::svcaccess () {
os::cmd::expect_success "oc cluster up"
os::cmd::expect_success "oc cluster up --version=$ORIGIN_COMMIT"
os::cmd::expect_success "oc create -f ${OS_ROOT}/examples/gitserver/gitserver-persistent.yaml"
os::cmd::try_until_text "oc get endpoints git -o jsonpath='{ .subsets[*].ports[?(@.name==\"8080-tcp\")].port }'" "8080" $(( 10*minute )) 1
os::cmd::try_until_text "oc get endpoints git -o jsonpath='{ .subsets[*].ports[?(@.port==8080)].port }'" "8080" $(( 10*minute )) 1
# Test that a service can be accessed from a peer pod
os::cmd::expect_success "timeout 2m oc run peer --image=openshift/origin-gitserver:latest --attach --restart=Never --command -- curl http://git:8080/_/healthz"
sleep 10
os::cmd::expect_success "timeout 20s oc run peer --image=openshift/origin-gitserver:latest --attach --restart=Never --command -- curl http://git:8080/_/healthz"

# Test that a service can be accessed from the same pod
os::cmd::expect_success "timeout 2m oc rsh dc/git curl http://git:8080/_/healthz"
# This doesn't work in any cluster i've tried, not sure why but it's not a cluster up issue.
#os::cmd::expect_success "timeout 2m oc rsh dc/git curl http://git:8080/_/healthz"
}

# Verifies that cluster up can start when a process is bound
# to the loopback interface with tcp port 53
function os::test::extended::clusterup::portinuse () {
# Start listening on the host's 127.0.0.1 interface, port 53
os::cmd::expect_success "docker run -d --name=port53 --entrypoint=/bin/bash --net=host openshift/origin-gitserver:latest -c \"socat TCP-LISTEN:53,bind=127.0.0.1,fork SYSTEM:'echo hello'\""
os::cmd::expect_success "oc cluster up"
os::cmd::expect_success "oc cluster up --version=$ORIGIN_COMMIT"
}

function os::test::extended::clusterup::portinuse_cleanup () {
Expand All @@ -237,17 +273,33 @@ readonly default_tests=(
"service_catalog"
"noargs"
"hostdirs"
"image"
"publichostname"
"numerichostname"
"portinuse"
# "svcaccess"
"svcaccess"

# enable once https://github.com/openshift/origin/issues/16995 is fixed
# "default"
# enable once https://github.com/openshift/origin/issues/16995 is fixed
# "image::ose3.3"
# enable once https://github.com/openshift/origin/issues/16995 is fixed
# "image::ose3.4"
# enable once https://github.com/openshift/origin/issues/16995 is fixed
# "image::ose3.5"

"image::ose3.6"

# logging+metrics team needs to fix/enable these tests.
# "metrics"
# "logging"
)

tests=("${1:-"${default_tests[@]}"}")

ORIGIN_COMMIT=${ORIGIN_COMMIT:-latest}

echo "Running cluster up tests using tag $ORIGIN_COMMIT"

# Ensure that KUBECONFIG is not set
unset KUBECONFIG
for test in "${tests[@]}"; do
Expand Down

0 comments on commit 4d27cb3

Please sign in to comment.