|
1 | | -import CustomCheck from "@/resources/CustomCheck"; |
2 | 1 | import { SetupFactoryOptions } from "../driver"; |
| 2 | +import CustomCheck from "@/resources/CustomCheck"; |
| 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 | +}; |
| 15 | + |
| 16 | +export const hasCustomChecksFailing = ({ driver }: SetupFactoryOptions) => { |
| 17 | + const serviceControlInstanceUrl = window.defaultConfig.service_control_url; |
| 18 | + driver.mockEndpoint(`${serviceControlInstanceUrl}customchecks`, { |
| 19 | + body: [ |
| 20 | + <CustomCheck>{ |
| 21 | + id: "CustomChecks/6131fa95-9414-1898-9c83-c5b18587945b", |
| 22 | + custom_check_id: "Audit Message Ingestion", |
| 23 | + category: "ServiceControl.Audit Health", |
| 24 | + status: "Fail", |
| 25 | + failure_reason: "I dont know the reason", |
| 26 | + reported_at: "2025-01-10T05:06:30.4074087Z", |
| 27 | + originating_endpoint: { |
| 28 | + name: "Particular.ServiceControl.Audit", |
| 29 | + host_id: "ff605b55-6fbb-af56-5753-73c1ff73e601", |
| 30 | + host: "COMPUSA", |
| 31 | + }, |
| 32 | + }, |
| 33 | + { |
| 34 | + id: "CustomChecks/36752f09-8a72-752e-e48f-6c378329d43b", |
| 35 | + custom_check_id: "Error Message Ingestion", |
| 36 | + category: "ServiceControl Health", |
| 37 | + status: "Fail", |
| 38 | + failure_reason: "I am unable to ingest error messages", |
| 39 | + reported_at: "2025-01-10T05:42:00.531067Z", |
| 40 | + originating_endpoint: { |
| 41 | + name: "Particular.ServiceControl", |
| 42 | + host_id: "9f822d11-b097-a4df-3db5-e069e5d356fe", |
| 43 | + host: "COMPUSA", |
| 44 | + }, |
| 45 | + }, |
| 46 | + { |
| 47 | + id: "CustomChecks/93b62dc3-e1bf-abfd-4268-8d36fef2b0c6", |
| 48 | + custom_check_id: "ServiceControl database", |
| 49 | + category: "Storage space", |
| 50 | + status: "Fail", |
| 51 | + failure_reason: "I dont have enough storage", |
| 52 | + reported_at: "2025-01-10T05:52:03.8512021Z", |
| 53 | + originating_endpoint: { |
| 54 | + name: "Particular.ServiceControl", |
| 55 | + host_id: "9f822d11-b097-a4df-3db5-e069e5d356fe", |
| 56 | + host: "COMPUSA", |
| 57 | + }, |
| 58 | + }, |
| 59 | + { |
| 60 | + id: "CustomChecks/7e09172e-7c59-9a0c-52da-e2ecc1784e15", |
| 61 | + custom_check_id: "Saga Audit Configuration", |
| 62 | + category: "Configuration", |
| 63 | + status: "Fail", |
| 64 | + failure_reason: "There is something wrong in Saga Audit configuration", |
| 65 | + reported_at: "2025-01-10T05:52:03.850927Z", |
| 66 | + originating_endpoint: { |
| 67 | + name: "Particular.ServiceControl", |
| 68 | + host_id: "9f822d11-b097-a4df-3db5-e069e5d356fe", |
| 69 | + host: "COMPUSA", |
| 70 | + }, |
| 71 | + }, |
| 72 | + { |
| 73 | + id: "CustomChecks/4dc66bce-632b-5404-bc3d-e1943d99c301", |
| 74 | + custom_check_id: "Error Database Index Lag", |
| 75 | + category: "ServiceControl Health", |
| 76 | + status: "Fail", |
| 77 | + failure_reason: "There is an index lag", |
| 78 | + reported_at: "2025-01-10T05:52:05.8153025Z", |
| 79 | + originating_endpoint: { |
| 80 | + name: "Particular.ServiceControl", |
| 81 | + host_id: "9f822d11-b097-a4df-3db5-e069e5d356fe", |
| 82 | + host: "COMPUSA", |
| 83 | + }, |
| 84 | + }, |
| 85 | + { |
| 86 | + id: "CustomChecks/66675ab0-b69a-6a5a-6a56-da7709464fba", |
| 87 | + custom_check_id: "Message Ingestion Process", |
| 88 | + category: "ServiceControl Health", |
| 89 | + status: "Fail", |
| 90 | + failure_reason: "Unable to ingest messages", |
| 91 | + reported_at: "2025-01-10T05:52:29.398929Z", |
| 92 | + originating_endpoint: { |
| 93 | + name: "Particular.ServiceControl", |
| 94 | + host_id: "9f822d11-b097-a4df-3db5-e069e5d356fe", |
| 95 | + host: "COMPUSA", |
| 96 | + }, |
| 97 | + }, |
| 98 | + { |
| 99 | + id: "CustomChecks/418dafe7-1dd2-886b-65d1-2b3e71e4feb2", |
| 100 | + custom_check_id: "Error Message Ingestion Process", |
| 101 | + category: "ServiceControl Health", |
| 102 | + status: "Fail", |
| 103 | + failure_reason: "I dont know the reason", |
| 104 | + reported_at: "2025-01-10T05:52:29.3984912Z", |
| 105 | + originating_endpoint: { |
| 106 | + name: "Particular.ServiceControl", |
| 107 | + host_id: "9f822d11-b097-a4df-3db5-e069e5d356fe", |
| 108 | + host: "COMPUSA", |
| 109 | + }, |
| 110 | + }, |
| 111 | + { |
| 112 | + id: "CustomChecks/a406f1a7-412c-dd2c-7f90-9aa32da0698b", |
| 113 | + custom_check_id: "Audit Message Ingestion Process", |
| 114 | + category: "ServiceControl Health", |
| 115 | + status: "Fail", |
| 116 | + failure_reason: "I dont know the reason for Audit Message Ingestion failure", |
| 117 | + reported_at: "2025-01-10T05:52:31.4929675Z", |
| 118 | + originating_endpoint: { |
| 119 | + name: "Particular.ServiceControl.Audit", |
| 120 | + host_id: "ff605b55-6fbb-af56-5753-73c1ff73e601", |
| 121 | + host: "COMPUSA", |
| 122 | + }, |
| 123 | + }, |
| 124 | + ], |
| 125 | + headers: { |
| 126 | + "Total-Count": "8", //count of failing custom checks |
| 127 | + }, |
| 128 | + }); |
| 129 | +}; |
3 | 130 |
|
4 | 131 | export const hasCustomChecksPassing = ({ driver }: SetupFactoryOptions) => { |
5 | 132 | const serviceControlInstanceUrl = window.defaultConfig.service_control_url; |
|
0 commit comments