@centreon/js-config 24.8.1 → 24.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -21,6 +21,112 @@ const getStatusNumberFromString = (status: string): number => {
|
|
|
21
21
|
throw new Error(`Status ${status} does not exist`);
|
|
22
22
|
};
|
|
23
23
|
|
|
24
|
+
interface HostCheck {
|
|
25
|
+
host: string;
|
|
26
|
+
isForced?: boolean;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
Cypress.Commands.add(
|
|
30
|
+
'scheduleHostCheck',
|
|
31
|
+
({
|
|
32
|
+
host,
|
|
33
|
+
isForced = true
|
|
34
|
+
}: ServiceCheck): Cypress.Chainable => {
|
|
35
|
+
let query = `SELECT id FROM resources WHERE name = '${host}' AND type = 1`;
|
|
36
|
+
|
|
37
|
+
return cy
|
|
38
|
+
.requestOnDatabase({
|
|
39
|
+
database: 'centreon_storage',
|
|
40
|
+
query
|
|
41
|
+
})
|
|
42
|
+
.then(([rows]) => {
|
|
43
|
+
if (rows.length === 0) {
|
|
44
|
+
throw new Error(`Cannot find host ${host}`);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const hostId = rows[0].id;
|
|
48
|
+
|
|
49
|
+
return cy.request({
|
|
50
|
+
body: {
|
|
51
|
+
check: {
|
|
52
|
+
is_forced: isForced
|
|
53
|
+
},
|
|
54
|
+
resources: [
|
|
55
|
+
{
|
|
56
|
+
id: hostId,
|
|
57
|
+
parent: null,
|
|
58
|
+
type: 'host'
|
|
59
|
+
}
|
|
60
|
+
]
|
|
61
|
+
},
|
|
62
|
+
method: 'POST',
|
|
63
|
+
timeout: 30000,
|
|
64
|
+
url: '/centreon/api/latest/monitoring/resources/check'
|
|
65
|
+
}).then((response) => {
|
|
66
|
+
expect(response.status).to.eq(204);
|
|
67
|
+
|
|
68
|
+
return cy.wrap(null);
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
interface ServiceCheck {
|
|
75
|
+
host: string;
|
|
76
|
+
isForced?: boolean;
|
|
77
|
+
service: string;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
Cypress.Commands.add(
|
|
81
|
+
'scheduleServiceCheck',
|
|
82
|
+
({
|
|
83
|
+
host,
|
|
84
|
+
isForced = true,
|
|
85
|
+
service
|
|
86
|
+
}: ServiceCheck): Cypress.Chainable => {
|
|
87
|
+
let query = `SELECT parent_id, id FROM resources WHERE parent_name = '${host}' AND name = '${service}'`;
|
|
88
|
+
|
|
89
|
+
return cy
|
|
90
|
+
.requestOnDatabase({
|
|
91
|
+
database: 'centreon_storage',
|
|
92
|
+
query
|
|
93
|
+
})
|
|
94
|
+
.then(([rows]) => {
|
|
95
|
+
if (rows.length === 0) {
|
|
96
|
+
throw new Error(`Cannot find service ${host} / ${service}`);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
const hostId = rows[0].parent_id;
|
|
100
|
+
const serviceId = rows[0].id;
|
|
101
|
+
|
|
102
|
+
return cy.request({
|
|
103
|
+
body: {
|
|
104
|
+
check: {
|
|
105
|
+
is_forced: isForced
|
|
106
|
+
},
|
|
107
|
+
resources: [
|
|
108
|
+
{
|
|
109
|
+
id: serviceId,
|
|
110
|
+
parent: {
|
|
111
|
+
id: hostId
|
|
112
|
+
},
|
|
113
|
+
type: 'service'
|
|
114
|
+
}
|
|
115
|
+
]
|
|
116
|
+
},
|
|
117
|
+
method: 'POST',
|
|
118
|
+
timeout: 30000,
|
|
119
|
+
url: '/centreon/api/latest/monitoring/resources/check'
|
|
120
|
+
}).then((response) => {
|
|
121
|
+
expect(response.status).to.eq(204);
|
|
122
|
+
|
|
123
|
+
return cy.wrap(null);
|
|
124
|
+
});
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
);
|
|
128
|
+
|
|
129
|
+
|
|
24
130
|
interface SubmitResult {
|
|
25
131
|
host: string;
|
|
26
132
|
output: string;
|
|
@@ -108,6 +214,8 @@ Cypress.Commands.add(
|
|
|
108
214
|
declare global {
|
|
109
215
|
namespace Cypress {
|
|
110
216
|
interface Chainable {
|
|
217
|
+
scheduleHostCheck: (hostCheck) => Cypress.Chainable;
|
|
218
|
+
scheduleServiceCheck: (serviceCheck) => Cypress.Chainable;
|
|
111
219
|
submitResults: (props: Array<SubmitResult>) => Cypress.Chainable;
|
|
112
220
|
waitForDowntime: (downtime: Downtime) => Cypress.Chainable;
|
|
113
221
|
}
|
package/cypress/e2e/commands.ts
CHANGED
|
@@ -312,6 +312,10 @@ interface ExecInContainerProps {
|
|
|
312
312
|
name: string;
|
|
313
313
|
}
|
|
314
314
|
|
|
315
|
+
interface ExecInContainerOptions {
|
|
316
|
+
log: boolean;
|
|
317
|
+
}
|
|
318
|
+
|
|
315
319
|
interface ExecInContainerResult {
|
|
316
320
|
exitCode: number;
|
|
317
321
|
output: string;
|
|
@@ -319,7 +323,7 @@ interface ExecInContainerResult {
|
|
|
319
323
|
|
|
320
324
|
Cypress.Commands.add(
|
|
321
325
|
'execInContainer',
|
|
322
|
-
({ command, name }:
|
|
326
|
+
({ command, name }, { log = true } = { log: true }): Cypress.Chainable => {
|
|
323
327
|
const commands =
|
|
324
328
|
typeof command === 'string' || command instanceof String
|
|
325
329
|
? [command]
|
|
@@ -330,19 +334,22 @@ Cypress.Commands.add(
|
|
|
330
334
|
cy.task<ExecInContainerResult>(
|
|
331
335
|
'execInContainer',
|
|
332
336
|
{ command: runCommand, name },
|
|
333
|
-
{ timeout: 600000 }
|
|
337
|
+
{ log, timeout: 600000 }
|
|
334
338
|
).then((result) => {
|
|
339
|
+
const displayedOutput = log ? result.output : 'hidden command output';
|
|
340
|
+
const displayedRunCommand = log ? runCommand : 'hidden run command';
|
|
341
|
+
|
|
335
342
|
if (result.exitCode) {
|
|
336
|
-
cy.log(
|
|
343
|
+
cy.log(displayedOutput);
|
|
337
344
|
|
|
338
345
|
// output will not be truncated
|
|
339
346
|
throw new Error(`
|
|
340
|
-
Execution of "${
|
|
347
|
+
Execution of "${displayedRunCommand}" failed
|
|
341
348
|
Exit code: ${result.exitCode}
|
|
342
|
-
Output:\n${
|
|
349
|
+
Output:\n${displayedOutput}`);
|
|
343
350
|
}
|
|
344
351
|
|
|
345
|
-
acc.output = `${acc.output}${
|
|
352
|
+
acc.output = `${acc.output}${displayedOutput}`;
|
|
346
353
|
});
|
|
347
354
|
|
|
348
355
|
return acc;
|
|
@@ -778,10 +785,10 @@ declare global {
|
|
|
778
785
|
options?: Partial<Cypress.ExecOptions>
|
|
779
786
|
) => Cypress.Chainable;
|
|
780
787
|
createDirectory: (directoryPath: string) => Cypress.Chainable;
|
|
781
|
-
execInContainer: (
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
788
|
+
execInContainer: (
|
|
789
|
+
props: ExecInContainerProps,
|
|
790
|
+
options?: ExecInContainerOptions
|
|
791
|
+
) => Cypress.Chainable;
|
|
785
792
|
getByLabel: ({
|
|
786
793
|
patternType,
|
|
787
794
|
tag,
|
|
@@ -64,6 +64,7 @@ export default ({
|
|
|
64
64
|
DATABASE_IMAGE: 'bitnami/mariadb:10.11',
|
|
65
65
|
OPENID_IMAGE_VERSION: process.env.MAJOR || '24.04',
|
|
66
66
|
SAML_IMAGE_VERSION: process.env.MAJOR || '24.04',
|
|
67
|
+
STABILITY: 'unstable',
|
|
67
68
|
WEB_IMAGE_OS: 'alma9',
|
|
68
69
|
WEB_IMAGE_VERSION: webImageVersion
|
|
69
70
|
},
|
package/cypress/e2e/plugins.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@centreon/js-config",
|
|
3
3
|
"description": "Centreon Frontend shared build configuration",
|
|
4
|
-
"version": "24.
|
|
4
|
+
"version": "24.9.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/centreon/centreon-frontend.git"
|
|
@@ -21,17 +21,17 @@
|
|
|
21
21
|
"prettier": "^3.0.0"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@badeball/cypress-cucumber-preprocessor": "^20.
|
|
25
|
-
"@bahmutov/cypress-esbuild-preprocessor": "^2.2.
|
|
24
|
+
"@badeball/cypress-cucumber-preprocessor": "^20.1.2",
|
|
25
|
+
"@bahmutov/cypress-esbuild-preprocessor": "^2.2.2",
|
|
26
26
|
"@esbuild-plugins/node-globals-polyfill": "^0.2.3",
|
|
27
27
|
"@esbuild-plugins/node-modules-polyfill": "^0.2.2",
|
|
28
28
|
"@tsconfig/node16": "^16.1.3",
|
|
29
29
|
"@tsconfig/node20": "^20.1.4",
|
|
30
30
|
"@types/cypress-cucumber-preprocessor": "^4.0.5",
|
|
31
|
-
"cypress": "^13.
|
|
31
|
+
"cypress": "^13.13.3",
|
|
32
32
|
"cypress-multi-reporters": "^1.6.4",
|
|
33
|
-
"cypress-terminal-report": "^6.1.
|
|
34
|
-
"cypress-wait-until": "^3.0.
|
|
33
|
+
"cypress-terminal-report": "^6.1.2",
|
|
34
|
+
"cypress-wait-until": "^3.0.2",
|
|
35
35
|
"dotenv": "^16.4.5",
|
|
36
36
|
"esbuild": "^0.21.5",
|
|
37
37
|
"eslint": "^8.53.0",
|
|
@@ -52,8 +52,8 @@
|
|
|
52
52
|
"eslint-plugin-sort-keys-fix": "^1.1.2",
|
|
53
53
|
"eslint-plugin-typescript-sort-keys": "^2.1.0",
|
|
54
54
|
"mochawesome": "^7.1.3",
|
|
55
|
-
"mysql2": "^3.
|
|
55
|
+
"mysql2": "^3.11.0",
|
|
56
56
|
"tar-fs": "^3.0.6",
|
|
57
|
-
"testcontainers": "^10.
|
|
57
|
+
"testcontainers": "^10.11.0"
|
|
58
58
|
}
|
|
59
59
|
}
|