@red-hat-developer-hub/e2e-test-utils 1.1.30 → 1.1.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -105,9 +105,9 @@ log::success() {
|
|
|
105
105
|
# Operator subscription and status
|
|
106
106
|
# ---------------------------------------------------------------------------
|
|
107
107
|
install_subscription() {
|
|
108
|
-
local name=$1 namespace=$2 channel=$3 package=$4 source_name=$5 source_namespace=$6
|
|
109
|
-
|
|
110
|
-
apiVersion: operators.coreos.com/v1alpha1
|
|
108
|
+
local name=$1 namespace=$2 channel=$3 package=$4 source_name=$5 source_namespace=$6 starting_csv=${7:-}
|
|
109
|
+
local yaml
|
|
110
|
+
yaml="apiVersion: operators.coreos.com/v1alpha1
|
|
111
111
|
kind: Subscription
|
|
112
112
|
metadata:
|
|
113
113
|
name: $name
|
|
@@ -117,30 +117,38 @@ spec:
|
|
|
117
117
|
installPlanApproval: Automatic
|
|
118
118
|
name: $package
|
|
119
119
|
source: $source_name
|
|
120
|
-
sourceNamespace: $source_namespace
|
|
121
|
-
|
|
120
|
+
sourceNamespace: $source_namespace"
|
|
121
|
+
if [[ -n "$starting_csv" ]]; then
|
|
122
|
+
yaml+="
|
|
123
|
+
startingCSV: $starting_csv"
|
|
124
|
+
fi
|
|
125
|
+
echo "$yaml" | oc apply -f -
|
|
122
126
|
return 0
|
|
123
127
|
}
|
|
124
128
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
129
|
+
# Wait for an operator CSV to reach a status phase.
|
|
130
|
+
# Uses OLM label selector (operators.coreos.com/<package>.<namespace>) which is
|
|
131
|
+
# deterministic, unlike spec.displayName which varies across channels/versions.
|
|
132
|
+
wait_for_operator() {
|
|
133
|
+
local timeout=${1:-300} namespace=$2 package=$3 expected_status=${4:-Succeeded}
|
|
134
|
+
local label="operators.coreos.com/${package}.${namespace}"
|
|
135
|
+
log::info "Waiting for operator '${package}' in '${namespace}' (label=${label}, timeout ${timeout}s, expected: ${expected_status})"
|
|
128
136
|
timeout "${timeout}" bash -c "
|
|
129
137
|
while true; do
|
|
130
|
-
CURRENT_PHASE=\$(oc get csv -n '${namespace}' -o jsonpath='{.items[
|
|
131
|
-
echo \"[
|
|
132
|
-
[[ \"\${CURRENT_PHASE}\" == \"${expected_status}\" ]] && echo \"[
|
|
138
|
+
CURRENT_PHASE=\$(oc get csv -n '${namespace}' -l '${label}' -o jsonpath='{.items[0].status.phase}' 2>/dev/null)
|
|
139
|
+
echo \"[wait_for_operator] Phase: \${CURRENT_PHASE}\" >&2
|
|
140
|
+
[[ \"\${CURRENT_PHASE}\" == \"${expected_status}\" ]] && echo \"[wait_for_operator] Operator reached ${expected_status}\" >&2 && break
|
|
133
141
|
sleep 10
|
|
134
142
|
done
|
|
135
|
-
" || { log::error "Operator did not reach ${expected_status} in time."; return 1; }
|
|
143
|
+
" || { log::error "Operator '${package}' did not reach ${expected_status} in time."; return 1; }
|
|
136
144
|
}
|
|
137
145
|
|
|
138
146
|
install_serverless_logic_ocp_operator() {
|
|
139
|
-
install_subscription logic-operator openshift-operators stable logic-operator redhat-operators openshift-marketplace
|
|
147
|
+
install_subscription logic-operator openshift-operators stable logic-operator redhat-operators openshift-marketplace logic-operator.v1.37.2
|
|
140
148
|
return 0
|
|
141
149
|
}
|
|
142
150
|
waitfor_serverless_logic_ocp_operator() {
|
|
143
|
-
|
|
151
|
+
wait_for_operator 500 openshift-operators logic-operator Succeeded
|
|
144
152
|
return 0
|
|
145
153
|
}
|
|
146
154
|
|
|
@@ -149,7 +157,7 @@ install_serverless_ocp_operator() {
|
|
|
149
157
|
return 0
|
|
150
158
|
}
|
|
151
159
|
waitfor_serverless_ocp_operator() {
|
|
152
|
-
|
|
160
|
+
wait_for_operator 300 openshift-operators serverless-operator Succeeded
|
|
153
161
|
return 0
|
|
154
162
|
}
|
|
155
163
|
|