Skip to content

Commit

Permalink
Merge pull request #13669 from soltysh/issue12558
Browse files Browse the repository at this point in the history
Increase journald rate limiter when running test-end-to-end-docker.sh
  • Loading branch information
smarterclayton authored Jun 7, 2017
2 parents 74571f6 + b34ba02 commit 3c221d5
Show file tree
Hide file tree
Showing 5 changed files with 120 additions and 30 deletions.
7 changes: 4 additions & 3 deletions hack/lib/util/misc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,11 @@ readonly -f os::util::format_seconds
# Return:
# None
function os::util::sed() {
local sudo="${USE_SUDO:+sudo}"
if LANG=C sed --help 2>&1 | grep -q "GNU sed"; then
sed -i'' "$@"
${sudo} sed -i'' "$@"
else
sed -i '' "$@"
${sudo} sed -i '' "$@"
fi
}
readonly -f os::util::sed
Expand Down Expand Up @@ -202,4 +203,4 @@ function os::util::curl_etcd() {
function os::util::host_platform() {
echo "$(go env GOHOSTOS)/$(go env GOHOSTARCH)"
}
readonly -f os::util::host_platform
readonly -f os::util::host_platform
24 changes: 24 additions & 0 deletions hack/test-end-to-end-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,36 @@ fi
function cleanup() {
return_code=$?
os::cleanup::all "${return_code}"

# restore journald to previous form
if os::util::ensure::system_binary_exists 'systemctl'; then
os::log::info "Restoring journald limits"
${USE_SUDO:+sudo} mv /etc/systemd/{journald.conf.bak,journald.conf}
${USE_SUDO:+sudo} systemctl restart systemd-journald.service
# Docker has "some" problems when journald is restarted, so we need to
# restart docker, as well.
${USE_SUDO:+sudo} systemctl restart docker.service
fi

exit "${return_code}"
}
trap "cleanup" EXIT

os::log::system::start

# This turns-off rate limiting in journald to bypass the problem from
# https://github.com/openshift/origin/issues/12558.
if os::util::ensure::system_binary_exists 'systemctl'; then
os::log::info "Turning off journald limits"
${USE_SUDO:+sudo} cp /etc/systemd/{journald.conf,journald.conf.bak}
os::util::sed "s/^.*RateLimitInterval.*$/RateLimitInterval=0/g" /etc/systemd/journald.conf
os::util::sed "s/^.*RateLimitBurst.*$/RateLimitBurst=0/g" /etc/systemd/journald.conf
${USE_SUDO:+sudo} systemctl restart systemd-journald.service
# Docker has "some" problems when journald is restarted, so we need to
# restart docker, as well.
${USE_SUDO:+sudo} systemctl restart docker.service
fi

# Setup
os::log::info "openshift version: `openshift version`"
os::log::info "oc version: `oc version`"
Expand Down
39 changes: 14 additions & 25 deletions test/end-to-end/core.sh
Original file line number Diff line number Diff line change
Expand Up @@ -378,30 +378,19 @@ os::cmd::expect_success 'oc login -u e2e-user'
os::cmd::expect_success 'oc project test'
os::cmd::expect_success 'oc whoami'

if [[ -n "${SOLTYSH_DEBUG:-}" ]]; then
os::log::info "Running a CLI command in a container using the service account"
os::cmd::expect_success 'oc policy add-role-to-user view -z default'
os::cmd::try_until_success "oc sa get-token default"
oc run cli-with-token --attach --image="${IMAGE_PREFIX}:${TAG}" --restart=Never -- cli status --loglevel=4 > "${LOG_DIR}/cli-with-token.log" 2>&1
# TODO remove set +o errexit, once https://github.com/openshift/origin/issues/12558 gets proper fix
set +o errexit
os::cmd::expect_success_and_text "cat '${LOG_DIR}/cli-with-token.log'" 'Using in-cluster configuration'
os::cmd::expect_success_and_text "cat '${LOG_DIR}/cli-with-token.log'" 'In project test'
set -o errexit
os::cmd::expect_success 'oc delete pod cli-with-token'
oc run cli-with-token-2 --attach --image="${IMAGE_PREFIX}:${TAG}" --restart=Never -- cli whoami --loglevel=4 > "${LOG_DIR}/cli-with-token2.log" 2>&1
# TODO remove set +o errexit, once https://github.com/openshift/origin/issues/12558 gets proper fix
set +o errexit
os::cmd::expect_success_and_text "cat '${LOG_DIR}/cli-with-token2.log'" 'system:serviceaccount:test:default'
set -o errexit
os::cmd::expect_success 'oc delete pod cli-with-token-2'
oc run kubectl-with-token --attach --image="${IMAGE_PREFIX}:${TAG}" --restart=Never --command -- kubectl get pods --loglevel=4 > "${LOG_DIR}/kubectl-with-token.log" 2>&1
# TODO remove set +o errexit, once https://github.com/openshift/origin/issues/12558 gets proper fix
set +o errexit
os::cmd::expect_success_and_text "cat '${LOG_DIR}/kubectl-with-token.log'" 'Using in-cluster configuration'
os::cmd::expect_success_and_text "cat '${LOG_DIR}/kubectl-with-token.log'" 'kubectl-with-token'
set -o errexit
fi
os::log::info "Running a CLI command in a container using the service account"
os::cmd::expect_success 'oc policy add-role-to-user view -z default'
os::cmd::try_until_success "oc sa get-token default"
oc run cli-with-token --attach --image="${IMAGE_PREFIX}:${TAG}" --restart=Never -- cli status --loglevel=4 > "${LOG_DIR}/cli-with-token.log" 2>&1
os::cmd::expect_success_and_text "cat '${LOG_DIR}/cli-with-token.log'" 'Using in-cluster configuration'
os::cmd::expect_success_and_text "cat '${LOG_DIR}/cli-with-token.log'" 'In project test'
os::cmd::expect_success 'oc delete pod cli-with-token'
oc run cli-with-token-2 --attach --image="${IMAGE_PREFIX}:${TAG}" --restart=Never -- cli whoami --loglevel=4 > "${LOG_DIR}/cli-with-token2.log" 2>&1
os::cmd::expect_success_and_text "cat '${LOG_DIR}/cli-with-token2.log'" 'system:serviceaccount:test:default'
os::cmd::expect_success 'oc delete pod cli-with-token-2'
oc run kubectl-with-token --attach --image="${IMAGE_PREFIX}:${TAG}" --restart=Never --command -- kubectl get pods --loglevel=4 > "${LOG_DIR}/kubectl-with-token.log" 2>&1
os::cmd::expect_success_and_text "cat '${LOG_DIR}/kubectl-with-token.log'" 'Using in-cluster configuration'
os::cmd::expect_success_and_text "cat '${LOG_DIR}/kubectl-with-token.log'" 'kubectl-with-token'

os::log::info "Testing deployment logs and failing pre and mid hooks ..."
# test hook selectors
Expand Down Expand Up @@ -471,7 +460,7 @@ os::log::info "Validating exec"
frontend_pod=$(oc get pod -l deploymentconfig=frontend --template='{{(index .items 0).metadata.name}}')
# when running as a restricted pod the registry will run with a pre-allocated
# user in the neighborhood of 1000000+. Look for a substring of the pre-allocated uid range
os::cmd::expect_success_and_text "oc exec -p ${frontend_pod} id" '1000'
os::cmd::expect_success_and_text "oc exec ${frontend_pod} id" '1000'
os::cmd::expect_success_and_text "oc rsh pod/${frontend_pod} id -u" '1000'
os::cmd::expect_success_and_text "oc rsh -T ${frontend_pod} id -u" '1000'

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 3c221d5

Please sign in to comment.