@@ -33,145 +33,164 @@ function os::test::extended::setup () {
33
33
export KUBE_REPO_ROOT=" ${OS_ROOT} /vendor/k8s.io/kubernetes"
34
34
35
35
# allow setup to be skipped
36
- if [[ -z " ${TEST_ONLY+x} " ]]; then
37
- os::util::environment::setup_time_vars
38
- os::util::environment::use_sudo
39
- os::util::environment::setup_all_server_vars " test-extended/core"
40
-
41
- os::util::ensure::iptables_privileges_exist
42
-
43
- function cleanup() {
44
- out=$?
45
- cleanup_openshift
46
-
47
- # TODO(skuznets): un-hack this nonsense once traps are in a better
48
- # state
49
- if [[ -n " ${JUNIT_REPORT_OUTPUT:- } " ]]; then
50
- # get the jUnit output file into a workable state in case we
51
- # crashed in the middle of testing something
52
- os::test::junit::reconcile_output
53
-
54
- # check that we didn't mangle jUnit output
55
- os::test::junit::check_test_counters
56
-
57
- # use the junitreport tool to generate us a report
58
- os::util::ensure::built_binary_exists ' junitreport'
59
-
60
- cat " ${JUNIT_REPORT_OUTPUT} " \
61
- | junitreport --type oscmd \
62
- --suites nested \
63
- --roots github.com/openshift/origin \
64
- --output " ${ARTIFACT_DIR} /report.xml"
65
- cat " ${ARTIFACT_DIR} /report.xml" | junitreport summarize
66
- fi
36
+ if [[ -n " ${TEST_ONLY+x} " ]]; then
37
+ # be sure to set VOLUME_DIR if you are running with TEST_ONLY
38
+ os::log::info " Not starting server, VOLUME_DIR=${VOLUME_DIR:- } "
39
+ return 0
40
+ fi
67
41
68
- os::log::info " Exiting "
69
- return $out
70
- }
42
+ os::util::environment::setup_time_vars
43
+ os::util::environment::use_sudo
44
+ os::util::environment::setup_all_server_vars " test-extended/core "
71
45
72
- trap " exit" INT TERM
73
- trap " cleanup" EXIT
74
- os::log::info " Starting server"
46
+ os::util::ensure::iptables_privileges_exist
75
47
76
- os::util::environment::setup_images_vars
48
+ function cleanup() {
49
+ out=$?
50
+ cleanup_openshift
77
51
78
- local sudo=${USE_SUDO: +sudo}
52
+ # TODO(skuznets): un-hack this nonsense once traps are in a better
53
+ # state
54
+ if [[ -n " ${JUNIT_REPORT_OUTPUT:- } " ]]; then
55
+ # get the jUnit output file into a workable state in case we
56
+ # crashed in the middle of testing something
57
+ os::test::junit::reconcile_output
79
58
80
- # If the current system has the XFS volume dir mount point we configure
81
- # in the test images, assume to use it which will allow the local storage
82
- # quota tests to pass.
83
- LOCAL_STORAGE_QUOTA=" "
84
- if [[ -d " /mnt/openshift-xfs-vol-dir" ]] && ${sudo} lvs | grep -q " xfs" ; then
85
- LOCAL_STORAGE_QUOTA=" 1"
86
- export VOLUME_DIR=" /mnt/openshift-xfs-vol-dir"
87
- else
88
- os::log::warn " /mnt/openshift-xfs-vol-dir does not exist, local storage quota tests may fail."
89
- fi
59
+ # check that we didn't mangle jUnit output
60
+ os::test::junit::check_test_counters
61
+
62
+ # use the junitreport tool to generate us a report
63
+ os::util::ensure::built_binary_exists ' junitreport'
90
64
91
- # Allow setting $JUNIT_REPORT to toggle output behavior
92
- if [[ -n " ${JUNIT_REPORT:- } " ]]; then
93
- export JUNIT_REPORT_OUTPUT=" ${LOG_DIR} /raw_test_output.log"
94
- # the Ginkgo tests also generate jUnit but expect different envars
95
- export TEST_REPORT_DIR=" ${ARTIFACT_DIR} "
65
+ cat " ${JUNIT_REPORT_OUTPUT} " \
66
+ | junitreport --type oscmd \
67
+ --suites nested \
68
+ --roots github.com/openshift/origin \
69
+ --output " ${ARTIFACT_DIR} /report.xml"
70
+ cat " ${ARTIFACT_DIR} /report.xml" | junitreport summarize
96
71
fi
97
72
98
- os::log::system::start
73
+ os::log::info " Exiting"
74
+ return $out
75
+ }
99
76
100
- if [[ -n " ${SHOW_ALL :- } " ]] ; then
101
- SKIP_NODE=1
102
- fi
77
+ trap " exit " INT TERM
78
+ trap " cleanup " EXIT
79
+ os::log::info " Starting server "
103
80
104
- # when selinux is enforcing, the volume dir selinux label needs to be
105
- # svirt_sandbox_file_t
106
- #
107
- # TODO: fix the selinux policy to either allow openshift_var_lib_dir_t
108
- # or to default the volume dir to svirt_sandbox_file_t.
109
- if selinuxenabled; then
110
- ${sudo} chcon -t svirt_sandbox_file_t ${VOLUME_DIR}
111
- fi
112
- CONFIG_VERSION=" "
113
- if [[ -n " ${API_SERVER_VERSION:- } " ]]; then
114
- CONFIG_VERSION=" ${API_SERVER_VERSION} "
115
- elif [[ -n " ${CONTROLLER_VERSION:- } " ]]; then
116
- CONFIG_VERSION=" ${CONTROLLER_VERSION} "
117
- fi
118
- os::start::configure_server " ${CONFIG_VERSION} "
119
- # turn on audit logging for extended tests ... mimic what is done in os::start::configure_server, but don't
120
- # put change there - only want this for extended tests
121
- os::log::info " Turn on audit logging"
122
- cp " ${SERVER_CONFIG_DIR} /master/master-config.yaml" " ${SERVER_CONFIG_DIR} /master/master-config.orig2.yaml"
123
- openshift ex config patch " ${SERVER_CONFIG_DIR} /master/master-config.orig2.yaml" --patch=" {\" auditConfig\" : {\" enabled\" : true}}" > " ${SERVER_CONFIG_DIR} /master/master-config.yaml"
124
-
125
- # If the XFS volume dir mount point exists enable local storage quota in node-config.yaml so these tests can pass:
126
- if [[ -n " ${LOCAL_STORAGE_QUOTA} " ]]; then
127
- # The ec2 images usually have ~5Gi of space defined for the xfs vol for the registry; want to give /registry a good chunk of that
128
- # to store the images created when the extended tests run
129
- cp " ${NODE_CONFIG_DIR} /node-config.yaml" " ${NODE_CONFIG_DIR} /node-config.orig2.yaml"
130
- openshift ex config patch " ${NODE_CONFIG_DIR} /node-config.orig2.yaml" --patch=' {"volumeConfig":{"localQuota":{"perFSGroup":"4480Mi"}}}' > " ${NODE_CONFIG_DIR} /node-config.yaml"
131
- fi
132
- os::log::info " Using VOLUME_DIR=${VOLUME_DIR} "
81
+ os::util::environment::setup_images_vars
133
82
134
- # This is a bit hacky, but set the pod gc threshold appropriately for the garbage_collector test.
135
- cp " ${SERVER_CONFIG_DIR} /master/master-config.yaml" " ${SERVER_CONFIG_DIR} /master/master-config.orig3.yaml"
136
- openshift ex config patch " ${SERVER_CONFIG_DIR} /master/master-config.orig3.yaml" --patch=' {"kubernetesMasterConfig":{"controllerArguments":{"terminated-pod-gc-threshold":["100"]}}}' > " ${SERVER_CONFIG_DIR} /master/master-config.yaml"
83
+ local sudo=${USE_SUDO: +sudo}
137
84
138
- os::start::server " ${API_SERVER_VERSION:- } " " ${CONTROLLER_VERSION:- } " " ${SKIP_NODE:- } "
85
+ # If the current system has the XFS volume dir mount point we configure
86
+ # in the test images, assume to use it which will allow the local storage
87
+ # quota tests to pass.
88
+ LOCAL_STORAGE_QUOTA=" "
89
+ if [[ -d " /mnt/openshift-xfs-vol-dir" ]] && ${sudo} lvs | grep -q " xfs" ; then
90
+ LOCAL_STORAGE_QUOTA=" 1"
91
+ export VOLUME_DIR=" /mnt/openshift-xfs-vol-dir"
92
+ else
93
+ os::log::warn " /mnt/openshift-xfs-vol-dir does not exist, local storage quota tests may fail."
94
+ fi
139
95
140
- export KUBECONFIG=" ${ADMIN_KUBECONFIG} "
96
+ # Allow setting $JUNIT_REPORT to toggle output behavior
97
+ if [[ -n " ${JUNIT_REPORT:- } " ]]; then
98
+ export JUNIT_REPORT_OUTPUT=" ${LOG_DIR} /raw_test_output.log"
99
+ # the Ginkgo tests also generate jUnit but expect different envars
100
+ export TEST_REPORT_DIR=" ${ARTIFACT_DIR} "
101
+ fi
141
102
142
- os::start::registry
143
- if [[ -z " ${SKIP_NODE:- } " ]]; then
144
- oc rollout status dc/docker-registry
145
- fi
146
- DROP_SYN_DURING_RESTART=true CREATE_ROUTER_CERT=true os::start::router
103
+ os::log::system::start
147
104
148
- os::log::info " Creating image streams"
149
- oc create -n openshift -f " ${OS_ROOT} /examples/image-streams/image-streams-centos7.json" --config=" ${ADMIN_KUBECONFIG} "
150
- else
151
- # be sure to set VOLUME_DIR if you are running with TEST_ONLY
152
- os::log::info " Not starting server, VOLUME_DIR=${VOLUME_DIR:- } "
105
+ if [[ -n " ${SHOW_ALL:- } " ]]; then
106
+ SKIP_NODE=1
153
107
fi
108
+
109
+ # when selinux is enforcing, the volume dir selinux label needs to be
110
+ # svirt_sandbox_file_t
111
+ #
112
+ # TODO: fix the selinux policy to either allow openshift_var_lib_dir_t
113
+ # or to default the volume dir to svirt_sandbox_file_t.
114
+ if selinuxenabled; then
115
+ ${sudo} chcon -t svirt_sandbox_file_t ${VOLUME_DIR}
116
+ fi
117
+ CONFIG_VERSION=" "
118
+ if [[ -n " ${API_SERVER_VERSION:- } " ]]; then
119
+ CONFIG_VERSION=" ${API_SERVER_VERSION} "
120
+ elif [[ -n " ${CONTROLLER_VERSION:- } " ]]; then
121
+ CONFIG_VERSION=" ${CONTROLLER_VERSION} "
122
+ fi
123
+ os::start::configure_server " ${CONFIG_VERSION} "
124
+ # turn on audit logging for extended tests ... mimic what is done in os::start::configure_server, but don't
125
+ # put change there - only want this for extended tests
126
+ os::log::info " Turn on audit logging"
127
+ cp " ${SERVER_CONFIG_DIR} /master/master-config.yaml" " ${SERVER_CONFIG_DIR} /master/master-config.orig2.yaml"
128
+ openshift ex config patch " ${SERVER_CONFIG_DIR} /master/master-config.orig2.yaml" --patch=" {\" auditConfig\" : {\" enabled\" : true}}" > " ${SERVER_CONFIG_DIR} /master/master-config.yaml"
129
+
130
+ # If the XFS volume dir mount point exists enable local storage quota in node-config.yaml so these tests can pass:
131
+ if [[ -n " ${LOCAL_STORAGE_QUOTA} " ]]; then
132
+ # The ec2 images usually have ~5Gi of space defined for the xfs vol for the registry; want to give /registry a good chunk of that
133
+ # to store the images created when the extended tests run
134
+ cp " ${NODE_CONFIG_DIR} /node-config.yaml" " ${NODE_CONFIG_DIR} /node-config.orig2.yaml"
135
+ openshift ex config patch " ${NODE_CONFIG_DIR} /node-config.orig2.yaml" --patch=' {"volumeConfig":{"localQuota":{"perFSGroup":"4480Mi"}}}' > " ${NODE_CONFIG_DIR} /node-config.yaml"
136
+ fi
137
+ os::log::info " Using VOLUME_DIR=${VOLUME_DIR} "
138
+
139
+ # This is a bit hacky, but set the pod gc threshold appropriately for the garbage_collector test.
140
+ cp " ${SERVER_CONFIG_DIR} /master/master-config.yaml" " ${SERVER_CONFIG_DIR} /master/master-config.orig3.yaml"
141
+ openshift ex config patch " ${SERVER_CONFIG_DIR} /master/master-config.orig3.yaml" --patch=' {"kubernetesMasterConfig":{"controllerArguments":{"terminated-pod-gc-threshold":["100"]}}}' > " ${SERVER_CONFIG_DIR} /master/master-config.yaml"
142
+
143
+ os::start::server " ${API_SERVER_VERSION:- } " " ${CONTROLLER_VERSION:- } " " ${SKIP_NODE:- } "
144
+
145
+ export KUBECONFIG=" ${ADMIN_KUBECONFIG} "
146
+
147
+ os::start::registry
148
+ if [[ -z " ${SKIP_NODE:- } " ]]; then
149
+ oc rollout status dc/docker-registry
150
+ fi
151
+ DROP_SYN_DURING_RESTART=true CREATE_ROUTER_CERT=true os::start::router
152
+
153
+ os::log::info " Creating image streams"
154
+ oc create -n openshift -f " ${OS_ROOT} /examples/image-streams/image-streams-centos7.json" --config=" ${ADMIN_KUBECONFIG} "
154
155
}
155
156
156
157
# Run extended tests or print out a list of tests that need to be run
157
158
# Input:
158
159
# - FOCUS - the extended test focus
159
160
# - SKIP - the tests to skip
161
+ # - TEST_EXTENDED_SKIP - a global filter that allows additional tests to be omitted, will
162
+ # be joined with SKIP
160
163
# - SHOW_ALL - if set, then only print out tests to be run
164
+ # - TEST_PARALLEL - if set, run the tests in parallel with the specified number of nodes
161
165
# - Arguments - arguments to pass to ginkgo
162
166
function os::test::extended::run () {
163
- local listArgs=()
164
- local runArgs=()
165
- if [[ -n " ${FOCUS:- } " ]]; then
166
- listArgs+=(" --ginkgo.focus=${FOCUS} " )
167
- runArgs+=(" -focus=${FOCUS} " )
168
- fi
169
- if [[ -n " ${SKIP:- } " ]]; then
170
- listArgs+=(" --ginkgo.skip=${SKIP} " )
171
- runArgs+=(" -skip=${SKIP} " )
172
- fi
167
+ local listArgs=()
168
+ local runArgs=()
173
169
174
- if [[ -n " ${SHOW_ALL:- } " ]]; then
170
+ if [[ -n " ${FOCUS-} " ]]; then
171
+ listArgs+=(" --ginkgo.focus=${FOCUS} " )
172
+ runArgs+=(" -focus=${FOCUS} " )
173
+ fi
174
+
175
+ local skip=" ${SKIP-} "
176
+ # Allow additional skips to be provided on the command line
177
+ if [[ -n " ${TEST_EXTENDED_SKIP-} " ]]; then
178
+ if [[ -n " ${skip} " ]]; then
179
+ skip=" ${skip} |${TEST_EXTENDED_SKIP} "
180
+ else
181
+ skip=" ${TEST_EXTENDED_SKIP} "
182
+ fi
183
+ fi
184
+ if [[ -n " ${skip} " ]]; then
185
+ listArgs+=(" --ginkgo.skip=${skip} " )
186
+ runArgs+=(" -skip=${skip} " )
187
+ fi
188
+
189
+ if [[ -n " ${TEST_PARALLEL-} " ]]; then
190
+ runArgs+=(" -p" " -nodes=${TEST_PARALLEL} " )
191
+ fi
192
+
193
+ if [[ -n " ${SHOW_ALL-} " ]]; then
175
194
PRINT_TESTS=1
176
195
os::test::extended::test_list " ${listArgs[@]} "
177
196
return
0 commit comments