...

Text file src/k8s.io/kubernetes/test/cmd/proxy.sh

Documentation: k8s.io/kubernetes/test/cmd

     1#!/usr/bin/env bash
     2
     3# Copyright 2018 The Kubernetes Authors.
     4#
     5# Licensed under the Apache License, Version 2.0 (the "License");
     6# you may not use this file except in compliance with the License.
     7# You may obtain a copy of the License at
     8#
     9#     http://www.apache.org/licenses/LICENSE-2.0
    10#
    11# Unless required by applicable law or agreed to in writing, software
    12# distributed under the License is distributed on an "AS IS" BASIS,
    13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    14# See the License for the specific language governing permissions and
    15# limitations under the License.
    16
    17set -o errexit
    18set -o nounset
    19set -o pipefail
    20
    21run_kubectl_local_proxy_tests() {
    22  set -o nounset
    23  set -o errexit
    24
    25  kube::log::status "Testing kubectl local proxy"
    26
    27  start-proxy
    28  check-curl-proxy-code /api/kubernetes 404
    29  check-curl-proxy-code /api/v1/namespaces 200
    30  if kube::test::if_supports_resource "metrics" ; then
    31    check-curl-proxy-code /metrics 200
    32  fi
    33  if kube::test::if_supports_resource "static" ; then
    34    check-curl-proxy-code /static/ 200
    35  fi
    36  stop-proxy
    37
    38  # Make sure the in-development api is accessible by default
    39  start-proxy
    40  check-curl-proxy-code /apis 200
    41  check-curl-proxy-code /apis/apps/ 200
    42  stop-proxy
    43
    44  # Custom paths let you see everything.
    45  start-proxy /custom
    46  check-curl-proxy-code /custom/api/kubernetes 404
    47  check-curl-proxy-code /custom/api/v1/namespaces 200
    48  if kube::test::if_supports_resource "metrics" ; then
    49    check-curl-proxy-code /custom/metrics 200
    50  fi
    51  check-curl-proxy-code /custom/api/v1/namespaces 200
    52  stop-proxy
    53
    54  set +o nounset
    55  set +o errexit
    56}

View as plain text