]> git.proxmox.com Git - ceph.git/blame - ceph/src/pybind/mgr/dashboard/frontend/cypress/e2e/orchestrator/01-hosts.e2e-spec.ts
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / pybind / mgr / dashboard / frontend / cypress / e2e / orchestrator / 01-hosts.e2e-spec.ts
CommitLineData
f67539c2
TL
1import { HostsPageHelper } from '../cluster/hosts.po';
2
3describe('Hosts page', () => {
4 const hosts = new HostsPageHelper();
5
6 beforeEach(() => {
7 cy.login();
f67539c2
TL
8 hosts.navigateTo();
9 });
10
11 describe('when Orchestrator is available', () => {
12 beforeEach(function () {
13 cy.fixture('orchestrator/inventory.json').as('hosts');
b3b6e05e 14 cy.fixture('orchestrator/services.json').as('services');
f67539c2
TL
15 });
16
17 it('should not add an exsiting host', function () {
18 const hostname = Cypress._.sample(this.hosts).name;
a4b75251 19 hosts.navigateTo('add');
f67539c2
TL
20 hosts.add(hostname, true);
21 });
22
20effc67 23 it('should drain and remove a host and then add it back', function () {
a4b75251
TL
24 const hostname = Cypress._.last(this.hosts)['name'];
25
26 // should drain the host first before deleting
20effc67
TL
27 hosts.drain(hostname);
28 hosts.remove(hostname);
f67539c2
TL
29
30 // add it back
a4b75251
TL
31 hosts.navigateTo('add');
32 hosts.add(hostname);
33 hosts.checkExist(hostname, true);
f67539c2
TL
34 });
35
36 it('should display inventory', function () {
37 for (const host of this.hosts) {
a4b75251 38 hosts.clickTab('cd-host-details', host.name, 'Physical Disks');
f67539c2 39 cy.get('cd-host-details').within(() => {
20effc67 40 hosts.expectTableCount('total', host.devices.length);
f67539c2
TL
41 });
42 }
43 });
44
45 it('should display daemons', function () {
46 for (const host of this.hosts) {
a4b75251 47 hosts.clickTab('cd-host-details', host.name, 'Daemons');
f67539c2
TL
48 cy.get('cd-host-details').within(() => {
49 hosts.getTableCount('total').should('be.gte', 0);
50 });
51 }
52 });
53
54 it('should edit host labels', function () {
55 const hostname = Cypress._.sample(this.hosts).name;
56 const labels = ['foo', 'bar'];
57 hosts.editLabels(hostname, labels, true);
58 hosts.editLabels(hostname, labels, false);
59 });
60
61 it('should enter host into maintenance', function () {
62 const hostname = Cypress._.sample(this.hosts).name;
b3b6e05e
TL
63 const serviceList = new Array();
64 this.services.forEach((service: any) => {
65 if (hostname === service.hostname) {
66 serviceList.push(service.daemon_type);
67 }
68 });
69 let enterMaintenance = true;
70 serviceList.forEach((service: string) => {
71 if (service === 'mgr' || service === 'alertmanager') {
72 enterMaintenance = false;
73 }
74 });
75 if (enterMaintenance) {
76 hosts.maintenance(hostname);
77 }
f67539c2
TL
78 });
79
80 it('should exit host from maintenance', function () {
81 const hostname = Cypress._.sample(this.hosts).name;
82 hosts.maintenance(hostname, true);
83 });
84 });
85});