Add a proper exit 1 under swagger spec
| ... | ... |
@@ -8,7 +8,8 @@ env: |
| 8 | 8 |
- TEST_ASSETS=false |
| 9 | 9 |
|
| 10 | 10 |
install: |
| 11 |
- - PATH=$HOME/gopath/bin:$PATH make install-travis |
|
| 11 |
+ - export PATH=$GOPATH/bin:./third_party/etcd:$PATH |
|
| 12 |
+ - make install-travis |
|
| 12 | 13 |
|
| 13 | 14 |
script: |
| 14 | 15 |
- make check-test TESTFLAGS="-p=4" TESTS="''" # empty quotes are because hack/test-go.sh requires 2 args |
| ... | ... |
@@ -47,6 +47,21 @@ check: |
| 47 | 47 |
TEST_KUBE=1 hack/test-go.sh $(WHAT) $(TESTS) $(TESTFLAGS) |
| 48 | 48 |
.PHONY: check |
| 49 | 49 |
|
| 50 |
+# Verify code is properly organized. |
|
| 51 |
+# |
|
| 52 |
+# Example: |
|
| 53 |
+# make verify |
|
| 54 |
+verify: build |
|
| 55 |
+ hack/verify-gofmt.sh |
|
| 56 |
+ hack/verify-govet.sh |
|
| 57 |
+ hack/verify-generated-deep-copies.sh |
|
| 58 |
+ hack/verify-generated-conversions.sh |
|
| 59 |
+ hack/verify-generated-completions.sh |
|
| 60 |
+ hack/verify-generated-docs.sh |
|
| 61 |
+ hack/verify-generated-swagger-spec.sh |
|
| 62 |
+ hack/verify-api-descriptions.sh |
|
| 63 |
+.PHONY: verify |
|
| 64 |
+ |
|
| 50 | 65 |
# Install travis dependencies |
| 51 | 66 |
# |
| 52 | 67 |
# Args: |
| ... | ... |
@@ -61,7 +76,7 @@ install-travis: |
| 61 | 61 |
endif |
| 62 | 62 |
.PHONY: install-travis |
| 63 | 63 |
|
| 64 |
-# Build and run unit and integration tests that don't require Docker. |
|
| 64 |
+# Run unit and integration tests that don't require Docker. |
|
| 65 | 65 |
# |
| 66 | 66 |
# Args: |
| 67 | 67 |
# GOFLAGS: Extra flags to pass to 'go' when building. |
| ... | ... |
@@ -76,16 +91,7 @@ ifeq ($(TEST_ASSETS), true) |
| 76 | 76 |
check-test: |
| 77 | 77 |
hack/test-assets.sh |
| 78 | 78 |
else |
| 79 |
-check-test: build check |
|
| 80 |
-check-test: |
|
| 81 |
- hack/verify-gofmt.sh |
|
| 82 |
- hack/verify-govet.sh |
|
| 83 |
- hack/verify-generated-deep-copies.sh |
|
| 84 |
- hack/verify-generated-conversions.sh |
|
| 85 |
- hack/verify-generated-completions.sh |
|
| 86 |
- hack/verify-generated-docs.sh |
|
| 87 |
- hack/verify-generated-swagger-spec.sh |
|
| 88 |
- hack/verify-api-descriptions.sh |
|
| 79 |
+check-test: verify check |
|
| 89 | 80 |
hack/test-cmd.sh |
| 90 | 81 |
KUBE_RACE=" " hack/test-integration.sh |
| 91 | 82 |
endif |
| ... | ... |
@@ -104,19 +110,11 @@ test: export KUBE_COVER= -cover -covermode=atomic |
| 104 | 104 |
test: export KUBE_RACE= -race |
| 105 | 105 |
ifeq ($(SKIP_BUILD), true) |
| 106 | 106 |
$(info build is being skipped) |
| 107 |
-test: check |
|
| 107 |
+test: check verify |
|
| 108 | 108 |
else |
| 109 |
-test: build check |
|
| 109 |
+test: build check verify |
|
| 110 | 110 |
endif |
| 111 | 111 |
test: |
| 112 |
- hack/verify-gofmt.sh |
|
| 113 |
- hack/verify-govet.sh |
|
| 114 |
- hack/verify-generated-deep-copies.sh |
|
| 115 |
- hack/verify-generated-conversions.sh |
|
| 116 |
- hack/verify-generated-completions.sh |
|
| 117 |
- hack/verify-generated-docs.sh |
|
| 118 |
- hack/verify-generated-swagger-spec.sh |
|
| 119 |
- hack/verify-api-descriptions.sh |
|
| 120 | 112 |
hack/test-cmd.sh |
| 121 | 113 |
KUBE_RACE=" " hack/test-integration-docker.sh |
| 122 | 114 |
hack/test-end-to-end-docker.sh |
| ... | ... |
@@ -43,9 +43,17 @@ SWAGGER_API_PATH="${HOST}/swaggerapi/"
|
| 43 | 43 |
# Prevent user environment from colliding with the test setup |
| 44 | 44 |
unset KUBECONFIG |
| 45 | 45 |
|
| 46 |
-# set path so OpenShift is available |
|
| 47 |
-GO_OUT="${OS_ROOT}/_output/local/go/bin"
|
|
| 48 |
-export PATH="${GO_OUT}:${PATH}"
|
|
| 46 |
+openshift=$(cd "${OS_ROOT}"; echo "$(pwd)/_output/local/go/bin/openshift")
|
|
| 47 |
+ |
|
| 48 |
+if [[ ! -e "${openshift}" ]]; then
|
|
| 49 |
+ {
|
|
| 50 |
+ echo "It looks as if you don't have a compiled openshift binary" |
|
| 51 |
+ echo |
|
| 52 |
+ echo "If you are running from a clone of the git repo, please run" |
|
| 53 |
+ echo "'./hack/build-go.sh'." |
|
| 54 |
+ } >&2 |
|
| 55 |
+ exit 1 |
|
| 56 |
+fi |
|
| 49 | 57 |
|
| 50 | 58 |
# create temp dir |
| 51 | 59 |
TEMP_DIR=${USE_TEMP:-$(mktemp -d /tmp/openshift-cmd.XXXX)}
|
| ... | ... |
@@ -54,7 +62,7 @@ export CURL_CA_BUNDLE="${TEMP_DIR}/openshift.local.config/master/ca.crt"
|
| 54 | 54 |
# Start openshift |
| 55 | 55 |
echo "Starting OpenShift..." |
| 56 | 56 |
pushd "${TEMP_DIR}" > /dev/null
|
| 57 |
-OPENSHIFT_ON_PANIC=crash openshift start master --listen="https://0.0.0.0:8443" --master="https://127.0.0.1:8443" &> /dev/null & |
|
| 57 |
+OPENSHIFT_ON_PANIC=crash "${openshift}" start master --master="https://127.0.0.1:8443" >/dev/null 2>&1 &
|
|
| 58 | 58 |
OS_PID=$! |
| 59 | 59 |
popd > /dev/null |
| 60 | 60 |
|
| ... | ... |
@@ -65,11 +73,11 @@ echo "Updating ${SWAGGER_SPEC_OUT_DIR}:"
|
| 65 | 65 |
ENDPOINT_TYPES="oapi api" |
| 66 | 66 |
for type in $ENDPOINT_TYPES |
| 67 | 67 |
do |
| 68 |
- ENDPOINTS=$(curl "${HOST}" | grep -Po "(?<=\/${type}\/)[a-z0-9]+" | sed '/v1beta3/d')
|
|
| 68 |
+ ENDPOINTS=(v1) |
|
| 69 | 69 |
for endpoint in $ENDPOINTS |
| 70 | 70 |
do |
| 71 | 71 |
echo "Updating ${SWAGGER_SPEC_OUT_DIR}/${type}-${endpoint}.json from ${SWAGGER_API_PATH}${type}/${endpoint}..."
|
| 72 |
- curl "${SWAGGER_API_PATH}${type}/${endpoint}" > "${SWAGGER_SPEC_OUT_DIR}/${type}-${endpoint}.json"
|
|
| 72 |
+ curl -w "\n" "${SWAGGER_API_PATH}${type}/${endpoint}" > "${SWAGGER_SPEC_OUT_DIR}/${type}-${endpoint}.json"
|
|
| 73 | 73 |
done |
| 74 | 74 |
done |
| 75 | 75 |
echo "SUCCESS" |
| ... | ... |
@@ -5,10 +5,9 @@ |
| 5 | 5 |
TIME_SEC=1000 |
| 6 | 6 |
TIME_MIN=$((60 * $TIME_SEC)) |
| 7 | 7 |
|
| 8 |
-# setup_env_vars exports all the necessary environment variables for configuring and |
|
| 8 |
+# setup_env_vars exports all the necessary environment variables for configuring and |
|
| 9 | 9 |
# starting OS server. |
| 10 | 10 |
function setup_env_vars {
|
| 11 |
- export TRAVIS_TEST="${TRAVIS_TEST:-false}"
|
|
| 12 | 11 |
export ETCD_DATA_DIR="${BASETMPDIR}/etcd"
|
| 13 | 12 |
export VOLUME_DIR="${BASETMPDIR}/volumes"
|
| 14 | 13 |
export FAKE_HOME_DIR="${BASETMPDIR}/openshift.local.home"
|
| ... | ... |
@@ -1,6 +1,6 @@ |
| 1 | 1 |
#!/bin/bash |
| 2 | 2 |
|
| 3 |
-set -e |
|
| 3 |
+set -o errexit |
|
| 4 | 4 |
set -o nounset |
| 5 | 5 |
set -o pipefail |
| 6 | 6 |
|
| ... | ... |
@@ -9,7 +9,7 @@ source "${OS_ROOT}/hack/common.sh"
|
| 9 | 9 |
|
| 10 | 10 |
cd "${OS_ROOT}"
|
| 11 | 11 |
|
| 12 |
-echo "===== Verifying Swagger Spec =====" |
|
| 12 |
+echo "===== Verifying API Swagger Spec =====" |
|
| 13 | 13 |
|
| 14 | 14 |
SPECROOT_REL="api/swagger-spec" |
| 15 | 15 |
SPECROOT="${OS_ROOT}/${SPECROOT_REL}"
|
| ... | ... |
@@ -21,6 +21,7 @@ if ! output=`${OS_ROOT}/hack/update-generated-swagger-spec.sh ${REL_TMP_PATH} 2>
|
| 21 | 21 |
then |
| 22 | 22 |
echo "FAILURE: Generation of fresh spec failed:" |
| 23 | 23 |
echo "$output" |
| 24 |
+ exit 1 |
|
| 24 | 25 |
fi |
| 25 | 26 |
|
| 26 | 27 |
echo "Diffing current spec against freshly generated spec..." |