-
Notifications
You must be signed in to change notification settings - Fork 596
/
debug-pod.cy.ts
91 lines (82 loc) · 2.7 KB
/
debug-pod.cy.ts
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
import { checkErrors, testName } from '../../support';
import { detailsPage } from '../../views/details-page';
import { errorMessage } from '../../views/form';
import { listPage } from '../../views/list-page';
import { modal } from '../../views/modal';
import { nav } from '../../views/nav';
import * as yamlEditor from '../../views/yaml-editor';
const POD_NAME = `pod1`;
const CONTAINER_NAME = `container1`;
const XTERM_CLASS = `[class="xterm-viewport"]`;
const podToDebug = `apiVersion: v1
kind: Pod
metadata:
name: ${POD_NAME}
spec:
securityContext:
runAsNonRoot: true
seccompProfile:
type: RuntimeDefault
containers:
- name: ${CONTAINER_NAME}
image: quay.io/fedora/fedora
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
restartPolicy: Always`;
describe('Debug pod', () => {
before(() => {
cy.login();
cy.createProjectWithCLI(testName);
});
beforeEach(() => {
cy.initAdmin();
});
afterEach(() => {
checkErrors();
});
after(() => {
cy.visit('/');
cy.deleteProjectWithCLI(testName);
cy.logout();
});
it('Create pod that has crashbackloop error', () => {
cy.visit(`/k8s/ns/${testName}/import`);
yamlEditor.isImportLoaded();
yamlEditor.setEditorContent(podToDebug).then(() => {
yamlEditor.clickSaveCreateButton();
cy.get(errorMessage).should('not.exist');
detailsPage.sectionHeaderShouldExist('Pod details');
});
});
it('Opens debug terminal page from Logs subsection', () => {
cy.visit(`/k8s/ns/${testName}/pods`);
listPage.rows.shouldExist(POD_NAME);
cy.visit(`/k8s/ns/${testName}/pods/${POD_NAME}`);
detailsPage.isLoaded();
detailsPage.selectTab('Logs');
detailsPage.isLoaded();
cy.byTestID('debug-container-link').click();
listPage.titleShouldHaveText(`Debug ${CONTAINER_NAME}`);
cy.get(XTERM_CLASS).should('exist');
});
it('Opens debug terminal page from Pod Details - Status tool tip', () => {
cy.visit(`/k8s/ns/${testName}/pods/${POD_NAME}`);
detailsPage.isLoaded();
cy.byTestID('popover-status-button').click();
cy.byTestID(`popup-debug-container-link-${CONTAINER_NAME}`).click();
listPage.titleShouldHaveText(`Debug ${CONTAINER_NAME}`);
cy.get(XTERM_CLASS).should('exist');
});
it('Opens debug terminal page from Pods Page - Status tool tip', () => {
cy.visit(`/k8s/ns/${testName}/pods`);
listPage.rows.shouldExist(POD_NAME);
listPage.rows.clickStatusButton(POD_NAME);
// Click on first debug link
cy.byTestID(`popup-debug-container-link-${CONTAINER_NAME}`).click();
listPage.titleShouldHaveText(`Debug ${CONTAINER_NAME}`);
cy.get(XTERM_CLASS).should('exist');
});
});