@red-hat-developer-hub/e2e-test-utils 1.1.18 → 1.1.20
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.
- package/dist/deployment/orchestrator/index.d.ts +3 -0
- package/dist/deployment/orchestrator/index.d.ts.map +1 -0
- package/dist/deployment/orchestrator/index.js +7 -0
- package/dist/deployment/orchestrator/install-orchestrator.sh +477 -0
- package/dist/playwright/helpers/index.d.ts +1 -1
- package/dist/playwright/helpers/index.d.ts.map +1 -1
- package/dist/playwright/helpers/rbac-api-helper.d.ts +10 -2
- package/dist/playwright/helpers/rbac-api-helper.d.ts.map +1 -1
- package/dist/playwright/helpers/rbac-api-helper.js +25 -8
- package/dist/playwright/pages/index.d.ts +1 -0
- package/dist/playwright/pages/index.d.ts.map +1 -1
- package/dist/playwright/pages/index.js +1 -0
- package/dist/playwright/pages/orchestrator.d.ts +23 -0
- package/dist/playwright/pages/orchestrator.d.ts.map +1 -0
- package/dist/playwright/pages/orchestrator.js +248 -0
- package/dist/playwright/pages/workflows.d.ts +3 -0
- package/dist/playwright/pages/workflows.d.ts.map +1 -0
- package/dist/playwright/pages/workflows.js +1 -0
- package/package.json +6 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/deployment/orchestrator/index.ts"],"names":[],"mappings":"AAKA,wBAAsB,mBAAmB,CAAC,SAAS,SAAiB,iBAEnE;AAED,eAAe,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { resolve } from "path";
|
|
2
|
+
import { $ } from "../../utils/index.js";
|
|
3
|
+
const scriptPath = resolve(import.meta.dirname, "install-orchestrator.sh");
|
|
4
|
+
export async function installOrchestrator(namespace = "orchestrator") {
|
|
5
|
+
await $ `bash ${scriptPath} ${namespace}`;
|
|
6
|
+
}
|
|
7
|
+
export default installOrchestrator;
|
|
@@ -0,0 +1,477 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
#
|
|
3
|
+
# Standalone script to install the orchestrator (Serverless Logic / SonataFlow)
|
|
4
|
+
# on OpenShift.
|
|
5
|
+
#
|
|
6
|
+
# Usage: ./install-orchestrator.sh [namespace]
|
|
7
|
+
# Default namespace: orchestrator
|
|
8
|
+
#
|
|
9
|
+
|
|
10
|
+
set -e
|
|
11
|
+
|
|
12
|
+
export NAME_SPACE="${1:-${NAME_SPACE:-orchestrator}}"
|
|
13
|
+
|
|
14
|
+
LOWER_CASE_CLASS='[:lower:]'
|
|
15
|
+
UPPER_CASE_CLASS='[:upper:]'
|
|
16
|
+
|
|
17
|
+
# ---------------------------------------------------------------------------
|
|
18
|
+
# Logging
|
|
19
|
+
# ---------------------------------------------------------------------------
|
|
20
|
+
if [[ -t 1 ]] && [[ "${TERM:-}" != "dumb" ]]; then
|
|
21
|
+
: "${LOG_NO_COLOR:=false}"
|
|
22
|
+
else
|
|
23
|
+
: "${LOG_NO_COLOR:=true}"
|
|
24
|
+
fi
|
|
25
|
+
: "${LOG_LEVEL:=INFO}"
|
|
26
|
+
|
|
27
|
+
log::timestamp() {
|
|
28
|
+
echo "$(date -u '+%Y-%m-%dT%H:%M:%SZ')"
|
|
29
|
+
return 0
|
|
30
|
+
}
|
|
31
|
+
log::level_value() {
|
|
32
|
+
local input="$1"
|
|
33
|
+
local level
|
|
34
|
+
level="$(echo "$input" | tr "$LOWER_CASE_CLASS" "$UPPER_CASE_CLASS")"
|
|
35
|
+
case "${level}" in DEBUG) echo 0 ;; INFO) echo 1 ;; WARN|WARNING) echo 2 ;; ERROR|ERR) echo 3 ;; *) echo 1 ;; esac
|
|
36
|
+
return 0;
|
|
37
|
+
}
|
|
38
|
+
log::should_log() {
|
|
39
|
+
local input requested_level config_level
|
|
40
|
+
input="$1"
|
|
41
|
+
requested_level="$(echo "$input" | tr "$LOWER_CASE_CLASS" "$UPPER_CASE_CLASS")"
|
|
42
|
+
config_level="$(echo "${LOG_LEVEL}" | tr "$LOWER_CASE_CLASS" "$UPPER_CASE_CLASS")"
|
|
43
|
+
|
|
44
|
+
[[ "$(log::level_value "${requested_level}")" -ge "$(log::level_value "${config_level}")" ]]
|
|
45
|
+
return $?
|
|
46
|
+
}
|
|
47
|
+
log::reset_code() {
|
|
48
|
+
[[ "${LOG_NO_COLOR}" == "true" ]] && printf '' || printf '\033[0m'
|
|
49
|
+
return 0;
|
|
50
|
+
}
|
|
51
|
+
log::color_for_level() {
|
|
52
|
+
[[ "${LOG_NO_COLOR}" == "true" ]] && { printf ''; return 0; }
|
|
53
|
+
local level input
|
|
54
|
+
input="$1"
|
|
55
|
+
level="$(echo "$input" | tr "$LOWER_CASE_CLASS" "$UPPER_CASE_CLASS")"
|
|
56
|
+
case "${level}" in
|
|
57
|
+
DEBUG) printf '\033[36m' ;; INFO) printf '\033[34m' ;; WARN|WARNING) printf '\033[33m' ;;
|
|
58
|
+
ERROR|ERR) printf '\033[31m' ;; SUCCESS) printf '\033[32m' ;; SECTION) printf '\033[35m\033[1m' ;;
|
|
59
|
+
*) printf '\033[37m' ;;
|
|
60
|
+
esac
|
|
61
|
+
}
|
|
62
|
+
log::icon_for_level() {
|
|
63
|
+
local level input
|
|
64
|
+
input="$1"
|
|
65
|
+
level="$(echo "$input" | tr "$LOWER_CASE_CLASS" "$UPPER_CASE_CLASS")"
|
|
66
|
+
case "${level}" in DEBUG) printf '🐞' ;; INFO) printf 'ℹ' ;; WARN|WARNING) printf '⚠' ;; ERROR|ERR) printf '❌' ;; SUCCESS) printf '✓' ;; *) printf '-' ;; esac
|
|
67
|
+
return 0
|
|
68
|
+
}
|
|
69
|
+
log::emit_line() {
|
|
70
|
+
local level="$1" icon="$2" line="$3" color reset timestamp
|
|
71
|
+
log::should_log "${level}" || return 0
|
|
72
|
+
timestamp="$(log::timestamp)"
|
|
73
|
+
color="$(log::color_for_level "${level}")"
|
|
74
|
+
reset="$(log::reset_code)"
|
|
75
|
+
printf '%s[%s] %s %s%s\n' "${color}" "${timestamp}" "${icon}" "${line}" "${reset}" >&2
|
|
76
|
+
}
|
|
77
|
+
log::emit() {
|
|
78
|
+
local level="$1"; shift
|
|
79
|
+
local icon message; icon="$(log::icon_for_level "${level}")"; message="${*:-}"
|
|
80
|
+
[[ -z "${message}" ]] && return 0
|
|
81
|
+
while IFS= read -r line; do log::emit_line "${level}" "${icon}" "${line}"; done <<< "${message}"
|
|
82
|
+
}
|
|
83
|
+
log::debug() {
|
|
84
|
+
log::emit "DEBUG" "$@"
|
|
85
|
+
return 0
|
|
86
|
+
}
|
|
87
|
+
log::info() {
|
|
88
|
+
log::emit "INFO" "$@"
|
|
89
|
+
return 0
|
|
90
|
+
}
|
|
91
|
+
log::warn() {
|
|
92
|
+
log::emit "WARN" "$@"
|
|
93
|
+
return 0
|
|
94
|
+
}
|
|
95
|
+
log::error() {
|
|
96
|
+
log::emit "ERROR" "$@"
|
|
97
|
+
return 0
|
|
98
|
+
}
|
|
99
|
+
log::success() {
|
|
100
|
+
log::emit "SUCCESS" "$@"
|
|
101
|
+
return 0
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
# ---------------------------------------------------------------------------
|
|
105
|
+
# Operator subscription and status
|
|
106
|
+
# ---------------------------------------------------------------------------
|
|
107
|
+
install_subscription() {
|
|
108
|
+
local name=$1 namespace=$2 channel=$3 package=$4 source_name=$5 source_namespace=$6
|
|
109
|
+
oc apply -f - << EOD
|
|
110
|
+
apiVersion: operators.coreos.com/v1alpha1
|
|
111
|
+
kind: Subscription
|
|
112
|
+
metadata:
|
|
113
|
+
name: $name
|
|
114
|
+
namespace: $namespace
|
|
115
|
+
spec:
|
|
116
|
+
channel: $channel
|
|
117
|
+
installPlanApproval: Automatic
|
|
118
|
+
name: $package
|
|
119
|
+
source: $source_name
|
|
120
|
+
sourceNamespace: $source_namespace
|
|
121
|
+
EOD
|
|
122
|
+
return 0
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
check_operator_status() {
|
|
126
|
+
local timeout=${1:-300} namespace=$2 operator_name=$3 expected_status=${4:-Succeeded}
|
|
127
|
+
log::info "Checking operator '${operator_name}' in '${namespace}' (timeout ${timeout}s, expected: ${expected_status})"
|
|
128
|
+
timeout "${timeout}" bash -c "
|
|
129
|
+
while true; do
|
|
130
|
+
CURRENT_PHASE=\$(oc get csv -n '${namespace}' -o jsonpath='{.items[?(@.spec.displayName==\"${operator_name}\")].status.phase}')
|
|
131
|
+
echo \"[check_operator_status] Phase: \${CURRENT_PHASE}\" >&2
|
|
132
|
+
[[ \"\${CURRENT_PHASE}\" == \"${expected_status}\" ]] && echo \"[check_operator_status] Operator reached ${expected_status}\" >&2 && break
|
|
133
|
+
sleep 10
|
|
134
|
+
done
|
|
135
|
+
" || { log::error "Operator did not reach ${expected_status} in time."; return 1; }
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
install_serverless_logic_ocp_operator() {
|
|
139
|
+
install_subscription logic-operator-rhel8 openshift-operators alpha logic-operator-rhel8 redhat-operators openshift-marketplace
|
|
140
|
+
return 0
|
|
141
|
+
}
|
|
142
|
+
waitfor_serverless_logic_ocp_operator() {
|
|
143
|
+
check_operator_status 500 openshift-operators "OpenShift Serverless Logic Operator (Alpha)" Succeeded
|
|
144
|
+
return 0
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
install_serverless_ocp_operator() {
|
|
148
|
+
install_subscription serverless-operator openshift-operators stable serverless-operator redhat-operators openshift-marketplace
|
|
149
|
+
return 0
|
|
150
|
+
}
|
|
151
|
+
waitfor_serverless_ocp_operator() {
|
|
152
|
+
check_operator_status 300 openshift-operators "Red Hat OpenShift Serverless" Succeeded
|
|
153
|
+
return 0
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
# ---------------------------------------------------------------------------
|
|
157
|
+
# Namespace
|
|
158
|
+
# ---------------------------------------------------------------------------
|
|
159
|
+
force_delete_namespace() {
|
|
160
|
+
local project=$1 timeout_seconds=${2:-120} elapsed=0 sleep_interval=2
|
|
161
|
+
log::warn "Force deleting namespace ${project}"
|
|
162
|
+
oc get namespace "$project" -o json | jq '.spec = {"finalizers":[]}' | oc replace --raw "/api/v1/namespaces/$project/finalize" -f -
|
|
163
|
+
while oc get namespace "$project" &>/dev/null; do
|
|
164
|
+
[[ $elapsed -ge $timeout_seconds ]] && { log::warn "Timeout deleting ${project}"; return 1; }
|
|
165
|
+
sleep $sleep_interval
|
|
166
|
+
elapsed=$((elapsed + sleep_interval))
|
|
167
|
+
done
|
|
168
|
+
log::success "Namespace '${project}' deleted."
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
delete_namespace() {
|
|
172
|
+
local project=$1
|
|
173
|
+
if oc get namespace "$project" &>/dev/null; then
|
|
174
|
+
log::warn "Deleting namespace ${project}..."
|
|
175
|
+
oc delete namespace "$project" --grace-period=0 --force || true
|
|
176
|
+
if oc get namespace "$project" -o jsonpath='{.status.phase}' 2>/dev/null | grep -q Terminating; then
|
|
177
|
+
force_delete_namespace "$project"
|
|
178
|
+
fi
|
|
179
|
+
fi
|
|
180
|
+
return 0
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
configure_namespace() {
|
|
184
|
+
local project=$1
|
|
185
|
+
if oc get namespace "$project" &>/dev/null; then
|
|
186
|
+
log::info "Namespace ${project} already exists, reusing it."
|
|
187
|
+
else
|
|
188
|
+
log::info "Creating namespace: ${project}"
|
|
189
|
+
oc create namespace "${project}" || { log::error "Failed to create namespace ${project}"; exit 1; }
|
|
190
|
+
fi
|
|
191
|
+
oc config set-context --current --namespace="${project}" || { log::error "Failed to set context"; exit 1; }
|
|
192
|
+
log::info "Namespace ${project} is ready."
|
|
193
|
+
return 0
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
# ---------------------------------------------------------------------------
|
|
197
|
+
# Deployment wait
|
|
198
|
+
# ---------------------------------------------------------------------------
|
|
199
|
+
wait_for_deployment() {
|
|
200
|
+
local namespace=$1 resource_name=$2 timeout_minutes=${3:-5} check_interval=${4:-10}
|
|
201
|
+
[[ -z "$namespace" || -z "$resource_name" ]] && { log::error "wait_for_deployment: namespace and resource_name required"; return 1; }
|
|
202
|
+
local max_attempts=$((timeout_minutes * 60 / check_interval))
|
|
203
|
+
log::info "Waiting for '$resource_name' in '$namespace' (timeout ${timeout_minutes}m)..."
|
|
204
|
+
for ((i = 1; i <= max_attempts; i++)); do
|
|
205
|
+
local pod_name
|
|
206
|
+
pod_name=$(oc get pods -n "$namespace" 2>/dev/null | grep "$resource_name" | awk '{print $1}' | head -n 1)
|
|
207
|
+
if [[ -n "$pod_name" ]]; then
|
|
208
|
+
local is_ready
|
|
209
|
+
is_ready=$(oc get pod "$pod_name" -n "$namespace" -o jsonpath='{.status.conditions[?(@.type=="Ready")].status}' 2>/dev/null)
|
|
210
|
+
if [[ "$is_ready" == "True" ]] && oc get pod "$pod_name" -n "$namespace" 2>/dev/null | grep -q Running; then
|
|
211
|
+
log::success "Pod '$pod_name' is ready"
|
|
212
|
+
return 0
|
|
213
|
+
fi
|
|
214
|
+
fi
|
|
215
|
+
sleep "$check_interval"
|
|
216
|
+
done
|
|
217
|
+
log::error "Timeout waiting for $resource_name"
|
|
218
|
+
return 1
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
# ---------------------------------------------------------------------------
|
|
222
|
+
# PostgreSQL (simple deployment for orchestrator)
|
|
223
|
+
# ---------------------------------------------------------------------------
|
|
224
|
+
create_simple_postgres_deployment() {
|
|
225
|
+
local namespace=$1 postgres_name="backstage-psql"
|
|
226
|
+
if oc get deployment "$postgres_name" -n "$namespace" &>/dev/null; then
|
|
227
|
+
log::info "PostgreSQL '$postgres_name' already exists"
|
|
228
|
+
return 0
|
|
229
|
+
fi
|
|
230
|
+
log::info "Creating PostgreSQL '$postgres_name' in '$namespace'"
|
|
231
|
+
oc create secret generic "${postgres_name}-secret" -n "$namespace" \
|
|
232
|
+
--from-literal=POSTGRESQL_USER=postgres \
|
|
233
|
+
--from-literal=POSTGRESQL_PASSWORD=postgres \
|
|
234
|
+
--from-literal=POSTGRESQL_DATABASE=postgres \
|
|
235
|
+
--from-literal=POSTGRES_USER=postgres \
|
|
236
|
+
--from-literal=POSTGRES_PASSWORD=postgres \
|
|
237
|
+
--from-literal=POSTGRES_DB=postgres \
|
|
238
|
+
--dry-run=client -o yaml | oc apply -f - -n "$namespace" || true
|
|
239
|
+
|
|
240
|
+
oc apply -f - -n "$namespace" << EOF
|
|
241
|
+
apiVersion: v1
|
|
242
|
+
kind: PersistentVolumeClaim
|
|
243
|
+
metadata:
|
|
244
|
+
name: ${postgres_name}-pvc
|
|
245
|
+
namespace: ${namespace}
|
|
246
|
+
spec:
|
|
247
|
+
accessModes: [ReadWriteOnce]
|
|
248
|
+
resources: { requests: { storage: 1Gi } }
|
|
249
|
+
EOF
|
|
250
|
+
|
|
251
|
+
oc apply -f - -n "$namespace" << EOF
|
|
252
|
+
apiVersion: apps/v1
|
|
253
|
+
kind: StatefulSet
|
|
254
|
+
metadata:
|
|
255
|
+
name: ${postgres_name}
|
|
256
|
+
namespace: ${namespace}
|
|
257
|
+
spec:
|
|
258
|
+
serviceName: ${postgres_name}
|
|
259
|
+
replicas: 1
|
|
260
|
+
selector: { matchLabels: { app: ${postgres_name} } }
|
|
261
|
+
template:
|
|
262
|
+
metadata: { labels: { app: ${postgres_name} } }
|
|
263
|
+
spec:
|
|
264
|
+
containers:
|
|
265
|
+
- name: postgres
|
|
266
|
+
image: registry.redhat.io/rhel9/postgresql-15:latest
|
|
267
|
+
env:
|
|
268
|
+
- name: POSTGRESQL_USER
|
|
269
|
+
valueFrom: { secretKeyRef: { name: ${postgres_name}-secret, key: POSTGRESQL_USER } }
|
|
270
|
+
- name: POSTGRESQL_PASSWORD
|
|
271
|
+
valueFrom: { secretKeyRef: { name: ${postgres_name}-secret, key: POSTGRESQL_PASSWORD } }
|
|
272
|
+
- name: POSTGRESQL_DATABASE
|
|
273
|
+
valueFrom: { secretKeyRef: { name: ${postgres_name}-secret, key: POSTGRESQL_DATABASE } }
|
|
274
|
+
ports: [ { containerPort: 5432, name: postgres } ]
|
|
275
|
+
volumeMounts: [ { name: postgres-data, mountPath: /var/lib/pgsql/data } ]
|
|
276
|
+
livenessProbe:
|
|
277
|
+
exec: { command: [ /usr/libexec/check-container, --live ] }
|
|
278
|
+
initialDelaySeconds: 120
|
|
279
|
+
periodSeconds: 10
|
|
280
|
+
readinessProbe:
|
|
281
|
+
exec: { command: [ /usr/libexec/check-container ] }
|
|
282
|
+
initialDelaySeconds: 5
|
|
283
|
+
periodSeconds: 10
|
|
284
|
+
volumes: [ { name: postgres-data, persistentVolumeClaim: { claimName: ${postgres_name}-pvc } } ]
|
|
285
|
+
EOF
|
|
286
|
+
|
|
287
|
+
oc apply -f - -n "$namespace" << EOF
|
|
288
|
+
apiVersion: v1
|
|
289
|
+
kind: Service
|
|
290
|
+
metadata:
|
|
291
|
+
name: ${postgres_name}
|
|
292
|
+
namespace: ${namespace}
|
|
293
|
+
spec:
|
|
294
|
+
selector: { app: ${postgres_name} }
|
|
295
|
+
ports: [ { name: postgres, port: 5432, targetPort: 5432 } ]
|
|
296
|
+
type: ClusterIP
|
|
297
|
+
EOF
|
|
298
|
+
|
|
299
|
+
log::info "Waiting for PostgreSQL StatefulSet..."
|
|
300
|
+
oc wait statefulset "$postgres_name" -n "$namespace" --for=jsonpath='{.status.readyReplicas}'=1 --timeout=300s || true
|
|
301
|
+
sleep 5
|
|
302
|
+
oc exec -n "$namespace" statefulset/"$postgres_name" -- psql -U postgres -c "CREATE DATABASE backstage_plugin_orchestrator;" 2>/dev/null || log::warn "Orchestrator DB may already exist"
|
|
303
|
+
log::success "PostgreSQL deployment created."
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
# ---------------------------------------------------------------------------
|
|
307
|
+
# SonataFlow platform
|
|
308
|
+
# ---------------------------------------------------------------------------
|
|
309
|
+
create_sonataflow_platform() {
|
|
310
|
+
local namespace=$1 postgres_secret_name=$2 postgres_service_name=$3
|
|
311
|
+
if ! oc get crd sonataflowplatforms.sonataflow.org &>/dev/null && ! oc get crd sonataflowplatform.sonataflow.org &>/dev/null; then
|
|
312
|
+
log::error "SonataFlowPlatform CRD not found. Install Serverless Logic Operator first."
|
|
313
|
+
return 1
|
|
314
|
+
fi
|
|
315
|
+
if oc get sonataflowplatform sonataflow-platform -n "$namespace" &>/dev/null || oc get sfp sonataflow-platform -n "$namespace" &>/dev/null; then
|
|
316
|
+
log::info "SonataFlowPlatform already exists"
|
|
317
|
+
return 0
|
|
318
|
+
fi
|
|
319
|
+
log::info "Creating SonataFlowPlatform in '$namespace'"
|
|
320
|
+
oc apply -f - -n "$namespace" << EOF
|
|
321
|
+
apiVersion: sonataflow.org/v1alpha08
|
|
322
|
+
kind: SonataFlowPlatform
|
|
323
|
+
metadata:
|
|
324
|
+
name: sonataflow-platform
|
|
325
|
+
namespace: ${namespace}
|
|
326
|
+
spec:
|
|
327
|
+
services:
|
|
328
|
+
dataIndex:
|
|
329
|
+
persistence:
|
|
330
|
+
postgresql:
|
|
331
|
+
secretRef: { name: ${postgres_secret_name}, userKey: POSTGRES_USER, passwordKey: POSTGRES_PASSWORD }
|
|
332
|
+
serviceRef: { name: ${postgres_service_name}, namespace: ${namespace}, port: 5432, databaseName: backstage_plugin_orchestrator }
|
|
333
|
+
jobService:
|
|
334
|
+
persistence:
|
|
335
|
+
postgresql:
|
|
336
|
+
secretRef: { name: ${postgres_secret_name}, userKey: POSTGRES_USER, passwordKey: POSTGRES_PASSWORD }
|
|
337
|
+
serviceRef: { name: ${postgres_service_name}, namespace: ${namespace}, port: 5432, databaseName: backstage_plugin_orchestrator }
|
|
338
|
+
EOF
|
|
339
|
+
local attempt=0 max_attempts=60
|
|
340
|
+
while [[ $attempt -lt $max_attempts ]]; do
|
|
341
|
+
if oc get deployment sonataflow-platform-data-index-service -n "$namespace" &>/dev/null && \
|
|
342
|
+
oc get deployment sonataflow-platform-jobs-service -n "$namespace" &>/dev/null; then
|
|
343
|
+
log::success "SonataFlowPlatform services created"
|
|
344
|
+
wait_for_deployment "$namespace" sonataflow-platform-data-index-service 20 || true
|
|
345
|
+
wait_for_deployment "$namespace" sonataflow-platform-jobs-service 20 || true
|
|
346
|
+
log::success "SonataFlowPlatform ready."
|
|
347
|
+
return 0
|
|
348
|
+
fi
|
|
349
|
+
attempt=$((attempt + 1))
|
|
350
|
+
[[ $((attempt % 10)) -eq 0 ]] && log::info "Waiting for SonataFlowPlatform... ($attempt/$max_attempts)"
|
|
351
|
+
sleep 5
|
|
352
|
+
done
|
|
353
|
+
log::warn "SonataFlowPlatform services did not appear in time."
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
# ---------------------------------------------------------------------------
|
|
357
|
+
# Orchestrator connection info
|
|
358
|
+
# ---------------------------------------------------------------------------
|
|
359
|
+
print_orchestrator_connection_info() {
|
|
360
|
+
local namespace=$1
|
|
361
|
+
local data_index_service="sonataflow-platform-data-index-service"
|
|
362
|
+
local service_url="http://${data_index_service}.${namespace}.svc.cluster.local"
|
|
363
|
+
log::info "=========================================="
|
|
364
|
+
log::info "Orchestrator Plugin Connection Information"
|
|
365
|
+
log::info "=========================================="
|
|
366
|
+
log::info "Namespace: ${namespace}"
|
|
367
|
+
log::info "Internal URL for Orchestrator Backend Plugin: ${service_url}"
|
|
368
|
+
log::info "dynamic-plugins.yaml: pluginConfig.orchestrator.dataIndexService.url: ${service_url}"
|
|
369
|
+
if oc get svc "${data_index_service}" -n "${namespace}" &>/dev/null; then
|
|
370
|
+
local port; port=$(oc get svc "${data_index_service}" -n "${namespace}" -o jsonpath='{.spec.ports[0].port}' 2>/dev/null || echo "8080")
|
|
371
|
+
log::info "Service: ${data_index_service}, port: ${port}"
|
|
372
|
+
else
|
|
373
|
+
log::warn "Service '${data_index_service}' not found yet."
|
|
374
|
+
fi
|
|
375
|
+
log::info "=========================================="
|
|
376
|
+
return 0
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
# ---------------------------------------------------------------------------
|
|
380
|
+
# Wait for SonataFlow CRDs
|
|
381
|
+
# ---------------------------------------------------------------------------
|
|
382
|
+
wait_for_sonataflow_crds() {
|
|
383
|
+
log::info "Waiting for SonataFlow CRDs..."
|
|
384
|
+
local attempt=0 max_attempts=60
|
|
385
|
+
while [[ $attempt -lt $max_attempts ]]; do
|
|
386
|
+
if oc get crd sonataflows.sonataflow.org &>/dev/null; then
|
|
387
|
+
log::success "SonataFlow CRD is available."
|
|
388
|
+
return 0
|
|
389
|
+
fi
|
|
390
|
+
attempt=$((attempt + 1))
|
|
391
|
+
[[ $((attempt % 6)) -eq 0 ]] && log::info "Waiting for sonataflows.sonataflow.org... ($attempt/$max_attempts)"
|
|
392
|
+
sleep 5
|
|
393
|
+
done
|
|
394
|
+
log::error "Timed out waiting for SonataFlow CRD."
|
|
395
|
+
return 1
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
# ---------------------------------------------------------------------------
|
|
399
|
+
# Deploy orchestrator workflows (operator path: git clone + helm greeting)
|
|
400
|
+
# Uses local yaml/ if present, otherwise clones repo.
|
|
401
|
+
# ---------------------------------------------------------------------------
|
|
402
|
+
deploy_orchestrator_workflows_operator() {
|
|
403
|
+
local namespace=$1
|
|
404
|
+
|
|
405
|
+
# PostgreSQL
|
|
406
|
+
if ! oc get statefulset backstage-psql -n "$namespace" &>/dev/null && ! oc get deployment backstage-psql -n "$namespace" &>/dev/null; then
|
|
407
|
+
log::info "Creating simple PostgreSQL deployment..."
|
|
408
|
+
create_simple_postgres_deployment "$namespace"
|
|
409
|
+
else
|
|
410
|
+
log::info "PostgreSQL found, waiting for ready..."
|
|
411
|
+
if oc get statefulset backstage-psql -n "$namespace" &>/dev/null; then
|
|
412
|
+
oc wait statefulset backstage-psql -n "$namespace" --for=jsonpath='{.status.readyReplicas}'=1 --timeout=300s || true
|
|
413
|
+
else
|
|
414
|
+
wait_for_deployment "$namespace" backstage-psql 15 || true
|
|
415
|
+
fi
|
|
416
|
+
fi
|
|
417
|
+
|
|
418
|
+
local psql_secret_name psql_svc_name
|
|
419
|
+
psql_secret_name=$(oc get secrets -n "$namespace" -o name 2>/dev/null | grep "backstage-psql" | grep "secret" | head -1 | sed 's|secret\/||')
|
|
420
|
+
psql_svc_name='backstage-psql'
|
|
421
|
+
|
|
422
|
+
log::info "PostgreSQL secret: $psql_secret_name, service: $psql_svc_name"
|
|
423
|
+
|
|
424
|
+
if ! oc get sonataflowplatform sonataflow-platform -n "$namespace" &>/dev/null && ! oc get sfp sonataflow-platform -n "$namespace" &>/dev/null; then
|
|
425
|
+
create_sonataflow_platform "$namespace" "$psql_secret_name" "$psql_svc_name"
|
|
426
|
+
else
|
|
427
|
+
log::info "SonataFlowPlatform already exists"
|
|
428
|
+
wait_for_deployment "$namespace" sonataflow-platform-data-index-service 20 || true
|
|
429
|
+
wait_for_deployment "$namespace" sonataflow-platform-jobs-service 20 || true
|
|
430
|
+
fi
|
|
431
|
+
|
|
432
|
+
if ! oc get crd sonataflows.sonataflow.org &>/dev/null; then
|
|
433
|
+
log::error "SonataFlow CRD not found."
|
|
434
|
+
return 1
|
|
435
|
+
fi
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
# ---------------------------------------------------------------------------
|
|
439
|
+
# Main
|
|
440
|
+
# ---------------------------------------------------------------------------
|
|
441
|
+
main() {
|
|
442
|
+
log::info "Starting orchestrator deployment for namespace: ${NAME_SPACE}"
|
|
443
|
+
|
|
444
|
+
if ! oc whoami &>/dev/null && ! kubectl cluster-info &>/dev/null; then
|
|
445
|
+
log::error "Not logged into OpenShift/Kubernetes cluster"
|
|
446
|
+
return 1
|
|
447
|
+
fi
|
|
448
|
+
|
|
449
|
+
log::info "Checking Serverless operators..."
|
|
450
|
+
if ! oc get subscription serverless-operator -n openshift-operators &>/dev/null; then
|
|
451
|
+
log::info "Installing OpenShift Serverless Operator..."
|
|
452
|
+
install_serverless_ocp_operator
|
|
453
|
+
else
|
|
454
|
+
log::info "OpenShift Serverless Operator already installed"
|
|
455
|
+
fi
|
|
456
|
+
|
|
457
|
+
if ! oc get subscription logic-operator-rhel8 -n openshift-operators &>/dev/null; then
|
|
458
|
+
log::info "Installing OpenShift Serverless Logic Operator..."
|
|
459
|
+
install_serverless_logic_ocp_operator
|
|
460
|
+
else
|
|
461
|
+
log::info "OpenShift Serverless Logic Operator already installed"
|
|
462
|
+
fi
|
|
463
|
+
|
|
464
|
+
log::info "Waiting for operators to be ready..."
|
|
465
|
+
waitfor_serverless_ocp_operator
|
|
466
|
+
waitfor_serverless_logic_ocp_operator
|
|
467
|
+
wait_for_sonataflow_crds
|
|
468
|
+
|
|
469
|
+
configure_namespace "${NAME_SPACE}"
|
|
470
|
+
log::info "Deploying orchestrator workflows..."
|
|
471
|
+
deploy_orchestrator_workflows_operator "${NAME_SPACE}"
|
|
472
|
+
print_orchestrator_connection_info "${NAME_SPACE}"
|
|
473
|
+
|
|
474
|
+
log::success "Orchestrator deployment completed successfully!"
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
main "$@"
|
|
@@ -2,6 +2,6 @@ export { GITHUB_API_ENDPOINTS } from "./api-endpoints.js";
|
|
|
2
2
|
export { APIHelper } from "./api-helper.js";
|
|
3
3
|
export { LoginHelper, setupBrowser } from "./common.js";
|
|
4
4
|
export { UIhelper } from "./ui-helper.js";
|
|
5
|
-
export { RbacApiHelper, Policy, Response } from "./rbac-api-helper.js";
|
|
5
|
+
export { RbacApiHelper, Policy, Role, Response } from "./rbac-api-helper.js";
|
|
6
6
|
export { AuthApiHelper } from "./auth-api-helper.js";
|
|
7
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/playwright/helpers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/playwright/helpers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -6,6 +6,10 @@ export interface Policy {
|
|
|
6
6
|
policy: string;
|
|
7
7
|
effect: string;
|
|
8
8
|
}
|
|
9
|
+
export interface Role {
|
|
10
|
+
memberReferences: string[];
|
|
11
|
+
name: string;
|
|
12
|
+
}
|
|
9
13
|
/**
|
|
10
14
|
* Thin HTTP client for the RHDH RBAC permission API.
|
|
11
15
|
* Uses a static factory (`build`) because the Playwright `APIRequestContext`
|
|
@@ -19,13 +23,17 @@ export declare class RbacApiHelper {
|
|
|
19
23
|
private constructor();
|
|
20
24
|
/** Creates a fully-initialised instance with a live Playwright request context. */
|
|
21
25
|
static build(token: string): Promise<RbacApiHelper>;
|
|
26
|
+
createRoles(role: Role): Promise<APIResponse>;
|
|
27
|
+
getRoles(): Promise<APIResponse>;
|
|
28
|
+
updateRole(role: string, oldRole: Role, newRole: Role): Promise<APIResponse>;
|
|
29
|
+
deleteRole(role: string): Promise<APIResponse>;
|
|
22
30
|
getPoliciesByRole(policy: string): Promise<APIResponse>;
|
|
31
|
+
createPolicies(policy: Policy[]): Promise<APIResponse>;
|
|
32
|
+
deletePolicy(policy: string, policies: Policy[]): Promise<APIResponse>;
|
|
23
33
|
/** Fetches all conditional policies across all roles. */
|
|
24
34
|
getConditions(): Promise<APIResponse>;
|
|
25
35
|
/** Filters a full conditions list down to those belonging to a specific role entity ref. */
|
|
26
36
|
getConditionsByRole(role: string, remainingConditions: RoleConditionalPolicyDecision<PermissionAction>[]): Promise<RoleConditionalPolicyDecision<PermissionAction>[]>;
|
|
27
|
-
deleteRole(role: string): Promise<APIResponse>;
|
|
28
|
-
deletePolicy(policy: string, policies: Policy[]): Promise<APIResponse>;
|
|
29
37
|
/** `id` comes from the `RoleConditionalPolicyDecision.id` field returned by the API. */
|
|
30
38
|
deleteCondition(id: string): Promise<APIResponse>;
|
|
31
39
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rbac-api-helper.d.ts","sourceRoot":"","sources":["../../../src/playwright/helpers/rbac-api-helper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,6BAA6B,EAC9B,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAqB,WAAW,EAAW,MAAM,kBAAkB,CAAC;AAE3E,MAAM,WAAW,MAAM;IACrB,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;GAIG;AACH,qBAAa,aAAa;IAUJ,OAAO,CAAC,QAAQ,CAAC,KAAK;IAT1C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAkD;IACzE,OAAO,CAAC,QAAQ,CAAC,UAAU,CAKzB;IACF,OAAO,CAAC,SAAS,CAAqB;IAEtC,OAAO;IAOP,mFAAmF;WAC/D,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"rbac-api-helper.d.ts","sourceRoot":"","sources":["../../../src/playwright/helpers/rbac-api-helper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,6BAA6B,EAC9B,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAqB,WAAW,EAAW,MAAM,kBAAkB,CAAC;AAE3E,MAAM,WAAW,MAAM;IACrB,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,IAAI;IACnB,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;GAIG;AACH,qBAAa,aAAa;IAUJ,OAAO,CAAC,QAAQ,CAAC,KAAK;IAT1C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAkD;IACzE,OAAO,CAAC,QAAQ,CAAC,UAAU,CAKzB;IACF,OAAO,CAAC,SAAS,CAAqB;IAEtC,OAAO;IAOP,mFAAmF;WAC/D,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAWnD,WAAW,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,WAAW,CAAC;IAI7C,QAAQ,IAAI,OAAO,CAAC,WAAW,CAAC;IAIhC,UAAU,CACrB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,IAAI,EACb,OAAO,EAAE,IAAI,GACZ,OAAO,CAAC,WAAW,CAAC;IAMV,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAM9C,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAIvD,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,WAAW,CAAC;IAItD,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE;IAQ5D,yDAAyD;IAC5C,aAAa,IAAI,OAAO,CAAC,WAAW,CAAC;IAIlD,4FAA4F;IAC/E,mBAAmB,CAC9B,IAAI,EAAE,MAAM,EACZ,mBAAmB,EAAE,6BAA6B,CAAC,gBAAgB,CAAC,EAAE,GACrE,OAAO,CAAC,6BAA6B,CAAC,gBAAgB,CAAC,EAAE,CAAC;IAM7D,wFAAwF;IAC3E,eAAe,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;CAG/D;AAED,qBAAa,QAAQ;WACN,0BAA0B,CACrC,QAAQ,EAAE,WAAW,GACpB,OAAO,CAAC,OAAO,EAAE,CAAC;CActB"}
|
|
@@ -25,25 +25,42 @@ export class RbacApiHelper {
|
|
|
25
25
|
});
|
|
26
26
|
return instance;
|
|
27
27
|
}
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
// Roles:
|
|
29
|
+
async createRoles(role) {
|
|
30
|
+
return await this.myContext.post("roles", { data: role });
|
|
30
31
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
return await this.myContext.get(`roles/conditions`);
|
|
32
|
+
async getRoles() {
|
|
33
|
+
return await this.myContext.get("roles");
|
|
34
34
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
async updateRole(role, oldRole, newRole) {
|
|
36
|
+
return await this.myContext.put(`roles/role/default/${role}`, {
|
|
37
|
+
data: { oldRole, newRole },
|
|
38
|
+
});
|
|
38
39
|
}
|
|
39
40
|
async deleteRole(role) {
|
|
40
41
|
return await this.myContext.delete(`roles/role/default/${role}`);
|
|
41
42
|
}
|
|
43
|
+
// Policies:
|
|
44
|
+
async getPoliciesByRole(policy) {
|
|
45
|
+
return await this.myContext.get(`policies/role/default/${policy}`);
|
|
46
|
+
}
|
|
47
|
+
async createPolicies(policy) {
|
|
48
|
+
return await this.myContext.post("policies", { data: policy });
|
|
49
|
+
}
|
|
42
50
|
async deletePolicy(policy, policies) {
|
|
43
51
|
return await this.myContext.delete(`policies/role/default/${policy}`, {
|
|
44
52
|
data: policies,
|
|
45
53
|
});
|
|
46
54
|
}
|
|
55
|
+
// Conditions:
|
|
56
|
+
/** Fetches all conditional policies across all roles. */
|
|
57
|
+
async getConditions() {
|
|
58
|
+
return await this.myContext.get(`roles/conditions`);
|
|
59
|
+
}
|
|
60
|
+
/** Filters a full conditions list down to those belonging to a specific role entity ref. */
|
|
61
|
+
async getConditionsByRole(role, remainingConditions) {
|
|
62
|
+
return remainingConditions.filter((condition) => condition.roleEntityRef === role);
|
|
63
|
+
}
|
|
47
64
|
/** `id` comes from the `RoleConditionalPolicyDecision.id` field returned by the API. */
|
|
48
65
|
async deleteCondition(id) {
|
|
49
66
|
return await this.myContext.delete(`roles/conditions/${id}`);
|
|
@@ -3,4 +3,5 @@ export { CatalogPage } from "./catalog.js";
|
|
|
3
3
|
export { ExtensionsPage } from "./extensions.js";
|
|
4
4
|
export { HomePage } from "./home-page.js";
|
|
5
5
|
export { NotificationPage } from "./notifications.js";
|
|
6
|
+
export { OrchestratorPage } from "./orchestrator.js";
|
|
6
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/playwright/pages/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/playwright/pages/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type Page } from "@playwright/test";
|
|
2
|
+
export declare class OrchestratorPage {
|
|
3
|
+
private readonly page;
|
|
4
|
+
constructor(page: Page);
|
|
5
|
+
selectGreetingWorkflowItem(timeout?: number): Promise<void>;
|
|
6
|
+
runGreetingWorkflow(language?: string, status?: string): Promise<void>;
|
|
7
|
+
reRunGreetingWorkflow(language?: string, status?: string): Promise<void>;
|
|
8
|
+
validateGreetingWorkflow(): Promise<void>;
|
|
9
|
+
validateWorkflowRunsDetails(): Promise<void>;
|
|
10
|
+
validateWorkflowAllRuns(): Promise<void>;
|
|
11
|
+
validateWorkflowAllRunsStatusIcons(): Promise<void>;
|
|
12
|
+
abortWorkflow(): Promise<void>;
|
|
13
|
+
selectFailSwitchWorkflowItem(timeout?: number): Promise<void>;
|
|
14
|
+
runFailSwitchWorkflow(input?: string): Promise<void>;
|
|
15
|
+
validateWorkflowStatusDetails(status?: string): Promise<void>;
|
|
16
|
+
validateCurrentWorkflowStatus(status?: string, timeout?: number): Promise<void>;
|
|
17
|
+
reRunFailSwitchWorkflow(input?: string): Promise<void>;
|
|
18
|
+
reRunOnFailure(input?: string): Promise<void>;
|
|
19
|
+
verifyWorkflowsTabVisible(): Promise<void>;
|
|
20
|
+
verifyWorkflowInEntityTab(workflowName: string): Promise<void>;
|
|
21
|
+
clickWorkflowsTab(): Promise<void>;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=orchestrator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orchestrator.d.ts","sourceRoot":"","sources":["../../../src/playwright/pages/orchestrator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAGrD,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAO;gBAEhB,IAAI,EAAE,IAAI;IAIhB,0BAA0B,CAAC,OAAO,GAAE,MAAc;IAclD,mBAAmB,CAAC,QAAQ,SAAY,EAAE,MAAM,SAAc;IAe9D,qBAAqB,CAAC,QAAQ,SAAY,EAAE,MAAM,SAAc;IAchE,wBAAwB;IAwDxB,2BAA2B;IAS3B,uBAAuB;IAiDvB,kCAAkC;IA0BlC,aAAa;IAab,4BAA4B,CAAC,OAAO,GAAE,MAAc;IAepD,qBAAqB,CAAC,KAAK,SAAO;IAsBlC,6BAA6B,CAAC,MAAM,SAAc;IA+DlD,6BAA6B,CAAC,MAAM,SAAc,EAAE,OAAO,SAAS;IAQpE,uBAAuB,CAAC,KAAK,SAAO;IASpC,cAAc,CAAC,KAAK,SAAoB;IAQxC,yBAAyB;IAKzB,yBAAyB,CAAC,YAAY,EAAE,MAAM;IAK9C,iBAAiB;CAIxB"}
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
import { expect } from "@playwright/test";
|
|
2
|
+
import { workflowsTable } from "./workflows.js";
|
|
3
|
+
export class OrchestratorPage {
|
|
4
|
+
page;
|
|
5
|
+
constructor(page) {
|
|
6
|
+
this.page = page;
|
|
7
|
+
}
|
|
8
|
+
async selectGreetingWorkflowItem(timeout = 30000) {
|
|
9
|
+
const workflowHeader = this.page.getByRole("heading", {
|
|
10
|
+
name: "Workflows",
|
|
11
|
+
});
|
|
12
|
+
await expect(workflowHeader).toBeVisible();
|
|
13
|
+
await expect(workflowHeader).toHaveText("Workflows");
|
|
14
|
+
await expect(workflowsTable(this.page)).toBeVisible();
|
|
15
|
+
const greetingLink = this.page.getByRole("link", {
|
|
16
|
+
name: "Greeting workflow",
|
|
17
|
+
});
|
|
18
|
+
await expect(greetingLink).toBeVisible({ timeout });
|
|
19
|
+
await greetingLink.click();
|
|
20
|
+
}
|
|
21
|
+
async runGreetingWorkflow(language = "English", status = "Completed") {
|
|
22
|
+
const runButton = this.page.getByRole("button", { name: "Run" });
|
|
23
|
+
await expect(runButton).toBeVisible();
|
|
24
|
+
await runButton.click();
|
|
25
|
+
await this.page.getByLabel("Language").click();
|
|
26
|
+
await this.page.getByRole("option", { name: language }).click();
|
|
27
|
+
await this.page.getByRole("button", { name: "Next" }).click();
|
|
28
|
+
await this.page.getByRole("button", { name: "Run" }).click();
|
|
29
|
+
await expect(this.page.getByText(`${status}`, { exact: true })).toBeVisible({
|
|
30
|
+
timeout: 600000,
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
async reRunGreetingWorkflow(language = "English", status = "Completed") {
|
|
34
|
+
await expect(this.page.getByText("Run again")).toBeVisible();
|
|
35
|
+
await this.page.getByText("Run again").click();
|
|
36
|
+
await this.page.getByLabel("Language").click();
|
|
37
|
+
await this.page.getByRole("option", { name: language }).click();
|
|
38
|
+
await this.page.getByRole("button", { name: "Next" }).click();
|
|
39
|
+
await this.page.getByRole("button", { name: "Run" }).click();
|
|
40
|
+
await expect(this.page.getByText(`${status}`, { exact: true })).toBeVisible({
|
|
41
|
+
timeout: 600000,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
async validateGreetingWorkflow() {
|
|
45
|
+
await this.page.getByRole("tab", { name: "Workflows" }).click();
|
|
46
|
+
const workflowHeader = this.page.getByRole("heading", {
|
|
47
|
+
name: "Workflows",
|
|
48
|
+
});
|
|
49
|
+
await expect(workflowHeader).toBeVisible();
|
|
50
|
+
await expect(workflowHeader).toHaveText("Workflows");
|
|
51
|
+
await expect(workflowsTable(this.page)).toBeVisible();
|
|
52
|
+
await expect(this.page.locator(`input[aria-label="Search"]`)).toHaveAttribute("placeholder", "Filter");
|
|
53
|
+
await expect(this.page.getByRole("columnheader", { name: "Name", exact: true })).toBeVisible();
|
|
54
|
+
await expect(this.page.getByRole("columnheader", {
|
|
55
|
+
name: "Workflow Status",
|
|
56
|
+
exact: true,
|
|
57
|
+
})).toBeVisible();
|
|
58
|
+
await expect(this.page.getByRole("columnheader", { name: "Last run", exact: true })).toBeVisible();
|
|
59
|
+
await expect(this.page.getByRole("columnheader", {
|
|
60
|
+
name: "Last run status",
|
|
61
|
+
exact: true,
|
|
62
|
+
})).toBeVisible();
|
|
63
|
+
await expect(this.page.getByRole("columnheader", { name: "Actions", exact: true })).toBeVisible();
|
|
64
|
+
const workFlowRow = this.page.locator(`tr:has-text("Greeting workflow")`);
|
|
65
|
+
await expect(workFlowRow.locator("td").nth(0)).toHaveText("Greeting workflow");
|
|
66
|
+
await expect(workFlowRow.locator("td").nth(1)).toHaveText("Available");
|
|
67
|
+
await expect(workFlowRow.locator("td").nth(2)).toHaveText(/^\d{1,2}\/\d{1,2}\/\d{4}, \d{1,2}:\d{1,2}:\d{1,2} (AM|PM)$/);
|
|
68
|
+
await expect(workFlowRow.locator("td").nth(3)).toHaveText("Completed");
|
|
69
|
+
await expect(workFlowRow.locator("td").nth(4)).toHaveText("YAML based greeting workflow");
|
|
70
|
+
await expect(workFlowRow.getByRole("button", { name: "Run", exact: true }).first()).toBeVisible();
|
|
71
|
+
await expect(workFlowRow.getByRole("button", { name: "View runs" }).first()).toBeVisible();
|
|
72
|
+
await expect(workFlowRow.getByRole("button", { name: "View input schema" }).first()).toBeVisible();
|
|
73
|
+
}
|
|
74
|
+
async validateWorkflowRunsDetails() {
|
|
75
|
+
await expect(this.page.getByText("Details")).toBeVisible();
|
|
76
|
+
await expect(this.page.getByText("Results")).toBeVisible();
|
|
77
|
+
await expect(this.page.getByText("Workflow progress")).toBeVisible();
|
|
78
|
+
await expect(this.page.locator("div").filter({ hasText: "Completed" }).first()).toBeVisible();
|
|
79
|
+
}
|
|
80
|
+
async validateWorkflowAllRuns() {
|
|
81
|
+
await this.page.getByRole("tab", { name: "all runs" }).click();
|
|
82
|
+
await expect(this.page
|
|
83
|
+
.locator("tbody")
|
|
84
|
+
.getByRole("row")
|
|
85
|
+
.nth(0)
|
|
86
|
+
.getByRole("cell")
|
|
87
|
+
.nth(0)).toBeVisible();
|
|
88
|
+
await expect(this.page.getByTestId("select").first()).toHaveAttribute("aria-label", "Status");
|
|
89
|
+
await this.page
|
|
90
|
+
.getByLabel("Status")
|
|
91
|
+
.getByRole("button", { name: "All" })
|
|
92
|
+
.click();
|
|
93
|
+
const statuses = ["All", "Running", "Failed", "Completed", "Aborted"];
|
|
94
|
+
for (const status of statuses) {
|
|
95
|
+
await expect(this.page.getByRole("option", { name: status })).toHaveText(status);
|
|
96
|
+
await this.page.getByRole("option", { name: status }).click();
|
|
97
|
+
await this.page
|
|
98
|
+
.getByLabel("Status")
|
|
99
|
+
.getByRole("button", { name: status })
|
|
100
|
+
.click();
|
|
101
|
+
}
|
|
102
|
+
await this.page.getByRole("option", { name: "All" }).click();
|
|
103
|
+
const columnHeaders = [
|
|
104
|
+
"ID",
|
|
105
|
+
"Workflow name",
|
|
106
|
+
"Run Status",
|
|
107
|
+
"Started",
|
|
108
|
+
"Duration",
|
|
109
|
+
];
|
|
110
|
+
for (const columnHeader of columnHeaders) {
|
|
111
|
+
await expect(this.page.getByRole("columnheader", {
|
|
112
|
+
name: columnHeader,
|
|
113
|
+
exact: true,
|
|
114
|
+
})).toBeVisible();
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
async validateWorkflowAllRunsStatusIcons() {
|
|
118
|
+
await this.page.getByRole("tab", { name: "all runs" }).click();
|
|
119
|
+
const statuses = ["Running", "Failed", "Completed", "-- Aborted"];
|
|
120
|
+
for (const status of statuses) {
|
|
121
|
+
await expect(this.page.getByText(status).first()).toHaveText(status);
|
|
122
|
+
}
|
|
123
|
+
await expect(this.page
|
|
124
|
+
.getByRole("cell", { name: /Running/ })
|
|
125
|
+
.locator("svg")
|
|
126
|
+
.first()).toBeVisible();
|
|
127
|
+
await expect(this.page
|
|
128
|
+
.getByRole("cell", { name: /Completed/ })
|
|
129
|
+
.locator("svg")
|
|
130
|
+
.first()).toBeVisible();
|
|
131
|
+
await expect(this.page
|
|
132
|
+
.getByRole("cell", { name: /Failed/ })
|
|
133
|
+
.locator("svg")
|
|
134
|
+
.first()).toBeVisible();
|
|
135
|
+
}
|
|
136
|
+
async abortWorkflow() {
|
|
137
|
+
await expect(this.page.getByRole("button", { name: "Abort" })).toBeEnabled();
|
|
138
|
+
await this.page.getByRole("button", { name: "Abort" }).click();
|
|
139
|
+
await this.page
|
|
140
|
+
.getByRole("dialog", { name: /Abort workflow run\?/i })
|
|
141
|
+
.getByRole("button", { name: "Abort" })
|
|
142
|
+
.click();
|
|
143
|
+
await expect(this.page.getByText("Run has aborted")).toBeVisible();
|
|
144
|
+
await expect(this.page.getByText("-- Aborted")).toBeVisible();
|
|
145
|
+
}
|
|
146
|
+
async selectFailSwitchWorkflowItem(timeout = 30000) {
|
|
147
|
+
const workflowHeader = this.page.getByRole("heading", {
|
|
148
|
+
name: "Workflows",
|
|
149
|
+
});
|
|
150
|
+
await expect(workflowHeader).toBeVisible();
|
|
151
|
+
await expect(workflowHeader).toHaveText("Workflows");
|
|
152
|
+
await expect(workflowsTable(this.page)).toBeVisible();
|
|
153
|
+
// Wait for the workflow to be visible with explicit timeout for RBAC permission propagation
|
|
154
|
+
const failSwitchLink = this.page.getByRole("link", {
|
|
155
|
+
name: "FailSwitch workflow",
|
|
156
|
+
});
|
|
157
|
+
await expect(failSwitchLink).toBeVisible({ timeout });
|
|
158
|
+
await failSwitchLink.click();
|
|
159
|
+
}
|
|
160
|
+
async runFailSwitchWorkflow(input = "OK") {
|
|
161
|
+
const runButton = this.page.getByRole("button", { name: "Run" });
|
|
162
|
+
await expect(runButton).toBeVisible();
|
|
163
|
+
await runButton.click();
|
|
164
|
+
await this.page.getByLabel(/switch/i).click();
|
|
165
|
+
await this.page.getByRole("option", { name: input }).click();
|
|
166
|
+
await this.page.getByRole("button", { name: "Next" }).click();
|
|
167
|
+
await this.page.getByRole("button", { name: "Run" }).click();
|
|
168
|
+
switch (input) {
|
|
169
|
+
case "OK":
|
|
170
|
+
await this.validateCurrentWorkflowStatus("Completed");
|
|
171
|
+
break;
|
|
172
|
+
case "KO":
|
|
173
|
+
await this.validateCurrentWorkflowStatus("Failed");
|
|
174
|
+
break;
|
|
175
|
+
case "Wait":
|
|
176
|
+
await this.validateCurrentWorkflowStatus("Running");
|
|
177
|
+
break;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
async validateWorkflowStatusDetails(status = "Completed") {
|
|
181
|
+
const details = this.page
|
|
182
|
+
.getByRole("article")
|
|
183
|
+
.filter({ has: this.page.getByRole("heading", { name: "Workflow" }) });
|
|
184
|
+
if (status === "Running") {
|
|
185
|
+
// Verify Run status heading and spinner in details area
|
|
186
|
+
await expect(details.getByRole("heading", { name: /Run\s*status/i })).toBeVisible();
|
|
187
|
+
await expect(this.page
|
|
188
|
+
.locator("b")
|
|
189
|
+
.filter({ hasText: "Running" })
|
|
190
|
+
.getByRole("progressbar")).toBeVisible();
|
|
191
|
+
// Verify a button shows 'Running' text and has a spinner
|
|
192
|
+
const workflowButtons = this.page
|
|
193
|
+
.locator("div")
|
|
194
|
+
.filter({ hasText: "Abort Running..." })
|
|
195
|
+
.nth(4);
|
|
196
|
+
await expect(workflowButtons).toHaveText(/Running/i);
|
|
197
|
+
await expect(workflowButtons.getByRole("progressbar")).toBeVisible();
|
|
198
|
+
await expect(this.page.getByTestId("info-card-subheader").getByRole("img")).toBeVisible();
|
|
199
|
+
// Verify workflow is running message is visible with timestamp
|
|
200
|
+
// Note: Following line is blocked in main branch due to bug RHDHBUGS-2220. TODO: Uncomment this once the bug is fixed.
|
|
201
|
+
await expect(this.page.getByText(/workflow is running\.?\s*Started at\s+\d{1,2}\/\d{1,2}\/\d{4},\s+\d{1,2}:\d{2}:\d{2}\s+(AM|PM)/i)).toBeVisible();
|
|
202
|
+
}
|
|
203
|
+
if (status === "Failed") {
|
|
204
|
+
await expect(details.getByTestId("ErrorOutlineOutlinedIcon")).toBeVisible();
|
|
205
|
+
await expect(this.page.getByText(/Run has failed at\s+\d{1,2}\/\d{1,2}\/\d{4},\s+\d{1,2}:\d{2}:\d{2}\s+(AM|PM)/)).toBeVisible();
|
|
206
|
+
await expect(this.page.getByTestId("ErrorOutlineOutlinedIcon")).toBeVisible();
|
|
207
|
+
}
|
|
208
|
+
if (status === "Completed") {
|
|
209
|
+
await expect(this.page
|
|
210
|
+
.locator("b")
|
|
211
|
+
.filter({ hasText: "Completed" })
|
|
212
|
+
.getByTestId("CheckCircleOutlinedIcon")).toBeVisible();
|
|
213
|
+
await expect(this.page.getByText(/Run completed at\s+\d{1,2}\/\d{1,2}\/\d{4},\s+\d{1,2}:\d{2}:\d{2}\s+(AM|PM)/)).toBeVisible();
|
|
214
|
+
await expect(this.page.getByTestId("SuccessOutlinedIcon")).toBeVisible();
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
async validateCurrentWorkflowStatus(status = "Completed", timeout = 120000) {
|
|
218
|
+
await expect(this.page.getByText(`${status}`, { exact: true })).toBeVisible({
|
|
219
|
+
timeout,
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
async reRunFailSwitchWorkflow(input = "OK") {
|
|
223
|
+
await expect(this.page.getByText("Run again")).toBeVisible();
|
|
224
|
+
await this.page.getByText("Run again").click();
|
|
225
|
+
await this.page.getByLabel("switch").click();
|
|
226
|
+
await this.page.getByRole("option", { name: input }).click();
|
|
227
|
+
await this.page.getByRole("button", { name: "Next" }).click();
|
|
228
|
+
await this.page.getByRole("button", { name: "Run" }).click();
|
|
229
|
+
}
|
|
230
|
+
async reRunOnFailure(input = "Entire workflow") {
|
|
231
|
+
await expect(this.page.getByText("Run again")).toBeVisible();
|
|
232
|
+
await this.page.getByText("Run again").click();
|
|
233
|
+
await this.page.getByRole("menuitem", { name: input }).click();
|
|
234
|
+
}
|
|
235
|
+
// Entity-Workflow Integration Methods (RHIDP-11833 through RHIDP-11840)
|
|
236
|
+
async verifyWorkflowsTabVisible() {
|
|
237
|
+
const workflowsTab = this.page.getByRole("tab", { name: "Workflows" });
|
|
238
|
+
await expect(workflowsTab).toBeVisible();
|
|
239
|
+
}
|
|
240
|
+
async verifyWorkflowInEntityTab(workflowName) {
|
|
241
|
+
const workflowLink = this.page.getByRole("link", { name: workflowName });
|
|
242
|
+
await expect(workflowLink).toBeVisible();
|
|
243
|
+
}
|
|
244
|
+
async clickWorkflowsTab() {
|
|
245
|
+
await this.page.getByRole("tab", { name: "Workflows" }).click();
|
|
246
|
+
await this.page.waitForLoadState("load");
|
|
247
|
+
}
|
|
248
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflows.d.ts","sourceRoot":"","sources":["../../../src/playwright/pages/workflows.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAE7C,eAAO,MAAM,cAAc,GAAI,MAAM,IAAI,sCAC0B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const workflowsTable = (page) => page.locator("#root div").filter({ hasText: "Workflows" }).nth(2);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@red-hat-developer-hub/e2e-test-utils",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.20",
|
|
4
4
|
"description": "Test utilities for RHDH E2E tests",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -48,6 +48,10 @@
|
|
|
48
48
|
"./teardown": {
|
|
49
49
|
"types": "./dist/playwright/teardown-namespaces.d.ts",
|
|
50
50
|
"default": "./dist/playwright/teardown-namespaces.js"
|
|
51
|
+
},
|
|
52
|
+
"./orchestrator": {
|
|
53
|
+
"types": "./dist/deployment/orchestrator/index.d.ts",
|
|
54
|
+
"default": "./dist/deployment/orchestrator/index.js"
|
|
51
55
|
}
|
|
52
56
|
},
|
|
53
57
|
"publishConfig": {
|
|
@@ -58,7 +62,7 @@
|
|
|
58
62
|
"tsconfig.base.json"
|
|
59
63
|
],
|
|
60
64
|
"scripts": {
|
|
61
|
-
"build": "yarn clean && tsc -p tsconfig.build.json && cp -r src/deployment/rhdh/config dist/deployment/rhdh/ && cp -r src/deployment/keycloak/config dist/deployment/keycloak/",
|
|
65
|
+
"build": "yarn clean && tsc -p tsconfig.build.json && cp -r src/deployment/rhdh/config dist/deployment/rhdh/ && cp -r src/deployment/keycloak/config dist/deployment/keycloak/ && cp src/deployment/orchestrator/install-orchestrator.sh dist/deployment/orchestrator/",
|
|
62
66
|
"prepare": "husky",
|
|
63
67
|
"check": "yarn typecheck && yarn lint:check && yarn prettier:check",
|
|
64
68
|
"clean": "rm -rf dist",
|