1 import { HostsPageHelper } from '../cluster/hosts.po';
3 describe('Hosts page', () => {
4 const hosts = new HostsPageHelper();
8 Cypress.Cookies.preserveOnce('token');
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');
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);
24 const serviceList = new Array();
25 this.services.forEach((service: any) => {
26 if (hostname === service.hostname) {
27 serviceList.push(service.daemon_type);
31 let enterMaintenance = true;
33 // Force maintenance might throw out error if host are less than 3.
34 if (hostnameList.length < 3) {
35 enterMaintenance = false;
38 serviceList.forEach((service: string) => {
39 if (service !== 'rgw' && (service === 'mgr' || service === 'alertmanager')) {
40 enterMaintenance = false;
44 if (enterMaintenance) {
45 hosts.maintenance(hostname, true, true);