forked from kubernetes-sigs/kubebuilder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.sh
executable file
·138 lines (111 loc) · 3.01 KB
/
test.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
#!/usr/bin/env bash
# Copyright 2018 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -o errexit
set -o nounset
set -o pipefail
source common.sh
function test_init_project {
header_text "performing init project"
kubebuilder init --domain example.com <<< "y"
make
cache_dep
}
function test_init_project_manual_dep_ensure {
header_text "performing init project w/o dep ensure"
kubebuilder init --domain example.com <<< "n"
dep ensure -v
make
}
function test_create_api_controller {
header_text "performing creating api and controller"
kubebuilder create api --group insect --version v1beta1 --kind Bee --namespaced false <<EOF
y
y
EOF
}
function test_create_namespaced_api_controller {
header_text "performing creating namespaced api and controller"
kubebuilder create api --group insect --version v1beta1 --kind Bee --namespaced true <<EOF
y
y
EOF
}
function test_create_api_only {
header_text "performing creating api only"
kubebuilder create api --group insect --version v1beta1 --kind Bee --namespaced false <<EOF
y
n
EOF
}
function test_create_namespaced_api_only {
header_text "performing creating api only"
kubebuilder create api --group insect --version v1beta1 --kind Bee --namespaced true <<EOF
y
n
EOF
}
function test_create_skip {
header_text "performing creating but skipping everything"
kubebuilder create api --group insect --version v1beta1 --kind Bee <<EOF
n
n
EOF
}
function test_create_coretype_controller {
header_text "performing creating coretype controller"
kubebuilder create api --group apps --version v1 --kind Deployment --namespaced false <<EOF
n
y
EOF
}
function test_create_namespaced_coretype_controller {
header_text "performing creating coretype controller"
kubebuilder create api --group apps --version v1 --kind Deployment --namespaced true <<EOF
n
y
EOF
}
prepare_staging_dir
fetch_tools
build_kb
setup_envs
prepare_testdir_under_gopath
test_init_project
prepare_testdir_under_gopath
test_init_project_manual_dep_ensure
prepare_testdir_under_gopath
dump_cache
test_create_api_controller
prepare_testdir_under_gopath
dump_cache
test_create_namespaced_api_controller
prepare_testdir_under_gopath
dump_cache
test_create_api_only
prepare_testdir_under_gopath
dump_cache
test_create_namespaced_api_only
prepare_testdir_under_gopath
dump_cache
test_create_coretype_controller
prepare_testdir_under_gopath
dump_cache
test_create_namespaced_coretype_controller
cd $GOPATH/src/sigs.k8s.io/kubebuilder
go test ./cmd/... ./pkg/...
cd test/project
make
cd -
exit $rc