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
10 if grep -q debian
/etc
/*-release; then
12 # https://github.com/nodesource/distributions#manual-installation
13 $SUDO apt-get
install curl gpg
14 KEYRING
=/usr
/share
/keyrings
/nodesource.gpg
15 curl
-fsSL https
://deb.nodesource.com
/gpgkey
/nodesource.gpg.key | gpg
--dearmor |
$SUDO tee "$KEYRING" >/dev
/null
16 DISTRO
="$(source /etc/lsb-release; echo $DISTRIB_CODENAME)"
17 VERSION
="node_$NODEJS_VERSION.x"
18 echo "deb [signed-by=$KEYRING] https://deb.nodesource.com/$VERSION $DISTRO main" |
$SUDO tee /etc
/apt
/sources.list.d
/nodesource.list
19 echo "deb-src [signed-by=$KEYRING] https://deb.nodesource.com/$VERSION $DISTRO main" |
$SUDO tee -a /etc
/apt
/sources.list.d
/nodesource.list
21 $SUDO apt-get
install nodejs
22 elif grep -q rhel
/etc
/*-release; then
23 $SUDO yum module
-y enable nodejs
:$NODEJS_VERSION
24 $SUDO yum
install -y jq npm
26 echo "Unsupported distribution."
32 if grep -q debian
/etc
/*-release; then
33 $SUDO bash
-c 'echo "deb [arch=amd64] https://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google-chrome.list'
34 curl
-fsSL https
://dl.google.com
/linux
/linux_signing_key.pub |
$SUDO apt-key add
-
36 $SUDO apt-get
install -y google-chrome-stable
37 $SUDO apt-get
install -y xvfb
38 $SUDO rm /etc
/apt
/sources.list.d
/google-chrome.list
39 elif grep -q rhel
/etc
/*-release; then
40 $SUDO dd of
=/etc
/yum.repos.d
/google-chrome.repo status
=none
<<EOF
43 baseurl=https://dl.google.com/linux/chrome/rpm/stable/\$basearch
46 gpgkey=https://dl-ssl.google.com/linux/linux_signing_key.pub
48 $SUDO yum
install -y google-chrome-stable
49 $SUDO rm /etc
/yum.repos.d
/google-chrome.repo
50 # Cypress dependencies
51 $SUDO yum
install -y xorg-x11-server-Xvfb gtk2-devel gtk3-devel libnotify-devel GConf2 nss.x86_64 libXScrnSaver alsa-lib
53 echo "Unsupported distribution."
61 local override_config
="ignoreTestFiles=*.po.ts,retries=0,testFiles=${specs}"
63 if [ x
"$timeout" != "x" ]; then
64 override_config
="${override_config},defaultCommandTimeout=${timeout}"
66 npx cypress run
--browser chrome
--headless --config "$override_config"
72 CYPRESS_BASE_URL
=$
(ceph mgr services | jq
-r .dashboard
)
73 export CYPRESS_BASE_URL
75 cd $DASHBOARD_FRONTEND_DIR
77 # This is required for Cypress to understand typescript
82 # Take `orch device ls` and `orch ps` as ground truth.
83 ceph orch device
ls --refresh
84 ceph orch ps
--refresh
85 sleep 10 # the previous call is asynchronous
86 ceph orch device
ls --format=json |
tee cypress
/fixtures
/orchestrator
/inventory.json
87 ceph orch ps
--format=json |
tee cypress
/fixtures
/orchestrator
/services.json
89 DASHBOARD_ADMIN_SECRET_FILE
="/tmp/dashboard-admin-secret.txt"
90 printf 'admin' > "${DASHBOARD_ADMIN_SECRET_FILE}"
91 ceph dashboard ac-user-set-password admin
-i "${DASHBOARD_ADMIN_SECRET_FILE}" --force-password
93 # Run Dashboard e2e tests.
94 # These tests are designed with execution order in mind, since orchestrator operations
95 # are likely to change cluster state, we can't just run tests in arbitrarily order.
96 # See /ceph/src/pybind/mgr/dashboard/frontend/cypress/integration/orchestrator/ folder.
97 find cypress
# List all specs
99 cypress_run
"orchestrator/01-hosts.e2e-spec.ts"
101 # Hosts are removed and added in the previous step. Do a refresh again.
102 ceph orch device
ls --refresh
104 ceph orch device
ls --format=json |
tee cypress
/fixtures
/orchestrator
/inventory.json
106 cypress_run
"orchestrator/03-inventory.e2e-spec.ts"
107 cypress_run
"orchestrator/04-osds.e2e-spec.ts" 300000