@centreon/js-config 25.10.0 â 25.10.1
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.
- package/cypress/e2e/commands.ts +2 -2
- package/cypress/e2e/tasks.ts +13 -31
- package/package.json +1 -1
package/cypress/e2e/commands.ts
CHANGED
|
@@ -554,8 +554,8 @@ Cypress.Commands.add(
|
|
|
554
554
|
cy.log(`Getting logs from container ${name} ...`);
|
|
555
555
|
|
|
556
556
|
return cy.getLogDirectory().then((logDirectory) => {
|
|
557
|
-
let sourcePhpLogs = '/var/log/php8.
|
|
558
|
-
let targetPhpLogs = `${logDirectory}/php8.
|
|
557
|
+
let sourcePhpLogs = '/var/log/php8.2-fpm-centreon-error.log';
|
|
558
|
+
let targetPhpLogs = `${logDirectory}/php8.2-fpm-centreon-error.log`;
|
|
559
559
|
let sourceApacheLogs = '/var/log/apache2';
|
|
560
560
|
let targetApacheLogs = `${logDirectory}/apache2`;
|
|
561
561
|
if (Cypress.env('WEB_IMAGE_OS').includes('alma')) {
|
package/cypress/e2e/tasks.ts
CHANGED
|
@@ -19,6 +19,13 @@ interface Containers {
|
|
|
19
19
|
[key: string]: StartedTestContainer;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
class NotFoundContainerError extends Error {
|
|
23
|
+
constructor(message) {
|
|
24
|
+
super(message);
|
|
25
|
+
this.name = 'NotFoundContainerError';
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
22
29
|
export default (on: Cypress.PluginEvents): void => {
|
|
23
30
|
let dockerEnvironment: StartedDockerComposeEnvironment | null = null;
|
|
24
31
|
const containers: Containers = {};
|
|
@@ -31,7 +38,7 @@ export default (on: Cypress.PluginEvents): void => {
|
|
|
31
38
|
} else if (containers[containerName]) {
|
|
32
39
|
container = containers[containerName];
|
|
33
40
|
} else {
|
|
34
|
-
throw new
|
|
41
|
+
throw new NotFoundContainerError(`Cannot get container ${containerName}`);
|
|
35
42
|
}
|
|
36
43
|
|
|
37
44
|
return container;
|
|
@@ -54,35 +61,6 @@ export default (on: Cypress.PluginEvents): void => {
|
|
|
54
61
|
}
|
|
55
62
|
|
|
56
63
|
on("task", {
|
|
57
|
-
checkDockerImage: async (params: StartContainerProps) => {
|
|
58
|
-
const { image, name } = params;
|
|
59
|
-
console.log(`đ [checkDockerImage] Checking if image exists: ${image}`);
|
|
60
|
-
|
|
61
|
-
if (!image) {
|
|
62
|
-
console.error("â [checkDockerImage] No image name provided");
|
|
63
|
-
return { exists: false, error: "Image name is undefined" };
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
try {
|
|
67
|
-
execSync(`docker image inspect ${image}`, { stdio: "ignore" });
|
|
68
|
-
console.log(`â
[checkDockerImage] Image already exists locally: ${image}`);
|
|
69
|
-
return { exists: true, image };
|
|
70
|
-
} catch {
|
|
71
|
-
console.log(`âšī¸ [checkDockerImage] Image not found locally, trying to pull...`);
|
|
72
|
-
|
|
73
|
-
try {
|
|
74
|
-
execSync(`docker pull ${image}`, { stdio: "pipe" });
|
|
75
|
-
console.log(`â
[checkDockerImage] Image successfully pulled: ${image}`);
|
|
76
|
-
return { exists: true, image };
|
|
77
|
-
} catch (err: unknown) {
|
|
78
|
-
const errorMessage =
|
|
79
|
-
err instanceof Error ? err.message : JSON.stringify(err);
|
|
80
|
-
console.warn(`â ī¸ [checkDockerImage] Image not found or pull failed: ${errorMessage}`);
|
|
81
|
-
|
|
82
|
-
return { exists: false, error: errorMessage, image };
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
},
|
|
86
64
|
copyFromContainer: async ({ destination, serviceName, source }) => {
|
|
87
65
|
try {
|
|
88
66
|
const container = getContainer(serviceName);
|
|
@@ -97,7 +75,11 @@ export default (on: Cypress.PluginEvents): void => {
|
|
|
97
75
|
});
|
|
98
76
|
});
|
|
99
77
|
} catch (error) {
|
|
100
|
-
|
|
78
|
+
if (error instanceof NotFoundContainerError) {
|
|
79
|
+
console.log(`Cannot get ${source} from container ${serviceName} because it doesn't exist.`);
|
|
80
|
+
} else {
|
|
81
|
+
console.error(error);
|
|
82
|
+
}
|
|
101
83
|
}
|
|
102
84
|
|
|
103
85
|
return null;
|
package/package.json
CHANGED