]> git.proxmox.com Git - ceph.git/blob - ceph/src/pybind/mgr/dashboard/frontend/cypress/e2e/block/mirroring.e2e-spec.ts
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / pybind / mgr / dashboard / frontend / cypress / e2e / block / mirroring.e2e-spec.ts
1 import { PoolPageHelper } from '../pools/pools.po';
2 import { MirroringPageHelper } from './mirroring.po';
3
4 describe('Mirroring page', () => {
5 const pools = new PoolPageHelper();
6 const mirroring = new MirroringPageHelper();
7
8 beforeEach(() => {
9 cy.login();
10 mirroring.navigateTo();
11 });
12
13 it('should open and show breadcrumb', () => {
14 mirroring.expectBreadcrumbText('Mirroring');
15 });
16
17 it('should show three tabs', () => {
18 mirroring.getTabsCount().should('eq', 3);
19 });
20
21 it('should show text for all tabs', () => {
22 mirroring.getTabText(0).should('eq', 'Issues (0)');
23 mirroring.getTabText(1).should('eq', 'Syncing (0)');
24 mirroring.getTabText(2).should('eq', 'Ready (0)');
25 });
26
27 describe('rbd mirroring bootstrap', () => {
28 const poolName = 'rbd-mirror';
29
30 beforeEach(() => {
31 // login to the second ceph cluster
32 cy.ceph2Login();
33 cy.login();
34 pools.navigateTo('create');
35 pools.create(poolName, 8, 'rbd');
36 pools.navigateTo();
37 pools.existTableCell(poolName, true);
38 mirroring.navigateTo();
39 });
40
41 it('should generate and import the bootstrap token between clusters', () => {
42 const url: string = Cypress.env('CEPH2_URL');
43 mirroring.navigateTo();
44 mirroring.generateToken(poolName);
45 cy.get('@token').then((bootstrapToken) => {
46 // pass the token to the origin as an arg
47 const args = { name: poolName, bootstrapToken: String(bootstrapToken) };
48 // can't use any imports or functions inside the origin
49 // so writing the code to copy the token inside the origin manually
50 // rather than using a function call
51 // @ts-ignore
52 cy.origin(url, { args }, ({ name, bootstrapToken }) => {
53 // Create an rbd pool in the second cluster
54
55 // Login to the second cluster
56 // Somehow its not working with the cypress login function
57 cy.visit('#/pool/create').wait(100);
58
59 cy.get('[name=username]').type('admin');
60 cy.get('#password').type('admin');
61 cy.get('[type=submit]').click();
62 cy.get('input[name=name]').clear().type(name);
63 cy.get(`select[name=poolType]`).select('replicated');
64 cy.get(`select[name=poolType] option:checked`).contains('replicated');
65 cy.get('.float-start.me-2.select-menu-edit').click();
66 cy.get('.popover-body').should('be.visible');
67 // Choose rbd as the application label
68 cy.get('.select-menu-item-content').contains('rbd').click();
69 cy.get('cd-submit-button').click();
70 cy.get('cd-pool-list').should('exist');
71
72 cy.visit('#/block/mirroring').wait(1000);
73 cy.get('.table-actions button.dropdown-toggle').first().click();
74 cy.get('[aria-label="Import Bootstrap Token"]').click();
75 cy.get('cd-bootstrap-import-modal').within(() => {
76 cy.get(`label[for=${name}]`).click();
77 cy.get('textarea[id=token]').wait(100).type(bootstrapToken);
78 cy.get('button[type=submit]').click();
79 });
80 });
81 });
82
83 // login again since origin removes all the cookies
84 // sessions, localStorage items etc..
85 cy.login();
86 mirroring.navigateTo();
87 mirroring.checkPoolHealthStatus(poolName, 'OK');
88 });
89 });
90
91 describe('checks that edit mode functionality shows in the pools table', () => {
92 const poolName = 'mirroring_test';
93
94 beforeEach(() => {
95 pools.navigateTo('create'); // Need pool for mirroring testing
96 pools.create(poolName, 8, 'rbd');
97 pools.navigateTo();
98 pools.existTableCell(poolName, true);
99 });
100
101 it('tests editing mode for pools', () => {
102 mirroring.navigateTo();
103
104 mirroring.editMirror(poolName, 'Pool');
105 mirroring.getFirstTableCell('pool').should('be.visible');
106 mirroring.editMirror(poolName, 'Image');
107 mirroring.getFirstTableCell('image').should('be.visible');
108 mirroring.editMirror(poolName, 'Disabled');
109 mirroring.getFirstTableCell('disabled').should('be.visible');
110 });
111
112 afterEach(() => {
113 pools.navigateTo();
114 pools.delete(poolName);
115 });
116 });
117 });