]> git.proxmox.com Git - ceph.git/blob - ceph/src/pybind/mgr/dashboard/frontend/cypress/integration/orchestrator/01-hosts.e2e-spec.ts
46bb1fea89e11817b771ab328be236e8c0fe23ae
[ceph.git] / ceph / src / pybind / mgr / dashboard / frontend / cypress / integration / orchestrator / 01-hosts.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 not add an exsiting host', function () {
19 const hostname = Cypress._.sample(this.hosts).name;
20 hosts.navigateTo('create');
21 hosts.add(hostname, true);
22 });
23
24 it('should delete a host and add it back', function () {
25 const host = Cypress._.last(this.hosts)['name'];
26 hosts.delete(host);
27
28 // add it back
29 hosts.navigateTo('create');
30 hosts.add(host);
31 hosts.checkExist(host, true);
32 });
33
34 it('should display inventory', function () {
35 for (const host of this.hosts) {
36 hosts.clickHostTab(host.name, 'Inventory');
37 cy.get('cd-host-details').within(() => {
38 hosts.getTableCount('total').should('be.gte', 0);
39 });
40 }
41 });
42
43 it('should display daemons', function () {
44 for (const host of this.hosts) {
45 hosts.clickHostTab(host.name, 'Daemons');
46 cy.get('cd-host-details').within(() => {
47 hosts.getTableCount('total').should('be.gte', 0);
48 });
49 }
50 });
51
52 it('should edit host labels', function () {
53 const hostname = Cypress._.sample(this.hosts).name;
54 const labels = ['foo', 'bar'];
55 hosts.editLabels(hostname, labels, true);
56 hosts.editLabels(hostname, labels, false);
57 });
58
59 it('should enter host into maintenance', function () {
60 const hostname = Cypress._.sample(this.hosts).name;
61 const serviceList = new Array();
62 this.services.forEach((service: any) => {
63 if (hostname === service.hostname) {
64 serviceList.push(service.daemon_type);
65 }
66 });
67 let enterMaintenance = true;
68 serviceList.forEach((service: string) => {
69 if (service === 'mgr' || service === 'alertmanager') {
70 enterMaintenance = false;
71 }
72 });
73 if (enterMaintenance) {
74 hosts.maintenance(hostname);
75 }
76 });
77
78 it('should exit host from maintenance', function () {
79 const hostname = Cypress._.sample(this.hosts).name;
80 hosts.maintenance(hostname, true);
81 });
82 });
83 });