Skip to content

Commit 7fe74fd

Browse files
author
OpenShift Bot
authored
Merge pull request #13361 from smarterclayton/more_bindata
Merged by openshift-bot
2 parents b9dbbff + 42deef1 commit 7fe74fd

13 files changed

+19167
-46
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ verify: build
7777
{ \
7878
hack/verify-gofmt.sh ||r=1;\
7979
hack/verify-govet.sh ||r=1;\
80-
hack/verify-generated-bootstrap-bindata.sh ||r=1;\
80+
hack/verify-generated-bindata.sh ||r=1;\
8181
hack/verify-generated-deep-copies.sh ||r=1;\
8282
hack/verify-generated-conversions.sh ||r=1;\
8383
hack/verify-generated-clientsets.sh ||r=1;\
@@ -107,7 +107,7 @@ verify-commits:
107107
# Example:
108108
# make update
109109
update: build
110-
hack/update-generated-bootstrap-bindata.sh
110+
hack/update-generated-bindata.sh
111111
hack/update-generated-deep-copies.sh
112112
hack/update-generated-conversions.sh
113113
hack/update-generated-clientsets.sh

hack/update-generated-bootstrap-bindata.sh renamed to hack/update-generated-bindata.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,29 @@ pushd "${OS_ROOT}" > /dev/null
3232
${EXAMPLES}/heapster/... \
3333
${EXAMPLES}/prometheus/... \
3434
pkg/image/admission/imagepolicy/api/v1/...
35+
36+
"$(os::util::find::gopath_binary go-bindata)" \
37+
-nocompress \
38+
-nometadata \
39+
-prefix "testextended" \
40+
-pkg "testdata" \
41+
-o "${OUTPUT_PARENT}/test/extended/testdata/bindata.go" \
42+
-ignore "\.DS_Store" \
43+
-ignore ".*\.(go|md)$" \
44+
test/extended/testdata/... \
45+
test/integration/testdata \
46+
examples/db-templates \
47+
examples/image-streams \
48+
examples/sample-app \
49+
examples/hello-openshift \
50+
examples/jenkins/...
51+
3552
popd > /dev/null
3653

54+
# If you hit this, please reduce other tests instead of importing more
55+
if [[ "$( cat "${OUTPUT_PARENT}/test/extended/testdata/bindata.go" | wc -c )" -gt 650000 ]]; then
56+
echo "error: extended bindata is $( cat "${OUTPUT_PARENT}/test/extended/testdata/bindata.go" | wc -c ) bytes, reduce the size of the import" 1>&2
57+
exit 1
58+
fi
59+
3760
ret=$?; ENDTIME=$(date +%s); echo "$0 took $(($ENDTIME - $STARTTIME)) seconds"; exit "$ret"

hack/util.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ function find_files() {
8686
-o -wholename './pkg/assets/*/bindata.go' \
8787
-o -wholename './pkg/bootstrap/bindata.go' \
8888
-o -wholename './openshift.local.*' \
89+
-o -wholename './test/extended/testdata/bindata.go' \
8990
-o -wholename '*/vendor/*' \
9091
-o -wholename './assets/bower_components/*' \
9192
\) -prune \

hack/verify-generated-bindata.sh

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/bin/bash
2+
source "$(dirname "${BASH_SOURCE}")/lib/init.sh"
3+
4+
echo "===== Verifying Generated Bindata ====="
5+
6+
TMP_GENERATED_BOOTSTRAP_DIR="_output/verify-bindata"
7+
8+
echo "Generating bindata..."
9+
if ! output=`OUTPUT_ROOT=${TMP_GENERATED_BOOTSTRAP_DIR} ${OS_ROOT}/hack/update-generated-bindata.sh 2>&1`
10+
then
11+
echo "FAILURE: Generation of fresh bindata failed:"
12+
echo "$output"
13+
exit 1
14+
fi
15+
16+
echo "Diffing current bootstrap bindata against freshly generated bindata"
17+
ret=0
18+
diff -Naup "${OS_ROOT}/pkg/bootstrap/bindata.go" "${TMP_GENERATED_BOOTSTRAP_DIR}/pkg/bootstrap/bindata.go" || ret=$?
19+
if [[ $ret -eq 0 ]]
20+
then
21+
echo "SUCCESS: Generated bootstrap bindata up to date."
22+
else
23+
rm -rf "${TMP_GENERATED_BOOTSTRAP_DIR}"
24+
echo "FAILURE: Generated bootstrap bindata out of date. Please run hack/update-generated-bindata.sh"
25+
exit 1
26+
fi
27+
28+
echo "Diffing current test/extended bindata against freshly generated bindata"
29+
ret=0
30+
diff -Naup "${OS_ROOT}/test/extended/testdata/bindata.go" "${TMP_GENERATED_BOOTSTRAP_DIR}/test/extended/testdata/bindata.go" || ret=$?
31+
rm -rf "${TMP_GENERATED_BOOTSTRAP_DIR}"
32+
if [[ $ret -eq 0 ]]
33+
then
34+
echo "SUCCESS: Generated test/extended bindata up to date."
35+
else
36+
rm -rf "${TMP_GENERATED_BOOTSTRAP_DIR}"
37+
echo "FAILURE: Generated test/extended bindata out of date. Please run hack/update-generated-bindata.sh"
38+
exit 1
39+
fi
40+
41+
rm -rf "${TMP_GENERATED_BOOTSTRAP_DIR}"

hack/verify-generated-bootstrap-bindata.sh

Lines changed: 0 additions & 26 deletions
This file was deleted.

test/extended/alternate_certs.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ source "$(dirname "${BASH_SOURCE}")/../../hack/lib/init.sh"
66
os::cleanup::tmpdir
77
os::util::environment::setup_all_server_vars
88

9-
export EXTENDED_TEST_PATH="${OS_ROOT}/test/extended"
10-
119
function cleanup()
1210
{
1311
out=$?

test/extended/alternate_launches.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ os::util::environment::use_sudo
99
os::cleanup::tmpdir
1010
os::util::environment::setup_all_server_vars
1111

12-
export EXTENDED_TEST_PATH="${OS_ROOT}/test/extended"
13-
1412
function cleanup()
1513
{
1614
out=$?

test/extended/builds/docker_quota.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ package builds
22

33
import (
44
"fmt"
5+
"os"
6+
"path/filepath"
57

68
g "github.com/onsi/ginkgo"
79
o "github.com/onsi/gomega"
@@ -36,7 +38,9 @@ var _ = g.Describe("[builds][quota][Slow] docker build with a quota", func() {
3638
o.Expect(err).NotTo(o.HaveOccurred())
3739

3840
g.By("starting a test build")
39-
br, err := exutil.StartBuildAndWait(oc, "docker-build-quota", "--from-dir", exutil.FixturePath("testdata", "build-quota"))
41+
path := exutil.FixturePath("testdata", "build-quota")
42+
o.Expect(os.Chmod(filepath.Join(path, ".s2i", "bin", "assemble"), 0755)).NotTo(o.HaveOccurred())
43+
br, err := exutil.StartBuildAndWait(oc, "docker-build-quota", "--from-dir", path)
4044

4145
g.By("expecting the build is in Failed phase")
4246
br.AssertFailure()

test/extended/builds/start.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,12 @@ var _ = g.Describe("[builds][Slow] starting a build using CLI", func() {
9393
g.Describe("binary builds", func() {
9494
var commit string
9595

96+
// do a best effort to initialize the repo in case it is a raw checkout or temp dir
97+
tryRepoInit := func(exampleBuild string) {
98+
out, err := exec.Command("bash", "-c", fmt.Sprintf("cd %q; if ! git rev-parse --git-dir; then git init .; git add .; git commit -m 'first'; touch foo; git add .; git commit -m 'second'; fi; true", exampleBuild)).CombinedOutput()
99+
fmt.Fprintf(g.GinkgoWriter, "Tried to init git repo: %v\n%s\n", err, string(out))
100+
}
101+
96102
g.It("should accept --from-file as input", func() {
97103
g.By("starting the build with a Dockerfile")
98104
br, err := exutil.StartBuildAndWait(oc, "sample-build", fmt.Sprintf("--from-file=%s", exampleGemfile))
@@ -120,6 +126,7 @@ var _ = g.Describe("[builds][Slow] starting a build using CLI", func() {
120126

121127
g.It("should accept --from-repo as input", func() {
122128
g.By("starting the build with a Git repository")
129+
tryRepoInit(exampleBuild)
123130
br, err := exutil.StartBuildAndWait(oc, "sample-build", fmt.Sprintf("--from-repo=%s", exampleBuild))
124131
br.AssertSuccess()
125132
buildLog, err := br.Logs()
@@ -133,6 +140,7 @@ var _ = g.Describe("[builds][Slow] starting a build using CLI", func() {
133140

134141
g.It("should accept --from-repo with --commit as input", func() {
135142
g.By("starting the build with a Git repository")
143+
tryRepoInit(exampleBuild)
136144
gitCmd := exec.Command("git", "rev-parse", "HEAD~1")
137145
gitCmd.Dir = exampleBuild
138146
commitByteArray, err := gitCmd.CombinedOutput()

test/extended/networking.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,6 @@ function run-extended-tests() {
208208
fi
209209

210210
export KUBECONFIG="${kubeconfig}"
211-
export EXTENDED_TEST_PATH="${OS_ROOT}/test/extended"
212211

213212
local test_args="--test.v '--ginkgo.skip=${skip_regex}' \
214213
'--ginkgo.focus=${focus_regex}' ${TEST_EXTRA_ARGS}"
@@ -230,7 +229,7 @@ function run-extended-tests() {
230229
fi
231230
fi
232231

233-
pushd "${EXTENDED_TEST_PATH}/networking" > /dev/null
232+
pushd "${OS_ROOT}/test/extended/networking" > /dev/null
234233
eval "${test_cmd}; "'exit_status=${PIPESTATUS[0]}'
235234
popd > /dev/null
236235

test/extended/setup.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ function os::test::extended::setup () {
2929
os::util::ensure::built_binary_exists 'junitmerge'
3030

3131
# ensure proper relative directories are set
32-
export EXTENDED_TEST_PATH="${OS_ROOT}/test/extended"
3332
export KUBE_REPO_ROOT="${OS_ROOT}/vendor/k8s.io/kubernetes"
3433

3534
os::util::environment::setup_time_vars

0 commit comments

Comments
 (0)