3 SCRIPT_DIR
="$( cd "$
( dirname "${BASH_SOURCE[0]}" )" && pwd )"
4 DASHBOARD_FRONTEND_DIR
=${SCRIPT_DIR}/..
/..
/..
/src
/pybind
/mgr
/dashboard
/frontend
6 [ -z "$SUDO" ] && SUDO
=sudo
9 if grep -q debian
/etc
/*-release; then
11 $SUDO apt-get
install -y jq npm
12 elif grep -q rhel
/etc
/*-release; then
13 $SUDO yum
install -y jq npm
15 echo "Unsupported distribution."
21 if grep -q debian
/etc
/*-release; then
22 $SUDO bash
-c 'echo "deb [arch=amd64] https://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google-chrome.list'
23 curl
-fsSL https
://dl.google.com
/linux
/linux_signing_key.pub |
$SUDO apt-key add
-
25 $SUDO apt-get
install -y google-chrome-stable
26 $SUDO apt-get
install -y xvfb
27 $SUDO rm /etc
/apt
/sources.list.d
/google-chrome.list
28 elif grep -q rhel
/etc
/*-release; then
29 $SUDO dd of
=/etc
/yum.repos.d
/google-chrome.repo status
=none
<<EOF
32 baseurl=https://dl.google.com/linux/chrome/rpm/stable/\$basearch
35 gpgkey=https://dl-ssl.google.com/linux/linux_signing_key.pub
37 $SUDO yum
install -y google-chrome-stable
38 $SUDO rm /etc
/yum.repos.d
/google-chrome.repo
39 # Cypress dependencies
40 $SUDO yum
install -y xorg-x11-server-Xvfb gtk2-devel gtk3-devel libnotify-devel GConf2 nss.x86_64 libXScrnSaver alsa-lib
42 echo "Unsupported distribution."
50 local override_config
="ignoreTestFiles=*.po.ts,retries=0,testFiles=${specs}"
52 if [ x
"$timeout" != "x" ]; then
53 override_config
="${override_config},defaultCommandTimeout=${timeout}"
55 npx cypress run
--browser chrome
--headless --config "$override_config"
61 CYPRESS_BASE_URL
=$
(ceph mgr services | jq
-r .dashboard
)
62 export CYPRESS_BASE_URL
64 cd $DASHBOARD_FRONTEND_DIR
66 # This is required for Cypress to understand typescript
71 # Remove device_health_metrics pool
72 # Low pg count causes OSD removal failure.
73 ceph device monitoring off
74 ceph tell mon.\
* injectargs
'--mon-allow-pool-delete=true'
75 ceph osd pool
rm device_health_metrics device_health_metrics
--yes-i-really-really-mean-it
77 # Take `orch device ls` as ground truth.
78 ceph orch device
ls --refresh
79 sleep 10 # the previous call is asynchronous
80 ceph orch device
ls --format=json |
tee cypress
/fixtures
/orchestrator
/inventory.json
82 DASHBOARD_ADMIN_SECRET_FILE
="/tmp/dashboard-admin-secret.txt"
83 printf 'admin' > "${DASHBOARD_ADMIN_SECRET_FILE}"
84 ceph dashboard ac-user-set-password admin
-i "${DASHBOARD_ADMIN_SECRET_FILE}" --force-password
86 # Run Dashboard e2e tests.
87 # These tests are designed with execution order in mind, since orchestrator operations
88 # are likely to change cluster state, we can't just run tests in arbitrarily order.
89 # See /ceph/src/pybind/mgr/dashboard/frontend/cypress/integration/orchestrator/ folder.
90 find cypress
# List all specs
92 cypress_run
"orchestrator/01-hosts.e2e-spec.ts"
94 # Hosts are removed and added in the previous step. Do a refresh again.
95 ceph orch device
ls --refresh
97 ceph orch device
ls --format=json |
tee cypress
/fixtures
/orchestrator
/inventory.json
99 cypress_run
"orchestrator/02-hosts-inventory.e2e-spec.ts"
100 cypress_run
"orchestrator/03-inventory.e2e-spec.ts"
101 cypress_run
"orchestrator/04-osds.e2e-spec.ts" 300000