]> git.proxmox.com Git - ceph.git/blame - ceph/src/pybind/mgr/dashboard/ci/cephadm/run-cephadm-e2e-tests.sh
update ceph source to reef 18.2.0
[ceph.git] / ceph / src / pybind / mgr / dashboard / ci / cephadm / run-cephadm-e2e-tests.sh
CommitLineData
b3b6e05e
TL
1#!/usr/bin/env bash
2
3set -ex
4
b3b6e05e
TL
5: ${CYPRESS_BASE_URL:=''}
6: ${CYPRESS_LOGIN_USER:='admin'}
7: ${CYPRESS_LOGIN_PWD:='password'}
8: ${CYPRESS_ARGS:=''}
522d829b 9: ${DASHBOARD_PORT:='8443'}
b3b6e05e 10
522d829b
TL
11get_vm_ip () {
12 local ip=$(kcli info vm "$1" -f ip -v | grep -Eo '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}')
13 echo -n $ip
14}
15
16if [[ -n "${JENKINS_HOME}" || (-z "${CYPRESS_BASE_URL}" && -z "$(get_vm_ip ceph-node-00)") ]]; then
17 . "$(dirname $0)"/start-cluster.sh
18
19 CYPRESS_BASE_URL="https://$(get_vm_ip ceph-node-00):${DASHBOARD_PORT}"
b3b6e05e
TL
20fi
21
22export CYPRESS_BASE_URL CYPRESS_LOGIN_USER CYPRESS_LOGIN_PWD
23
24cypress_run () {
25 local specs="$1"
26 local timeout="$2"
1e59de90 27 local override_config="excludeSpecPattern=*.po.ts,retries=0,specPattern=${specs},chromeWebSecurity=false"
b3b6e05e
TL
28 if [[ -n "$timeout" ]]; then
29 override_config="${override_config},defaultCommandTimeout=${timeout}"
30 fi
522d829b
TL
31
32 rm -f cypress/reports/results-*.xml || true
33
34 npx --no-install cypress run ${CYPRESS_ARGS} --browser chrome --headless --config "$override_config"
b3b6e05e
TL
35}
36
522d829b
TL
37: ${CEPH_DEV_FOLDER:=${PWD}}
38
39cd ${CEPH_DEV_FOLDER}/src/pybind/mgr/dashboard/frontend
40
2a845540
TL
41# check if the prometheus daemon is running
42# before starting the e2e tests
43
44PROMETHEUS_RUNNING_COUNT=$(kcli ssh -u root ceph-node-00 'cephadm shell "ceph orch ls --service_name=prometheus --format=json"' | jq -r '.[] | .status.running')
45while [[ $PROMETHEUS_RUNNING_COUNT -lt 1 ]]; do
46 PROMETHEUS_RUNNING_COUNT=$(kcli ssh -u root ceph-node-00 'cephadm shell "ceph orch ls --service_name=prometheus --format=json"' | jq -r '.[] | .status.running')
47done
48
39ae355f
TL
49# grafana ip address is set to the fqdn by default.
50# kcli is not working with that, so setting the IP manually.
51kcli ssh -u root ceph-node-00 'cephadm shell "ceph dashboard set-alertmanager-api-host http://192.168.100.100:9093"'
52kcli ssh -u root ceph-node-00 'cephadm shell "ceph dashboard set-prometheus-api-host http://192.168.100.100:9095"'
53kcli ssh -u root ceph-node-00 'cephadm shell "ceph dashboard set-grafana-api-url https://192.168.100.100:3000"'
54kcli ssh -u root ceph-node-00 'cephadm shell "ceph orch apply node-exporter --placement 'count:2'"'
55
1e59de90
TL
56cypress_run ["cypress/e2e/orchestrator/workflow/*.feature","cypress/e2e/orchestrator/workflow/*-spec.ts"]
57cypress_run "cypress/e2e/orchestrator/grafana/*.feature"