]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/blob
ac00e2f2903e71f55ca991e17cc49ec8e85eab40
[ceph-ci.git] /
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 serviceList = new Array();
21       this.services.forEach((service: any) => {
22         if (hostname === service.hostname) {
23           serviceList.push(service.daemon_type);
24         }
25       });
26
27       let enterMaintenance = true;
28       serviceList.forEach((service: string) => {
29         if (service === 'mgr' || service === 'alertmanager') {
30           enterMaintenance = false;
31         }
32       });
33
34       if (enterMaintenance) {
35         hosts.maintenance(hostname, true, true);
36       }
37     });
38   });
39 });