]> git.proxmox.com Git - ceph.git/blob - ceph/src/pybind/mgr/dashboard/frontend/cypress/integration/orchestrator/01-hosts-force-maintenance.e2e-spec.ts
import ceph 16.2.6
[ceph.git] / ceph / src / pybind / mgr / dashboard / frontend / cypress / integration / orchestrator / 01-hosts-force-maintenance.e2e-spec.ts
1 import { HostsPageHelper } from '../cluster/hosts.po';
2
3 describe('Hosts page', () => {
4 const hosts = new HostsPageHelper();
5
6 beforeEach(() => {
7 cy.login();
8 Cypress.Cookies.preserveOnce('token');
9 hosts.navigateTo();
10 });
11
12 describe('when Orchestrator is available', () => {
13 beforeEach(function () {
14 cy.fixture('orchestrator/inventory.json').as('hosts');
15 cy.fixture('orchestrator/services.json').as('services');
16 });
17
18 it('should force enter host into maintenance', function () {
19 const hostname = Cypress._.sample(this.hosts).name;
20 const hostnameList = new Array();
21 this.hosts.array.forEach((host: any) => {
22 hostnameList.push(host.hostname);
23 });
24 const serviceList = new Array();
25 this.services.forEach((service: any) => {
26 if (hostname === service.hostname) {
27 serviceList.push(service.daemon_type);
28 }
29 });
30
31 let enterMaintenance = true;
32
33 // Force maintenance might throw out error if host are less than 3.
34 if (hostnameList.length < 3) {
35 enterMaintenance = false;
36 }
37
38 serviceList.forEach((service: string) => {
39 if (service !== 'rgw' && (service === 'mgr' || service === 'alertmanager')) {
40 enterMaintenance = false;
41 }
42 });
43
44 if (enterMaintenance) {
45 hosts.maintenance(hostname, true, true);
46 }
47 });
48 });
49 });