Skip to content

Commit 56aef1b

Browse files
committed
wip : add mocks for custom checks data, add test to check for "no failed custom checks message" -
1 parent 3f810b0 commit 56aef1b

File tree

12 files changed

+370
-220
lines changed

12 files changed

+370
-220
lines changed

src/Frontend/src/components/heartbeats/serviceControlWithHeartbeats.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export const serviceControlWithHeartbeats = async ({ driver }: SetupFactoryOptio
66
await driver.setUp(precondition.hasUpToDateServicePulse);
77
await driver.setUp(precondition.hasUpToDateServiceControl);
88
await driver.setUp(precondition.errorsDefaultHandler);
9-
await driver.setUp(precondition.hasNoFailingCustomChecks);
9+
await driver.setUp(precondition.hasCustomChecksEmpty);
1010
await driver.setUp(precondition.hasEventLogItems);
1111
await driver.setUp(precondition.hasServiceControlMainInstance(minimumSCVersionForEndpointSettings));
1212
await driver.setUp(precondition.hasNoDisconnectedEndpoints);

src/Frontend/src/views/CustomChecksView.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const { pageNumber, failingCount, failedChecks } = storeToRefs(store);
1919
</div>
2020

2121
<section name="custom_checks">
22-
<NoData v-if="failingCount === 0" message="No failed custom checks" />
22+
<NoData v-if="failingCount === 0" message="No failed custom checks" role="heading" aria-label="customcheck-message" />
2323
<div v-else class="row">
2424
<div class="col-sm-12">
2525
<CustomCheckView v-for="item of failedChecks" :key="item.id" :custom-check="item" />

src/Frontend/src/views/throughputreport/serviceControlWithThroughput.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export const serviceControlWithThroughput = async ({ driver }: SetupFactoryOptio
66
await driver.setUp(precondition.hasUpToDateServicePulse);
77
await driver.setUp(precondition.hasUpToDateServiceControl);
88
await driver.setUp(precondition.errorsDefaultHandler);
9-
await driver.setUp(precondition.hasNoFailingCustomChecks);
9+
await driver.setUp(precondition.hasCustomChecksEmpty);
1010
await driver.setUp(precondition.hasEventLogItems);
1111
await driver.setUp(precondition.hasNoHeartbeatsEndpoints);
1212
await driver.setUp(precondition.hasServiceControlMainInstance(minimumSCVersionForThroughput));

src/Frontend/test/mocks/browser.ts

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -25,23 +25,23 @@ const driver = makeDriver();
2525
(async () => {
2626
await driver.setUp(precondition.serviceControlWithMonitoring);
2727
//override the default mocked endpoints with a custom list
28-
await driver.setUp(precondition.hasNoFailingCustomChecks);
29-
// await driver.setUp(
30-
// precondition.monitoredEndpointsNamed([
31-
// "Universe.Solarsystem.Mercury.Endpoint1",
32-
// "Universe.Solarsystem.Mercury.Endpoint2",
33-
// "Universe.Solarsystem.Venus.Endpoint3",
34-
// "Universe.Solarsystem.Venus.Endpoint4",
35-
// "Universe.Solarsystem.Earth.Endpoint5",
36-
// "Universe.Solarsystem.Earth.Endpoint6",
37-
// ])
38-
// );
39-
// await driver.setUp(
40-
// precondition.hasFailedMessage({
41-
// withGroupId: "81dca64e-76fc-e1c3-11a2-3069f51c58c8",
42-
// withMessageId: "40134401-bab9-41aa-9acb-b19c0066f22d",
43-
// withContentType: "application/json",
44-
// withBody: { Index: 0, Data: "" },
45-
// })
46-
// );
28+
await driver.setUp(precondition.hasCustomChecksEmpty);
29+
await driver.setUp(
30+
precondition.monitoredEndpointsNamed([
31+
"Universe.Solarsystem.Mercury.Endpoint1",
32+
"Universe.Solarsystem.Mercury.Endpoint2",
33+
"Universe.Solarsystem.Venus.Endpoint3",
34+
"Universe.Solarsystem.Venus.Endpoint4",
35+
"Universe.Solarsystem.Earth.Endpoint5",
36+
"Universe.Solarsystem.Earth.Endpoint6",
37+
])
38+
);
39+
await driver.setUp(
40+
precondition.hasFailedMessage({
41+
withGroupId: "81dca64e-76fc-e1c3-11a2-3069f51c58c8",
42+
withMessageId: "40134401-bab9-41aa-9acb-b19c0066f22d",
43+
withContentType: "application/json",
44+
withBody: { Index: 0, Data: "" },
45+
})
46+
);
4747
})();
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//import CustomCheck from "@/resources/CustomCheck";
2+
import { SetupFactoryOptions } from "../driver";
3+
4+
const content = JSON.stringify([]);
5+
6+
export const hasCustomChecksEmpty = ({ driver }: SetupFactoryOptions) => {
7+
const serviceControlInstanceUrl = window.defaultConfig.service_control_url;
8+
driver.mockEndpoint(`${serviceControlInstanceUrl}customchecks`, {
9+
body: content,
10+
headers: {
11+
"Total-Count": "0", //count of failing custom checks
12+
},
13+
});
14+
};
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
import CustomCheck from "@/resources/CustomCheck";
2+
import { SetupFactoryOptions } from "../driver";
3+
4+
export const hasCustomChecksFailing = ({ driver }: SetupFactoryOptions) => {
5+
const serviceControlInstanceUrl = window.defaultConfig.service_control_url;
6+
driver.mockEndpoint(`${serviceControlInstanceUrl}customchecks`, {
7+
body: [
8+
<CustomCheck>{
9+
id: "CustomChecks/6131fa95-9414-1898-9c83-c5b18587945b",
10+
custom_check_id: "Audit Message Ingestion",
11+
category: "ServiceControl.Audit Health",
12+
status: "Fail",
13+
failure_reason: "I dont know the reason",
14+
reported_at: "2025-01-10T05:06:30.4074087Z",
15+
originating_endpoint: {
16+
name: "Particular.ServiceControl.Audit",
17+
host_id: "ff605b55-6fbb-af56-5753-73c1ff73e601",
18+
host: "COMPUSA-LAPTOP",
19+
},
20+
},
21+
{
22+
id: "CustomChecks/36752f09-8a72-752e-e48f-6c378329d43b",
23+
custom_check_id: "Error Message Ingestion",
24+
category: "ServiceControl Health",
25+
status: "Fail",
26+
failure_reason: "I am unable to ingest error messages",
27+
reported_at: "2025-01-10T05:42:00.531067Z",
28+
originating_endpoint: {
29+
name: "Particular.ServiceControl",
30+
host_id: "9f822d11-b097-a4df-3db5-e069e5d356fe",
31+
host: "COMPUSA-LAPTOP",
32+
},
33+
},
34+
{
35+
id: "CustomChecks/93b62dc3-e1bf-abfd-4268-8d36fef2b0c6",
36+
custom_check_id: "ServiceControl database",
37+
category: "Storage space",
38+
status: "Fail",
39+
failure_reason: "I dont have enough storage",
40+
reported_at: "2025-01-10T05:52:03.8512021Z",
41+
originating_endpoint: {
42+
name: "Particular.ServiceControl",
43+
host_id: "9f822d11-b097-a4df-3db5-e069e5d356fe",
44+
host: "COMPUSA-LAPTOP",
45+
},
46+
},
47+
{
48+
id: "CustomChecks/7e09172e-7c59-9a0c-52da-e2ecc1784e15",
49+
custom_check_id: "Saga Audit Configuration",
50+
category: "Configuration",
51+
status: "Fail",
52+
failure_reason: "There is something wrong in Saga Audit configuration",
53+
reported_at: "2025-01-10T05:52:03.850927Z",
54+
originating_endpoint: {
55+
name: "Particular.ServiceControl",
56+
host_id: "9f822d11-b097-a4df-3db5-e069e5d356fe",
57+
host: "COMPUSA-LAPTOP",
58+
},
59+
},
60+
{
61+
id: "CustomChecks/4dc66bce-632b-5404-bc3d-e1943d99c301",
62+
custom_check_id: "Error Database Index Lag",
63+
category: "ServiceControl Health",
64+
status: "Fail",
65+
failure_reason: "There is an index lag",
66+
reported_at: "2025-01-10T05:52:05.8153025Z",
67+
originating_endpoint: {
68+
name: "Particular.ServiceControl",
69+
host_id: "9f822d11-b097-a4df-3db5-e069e5d356fe",
70+
host: "COMPUSA-LAPTOP",
71+
},
72+
},
73+
{
74+
id: "CustomChecks/66675ab0-b69a-6a5a-6a56-da7709464fba",
75+
custom_check_id: "Message Ingestion Process",
76+
category: "ServiceControl Health",
77+
status: "Fail",
78+
failure_reason: "Unable to ingest messages",
79+
reported_at: "2025-01-10T05:52:29.398929Z",
80+
originating_endpoint: {
81+
name: "Particular.ServiceControl",
82+
host_id: "9f822d11-b097-a4df-3db5-e069e5d356fe",
83+
host: "COMPUSA-LAPTOP",
84+
},
85+
},
86+
{
87+
id: "CustomChecks/418dafe7-1dd2-886b-65d1-2b3e71e4feb2",
88+
custom_check_id: "Error Message Ingestion Process",
89+
category: "ServiceControl Health",
90+
status: "Fail",
91+
failure_reason: "I dont know the reason",
92+
reported_at: "2025-01-10T05:52:29.3984912Z",
93+
originating_endpoint: {
94+
name: "Particular.ServiceControl",
95+
host_id: "9f822d11-b097-a4df-3db5-e069e5d356fe",
96+
host: "COMPUSA-LAPTOP",
97+
},
98+
},
99+
{
100+
id: "CustomChecks/a406f1a7-412c-dd2c-7f90-9aa32da0698b",
101+
custom_check_id: "Audit Message Ingestion Process",
102+
category: "ServiceControl Health",
103+
status: "Fail",
104+
failure_reason: "I dont know the reason for Audit Message Ingestion failure",
105+
reported_at: "2025-01-10T05:52:31.4929675Z",
106+
originating_endpoint: {
107+
name: "Particular.ServiceControl.Audit",
108+
host_id: "ff605b55-6fbb-af56-5753-73c1ff73e601",
109+
host: "COMPUSA-LAPTOP",
110+
},
111+
},
112+
],
113+
headers: {
114+
"Total-Count": "8", //count of failing custom checks
115+
},
116+
});
117+
};
Lines changed: 169 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
1+
import CustomCheck from "@/resources/CustomCheck";
2+
import { SetupFactoryOptions } from "../driver";
3+
4+
export const hasCustomChecksPassing = ({ driver }: SetupFactoryOptions) => {
5+
const serviceControlInstanceUrl = window.defaultConfig.service_control_url;
6+
driver.mockEndpoint(`${serviceControlInstanceUrl}customchecks`, {
7+
body: [
8+
<CustomCheck>{
9+
id: "CustomChecks/6131fa95-9414-1898-9c83-c5b18587945b",
10+
custom_check_id: "Audit Message Ingestion",
11+
category: "ServiceControl.Audit Health",
12+
status: "Pass",
13+
reported_at: "2025-01-10T05:06:30.4074087Z",
14+
originating_endpoint: {
15+
name: "Particular.ServiceControl.Audit",
16+
host_id: "ff605b55-6fbb-af56-5753-73c1ff73e601",
17+
host: "COMPUSA-LAPTOP",
18+
},
19+
},
20+
{
21+
id: "CustomChecks/36752f09-8a72-752e-e48f-6c378329d43b",
22+
custom_check_id: "Error Message Ingestion",
23+
category: "ServiceControl Health",
24+
status: "Pass",
25+
reported_at: "2025-01-10T05:42:00.531067Z",
26+
originating_endpoint: {
27+
name: "Particular.ServiceControl",
28+
host_id: "9f822d11-b097-a4df-3db5-e069e5d356fe",
29+
host: "COMPUSA-LAPTOP",
30+
},
31+
},
32+
{
33+
id: "CustomChecks/02564a68-8c3e-92f6-d977-ce45d7ce46ed",
34+
custom_check_id: "ServiceControl.Audit database",
35+
category: "Storage space",
36+
status: "Pass",
37+
reported_at: "2025-01-10T05:51:44.4635095Z",
38+
originating_endpoint: {
39+
name: "Particular.ServiceControl.Audit",
40+
host_id: "ff605b55-6fbb-af56-5753-73c1ff73e601",
41+
host: "COMPUSA-LAPTOP",
42+
},
43+
},
44+
{
45+
id: "CustomChecks/5443ee67-c22a-521f-5dc1-b979f831151a",
46+
custom_check_id: "Audit Database Index Lag",
47+
category: "ServiceControl.Audit Health",
48+
status: "Pass",
49+
reported_at: "2025-01-10T05:51:47.7264687Z",
50+
originating_endpoint: {
51+
name: "Particular.ServiceControl.Audit",
52+
host_id: "ff605b55-6fbb-af56-5753-73c1ff73e601",
53+
host: "COMPUSA-LAPTOP",
54+
},
55+
},
56+
{
57+
id: "CustomChecks/93b62dc3-e1bf-abfd-4268-8d36fef2b0c6",
58+
custom_check_id: "ServiceControl database",
59+
category: "Storage space",
60+
status: "Pass",
61+
reported_at: "2025-01-10T05:52:03.8512021Z",
62+
originating_endpoint: {
63+
name: "Particular.ServiceControl",
64+
host_id: "9f822d11-b097-a4df-3db5-e069e5d356fe",
65+
host: "COMPUSA-LAPTOP",
66+
},
67+
},
68+
{
69+
id: "CustomChecks/7e09172e-7c59-9a0c-52da-e2ecc1784e15",
70+
custom_check_id: "Saga Audit Configuration",
71+
category: "Configuration",
72+
status: "Pass",
73+
reported_at: "2025-01-10T05:52:03.850927Z",
74+
originating_endpoint: {
75+
name: "Particular.ServiceControl",
76+
host_id: "9f822d11-b097-a4df-3db5-e069e5d356fe",
77+
host: "COMPUSA-LAPTOP",
78+
},
79+
},
80+
{
81+
id: "CustomChecks/7940dbbf-3019-cb8a-3add-b9ff9c57edb7",
82+
custom_check_id: "Error Database Index Errors",
83+
category: "ServiceControl Health",
84+
status: "Pass",
85+
reported_at: "2025-01-10T05:52:03.8522051Z",
86+
originating_endpoint: {
87+
name: "Particular.ServiceControl",
88+
host_id: "9f822d11-b097-a4df-3db5-e069e5d356fe",
89+
host: "COMPUSA-LAPTOP",
90+
},
91+
},
92+
{
93+
id: "CustomChecks/4dc66bce-632b-5404-bc3d-e1943d99c301",
94+
custom_check_id: "Error Database Index Lag",
95+
category: "ServiceControl Health",
96+
status: "Pass",
97+
reported_at: "2025-01-10T05:52:05.8153025Z",
98+
originating_endpoint: {
99+
name: "Particular.ServiceControl",
100+
host_id: "9f822d11-b097-a4df-3db5-e069e5d356fe",
101+
host: "COMPUSA-LAPTOP",
102+
},
103+
},
104+
{
105+
id: "CustomChecks/3eab20ba-3c24-b354-d298-aae5412c0125",
106+
custom_check_id: "ServiceControl Remotes",
107+
category: "Health",
108+
status: "Pass",
109+
reported_at: "2025-01-10T05:52:10.1360722Z",
110+
originating_endpoint: {
111+
name: "Particular.ServiceControl",
112+
host_id: "9f822d11-b097-a4df-3db5-e069e5d356fe",
113+
host: "COMPUSA-LAPTOP",
114+
},
115+
},
116+
{
117+
id: "CustomChecks/c7011287-308f-c7b7-f50a-cca3c3fe17da",
118+
custom_check_id: "ServiceControl Primary Instance",
119+
category: "Health",
120+
status: "Pass",
121+
reported_at: "2025-01-10T05:52:18.4970695Z",
122+
originating_endpoint: {
123+
name: "Particular.ServiceControl",
124+
host_id: "9f822d11-b097-a4df-3db5-e069e5d356fe",
125+
host: "COMPUSA-LAPTOP",
126+
},
127+
},
128+
{
129+
id: "CustomChecks/66675ab0-b69a-6a5a-6a56-da7709464fba",
130+
custom_check_id: "Message Ingestion Process",
131+
category: "ServiceControl Health",
132+
status: "Pass",
133+
reported_at: "2025-01-10T05:52:29.398929Z",
134+
originating_endpoint: {
135+
name: "Particular.ServiceControl",
136+
host_id: "9f822d11-b097-a4df-3db5-e069e5d356fe",
137+
host: "COMPUSA-LAPTOP",
138+
},
139+
},
140+
{
141+
id: "CustomChecks/418dafe7-1dd2-886b-65d1-2b3e71e4feb2",
142+
custom_check_id: "Error Message Ingestion Process",
143+
category: "ServiceControl Health",
144+
status: "Pass",
145+
reported_at: "2025-01-10T05:52:29.3984912Z",
146+
originating_endpoint: {
147+
name: "Particular.ServiceControl",
148+
host_id: "9f822d11-b097-a4df-3db5-e069e5d356fe",
149+
host: "COMPUSA-LAPTOP",
150+
},
151+
},
152+
{
153+
id: "CustomChecks/a406f1a7-412c-dd2c-7f90-9aa32da0698b",
154+
custom_check_id: "Audit Message Ingestion Process",
155+
category: "ServiceControl Health",
156+
status: "Pass",
157+
reported_at: "2025-01-10T05:52:31.4929675Z",
158+
originating_endpoint: {
159+
name: "Particular.ServiceControl.Audit",
160+
host_id: "ff605b55-6fbb-af56-5753-73c1ff73e601",
161+
host: "COMPUSA-LAPTOP",
162+
},
163+
},
164+
],
165+
headers: {
166+
"Total-Count": "0", //count of failing custom checks
167+
},
168+
});
169+
};

0 commit comments

Comments
 (0)