Skip to content

Commit 747e153

Browse files
Create a minimal suite for use from single node jobs in limited spots
Remove use of -suite parameter in favor of a temporary SUITE env var for old jobs. Newer jobs will call gingko directly. Remove the setup code from the extended tests.
1 parent 76d0cb1 commit 747e153

File tree

4 files changed

+15
-109
lines changed

4 files changed

+15
-109
lines changed

test/extended/conformance.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ exitstatus=0
1111

1212
# run parallel tests
1313
os::log::info "Running parallel tests N=${PARALLEL_NODES:-<default>}"
14-
TEST_PARALLEL="${PARALLEL_NODES:-5}" TEST_REPORT_FILE_NAME=conformance_parallel os::test::extended::run -- -suite "parallel.conformance.openshift.io" -test.timeout 6h ${TEST_EXTENDED_ARGS-} || exitstatus=$?
14+
SUITE=openshift/conformance/parallel/minimal TEST_PARALLEL="${PARALLEL_NODES:-5}" TEST_REPORT_FILE_NAME=conformance_parallel os::test::extended::run -- -test.timeout 6h ${TEST_EXTENDED_ARGS-} || exitstatus=$?
1515

1616
# run tests in serial
1717
os::log::info "Running serial tests"
18-
TEST_REPORT_FILE_NAME=conformance_serial os::test::extended::run -- -suite "serial.conformance.openshift.io" -test.timeout 2h ${TEST_EXTENDED_ARGS-} || exitstatus=$?
18+
SUITE=openshift/conformance/serial/minimal TEST_REPORT_FILE_NAME=conformance_serial os::test::extended::run -- -test.timeout 2h ${TEST_EXTENDED_ARGS-} || exitstatus=$?
1919

2020
exit $exitstatus

test/extended/core.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ exitstatus=0
1212

1313
# run parallel tests
1414
os::log::info "Running parallel tests N=${PARALLEL_NODES:-<default>}"
15-
TEST_PARALLEL="${PARALLEL_NODES:-5}" TEST_REPORT_FILE_NAME=core_parallel os::test::extended::run -- -suite "parallel.conformance.openshift.io" -test.timeout 6h ${TEST_EXTENDED_ARGS-} || exitstatus=$?
15+
SUITE=openshift/conformance/parallel/minimal TEST_PARALLEL="${PARALLEL_NODES:-5}" TEST_REPORT_FILE_NAME=core_parallel os::test::extended::run -- -test.timeout 6h ${TEST_EXTENDED_ARGS-} || exitstatus=$?
1616

1717
# run tests in serial
1818
os::log::info ""
1919
os::log::info "Running serial tests"
20-
TEST_REPORT_FILE_NAME=core_serial os::test::extended::run -- -suite "serial.conformance.openshift.io" -test.timeout 2h ${TEST_EXTENDED_ARGS-} || exitstatus=$?
20+
SUITE=openshift/conformance/serial/minimal TEST_REPORT_FILE_NAME=core_serial os::test::extended::run -- -test.timeout 2h ${TEST_EXTENDED_ARGS-} || exitstatus=$?
2121

2222
exit $exitstatus

test/extended/setup.sh

+9-93
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ function os::test::extended::focus () {
88
os::log::fatal "the --ginkgo.focus flag is no longer supported, use FOCUS=foo <suite.sh> instead."
99
exit 1
1010
fi
11+
if [[ "$@[@]" =~ "-suite" ]]; then
12+
os::log::fatal "the -suite flag is no longer supported, use SUITE=foo instead."
13+
exit 1
14+
fi
1115
if [[ -n "${FOCUS:-}" ]]; then
1216
exitstatus=0
1317

@@ -56,104 +60,13 @@ function os::test::extended::setup () {
5660
function cleanup() {
5761
return_code=$?
5862
os::test::junit::generate_report
59-
os::cleanup::all
6063
os::util::describe_return_code "${return_code}"
6164
exit "${return_code}"
6265
}
6366
trap "cleanup" EXIT
6467

65-
if [[ -n "${TEST_ONLY-}" ]]; then
66-
os::log::info "Running tests against existing cluster..."
67-
return 0
68-
fi
69-
70-
os::util::ensure::built_binary_exists 'openshift'
71-
72-
os::util::environment::use_sudo
73-
os::cleanup::tmpdir
74-
os::util::environment::setup_all_server_vars
75-
os::util::ensure::iptables_privileges_exist
76-
77-
os::log::info "Starting server"
78-
79-
os::util::environment::setup_images_vars
80-
81-
local sudo=${USE_SUDO:+sudo}
82-
83-
# If the current system has the XFS volume dir mount point we configure
84-
# in the test images, assume to use it which will allow the local storage
85-
# quota tests to pass.
86-
LOCAL_STORAGE_QUOTA=""
87-
if [[ -d "/mnt/openshift-xfs-vol-dir" ]] && ${sudo} lvs | grep -q "xfs"; then
88-
LOCAL_STORAGE_QUOTA="1"
89-
export VOLUME_DIR="/mnt/openshift-xfs-vol-dir"
90-
else
91-
os::log::warning "/mnt/openshift-xfs-vol-dir does not exist, local storage quota tests may fail."
92-
fi
93-
94-
os::log::system::start
95-
96-
if [[ -n "${SHOW_ALL:-}" ]]; then
97-
SKIP_NODE=1
98-
fi
99-
100-
# make sure the volume dir has the same label as we would apply to the default VOLUME_DIR
101-
if selinuxenabled; then
102-
local label=$(matchpathcon -n -m dir /var/lib/openshift/openshift.local.volumes)
103-
${sudo} chcon "${label}" ${VOLUME_DIR}
104-
fi
105-
CONFIG_VERSION=""
106-
if [[ -n "${API_SERVER_VERSION:-}" ]]; then
107-
CONFIG_VERSION="${API_SERVER_VERSION}"
108-
elif [[ -n "${CONTROLLER_VERSION:-}" ]]; then
109-
CONFIG_VERSION="${CONTROLLER_VERSION}"
110-
fi
111-
os::start::configure_server "${CONFIG_VERSION}"
112-
# turn on audit logging for extended tests ... mimic what is done in os::start::configure_server, but don't
113-
# put change there - only want this for extended tests
114-
os::log::info "Turn on audit logging"
115-
cp "${SERVER_CONFIG_DIR}/master/master-config.yaml" "${SERVER_CONFIG_DIR}/master/master-config.orig2.yaml"
116-
oc patch --local --type=json -o yaml -f "${SERVER_CONFIG_DIR}/master/master-config.orig2.yaml" --patch="[{\"op\": \"replace\", \"path\": \"/auditConfig/enabled\", \"value\": true}, {\"op\": \"replace\", \"path\": \"/auditConfig/auditFilePath\", \"value\": \"${LOG_DIR}/audit.log\"}]" > "${SERVER_CONFIG_DIR}/master/master-config.yaml"
117-
118-
cp "${SERVER_CONFIG_DIR}/master/master-config.yaml" "${SERVER_CONFIG_DIR}/master/master-config.orig2.yaml"
119-
oc patch --local --type=json -o yaml -f "${SERVER_CONFIG_DIR}/master/master-config.orig2.yaml" --patch="[{\"op\": \"add\", \"path\": \"/templateServiceBrokerConfig\", \"value\": {\"templaceNamespaces\": [\"openshift\"]}}]" > "${SERVER_CONFIG_DIR}/master/master-config.yaml"
120-
121-
# If the XFS volume dir mount point exists enable local storage quota in node-config.yaml so these tests can pass:
122-
if [[ -n "${LOCAL_STORAGE_QUOTA}" ]]; then
123-
# 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
124-
# to store the images created when the extended tests run
125-
cp "${NODE_CONFIG_DIR}/node-config.yaml" "${NODE_CONFIG_DIR}/node-config.orig2.yaml"
126-
oc patch --local --type=json -o yaml -f "${NODE_CONFIG_DIR}/node-config.orig2.yaml" --patch="[{\"op\": \"add\", \"path\": \"/volumeConfig/localQuota\", \"value\": {\"perFSGroup\": \"4480Mi\"}}]" > "${NODE_CONFIG_DIR}/node-config.yaml"
127-
fi
128-
os::log::info "Using VOLUME_DIR=${VOLUME_DIR}"
129-
130-
# This is a bit hacky, but set the pod gc threshold appropriately for the garbage_collector test
131-
# and enable-hostpath-provisioner for StatefulSet tests
132-
cp "${SERVER_CONFIG_DIR}/master/master-config.yaml" "${SERVER_CONFIG_DIR}/master/master-config.orig3.yaml"
133-
oc patch --local --type=json -o yaml -f "${SERVER_CONFIG_DIR}/master/master-config.orig3.yaml" --patch="[{\"op\": \"add\", \"path\": \"/kubernetesMasterConfig/controllerArguments\", \"value\": {\"terminated-pod-gc-threshold\":[\"100\"], \"enable-hostpath-provisioner\":[\"true\"]}}]" > "${SERVER_CONFIG_DIR}/master/master-config.yaml"
134-
135-
os::start::server "${API_SERVER_VERSION:-}" "${CONTROLLER_VERSION:-}" "${SKIP_NODE:-}"
136-
137-
export KUBECONFIG="${ADMIN_KUBECONFIG}"
138-
139-
os::start::registry
140-
if [[ -z "${SKIP_NODE:-}" ]]; then
141-
oc rollout status dc/docker-registry
142-
fi
143-
CREATE_ROUTER_CERT=true os::start::router
144-
145-
os::log::info "Creating image streams"
146-
oc create -n openshift -f "${OS_ROOT}/examples/image-streams/image-streams-centos7.json" --config="${ADMIN_KUBECONFIG}"
147-
148-
os::log::info "Creating quickstart templates"
149-
oc create -n openshift -f "${OS_ROOT}/examples/quickstarts" --config="${ADMIN_KUBECONFIG}"
150-
151-
os::log::info "Creating db-templates templates"
152-
oc create -n openshift -f "${OS_ROOT}/examples/db-templates" --config="${ADMIN_KUBECONFIG}"
153-
154-
os::log::info "Creating jenkins templates"
155-
oc create -n openshift -f "${OS_ROOT}/examples/jenkins/jenkins-ephemeral-template.json" --config="${ADMIN_KUBECONFIG}"
156-
68+
os::log::info "Running tests against existing cluster..."
69+
return 0
15770
}
15871

15972
# Run extended tests or print out a list of tests that need to be run
@@ -172,6 +85,9 @@ function os::test::extended::run () {
17285
if [[ -n "${FOCUS-}" ]]; then
17386
listArgs+=("--ginkgo.focus=${FOCUS}")
17487
runArgs+=("-focus=${FOCUS}")
88+
elif [[ -n "${SUITE-}" ]]; then
89+
listArgs+=("--ginkgo.focus=${SUITE}")
90+
runArgs+=("-focus=${SUITE}")
17591
fi
17692

17793
local skip="${SKIP-}"

test/extended/util/test.go

+2-12
Original file line numberDiff line numberDiff line change
@@ -99,18 +99,6 @@ func ExecuteTest(t *testing.T, suite string) {
9999
defer e2e.CoreDump(TestContext.ReportDir)
100100
}
101101

102-
switch syntheticSuite {
103-
case "parallel.conformance.openshift.io":
104-
if len(config.GinkgoConfig.FocusString) > 0 {
105-
config.GinkgoConfig.FocusString += "|"
106-
}
107-
config.GinkgoConfig.FocusString = "\\[Suite:openshift/conformance/parallel\\]"
108-
case "serial.conformance.openshift.io":
109-
if len(config.GinkgoConfig.FocusString) > 0 {
110-
config.GinkgoConfig.FocusString += "|"
111-
}
112-
config.GinkgoConfig.FocusString = "\\[Suite:openshift/conformance/serial\\]"
113-
}
114102
if config.GinkgoConfig.FocusString == "" && config.GinkgoConfig.SkipString == "" {
115103
config.GinkgoConfig.SkipString = "Skipped"
116104
}
@@ -148,6 +136,8 @@ func ExecuteTest(t *testing.T, suite string) {
148136
isSerial := strings.Contains(name, "[Serial]")
149137
isConformance := strings.Contains(name, "[Conformance]")
150138
switch {
139+
case isSerial && isConformance:
140+
node.SetText(node.Text() + " [Suite:openshift/conformance/serial/minimal]")
151141
case isSerial:
152142
node.SetText(node.Text() + " [Suite:openshift/conformance/serial]")
153143
case isConformance:

0 commit comments

Comments
 (0)