-
Notifications
You must be signed in to change notification settings - Fork 142
Expand file tree
/
Copy path7_WLM_details.cy.js
More file actions
104 lines (90 loc) · 3.08 KB
/
Copy path7_WLM_details.cy.js
File metadata and controls
104 lines (90 loc) · 3.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/
describe('WLM Details Page', () => {
const groupName = `test_group_${Date.now()}`;
before(() => {
Cypress.env('groupName', groupName);
// Clean up existing non-default groups
cy.request({
method: 'GET',
url: '/api/_wlm/workload_group',
headers: { 'osd-xsrf': 'true' },
}).then((res) => {
const groups =
res.body && res.body.workload_groups ? res.body.workload_groups : [];
groups.forEach((g) => {
if (g.name !== 'DEFAULT_WORKLOAD_GROUP') {
cy.request({
method: 'DELETE',
url: `/api/_wlm/workload_group/${g.name}`,
headers: { 'osd-xsrf': 'true' },
failOnStatusCode: false,
});
}
});
});
cy.request({
method: 'PUT',
url: '/api/_wlm/workload_group',
headers: { 'osd-xsrf': 'true' },
body: {
name: groupName,
resiliency_mode: 'soft',
resource_limits: {
cpu: 0.01,
memory: 0.01,
},
},
});
});
beforeEach(() => {
cy.visit(`/app/workload-management#/wlm-details?name=${groupName}`);
// Wait until rows render
cy.get('.euiBasicTable .euiTableRow').should('have.length.greaterThan', 0);
});
it('should display workload group summary panel', () => {
cy.contains('Workload group name').should('exist');
cy.contains('Resiliency mode').should('exist');
cy.contains('CPU usage limit').should('exist');
cy.contains('Memory usage limit').should('exist');
cy.contains(groupName).should('exist');
});
it('should switch between tabs', () => {
// Switch to Settings tab
cy.get('[data-testid="wlm-tab-settings"]').click();
cy.contains('Workload group settings').should('exist');
// Switch to Resources tab
cy.get('[data-testid="wlm-tab-resources"]').click();
cy.contains('Node ID').should('exist');
});
it('should display node resource usage table', () => {
cy.contains('Node ID').should('exist');
cy.get('.euiTableRow').should('have.length.greaterThan', 0);
});
it('should show delete modal', () => {
cy.contains('Delete').click();
cy.contains('Delete workload group').should('exist');
});
it('should delete the workload group successfully', () => {
cy.contains('Delete').click(); // opens modal
cy.get('input[placeholder="delete"]').type('delete');
cy.get('.euiModalFooter button').contains('Delete').click();
// Confirm redirected back to WLM main page
cy.url().should('include', '/workloadManagement');
// Confirm toast appears
cy.contains(`Deleted workload group "${groupName}"`).should('exist');
});
});
describe('WLM Details – DEFAULT_WORKLOAD_GROUP', () => {
it('should disable settings tab for DEFAULT_WORKLOAD_GROUP', () => {
cy.visit(
'/app/workload-management#/wlm-details?name=DEFAULT_WORKLOAD_GROUP'
);
cy.get('[data-testid="wlm-tab-settings"]').click();
cy.contains(
'Settings are not available for the DEFAULT_WORKLOAD_GROUP'
).should('exist');
});
});