Skip to content

Commit eab5e74

Browse files
upcoming: [M3-10523] - Fix and extend ACLP-supported region Linode mock examples (linode#12747)
* Correct ACLP-supported region Linode mocks * Add example 3 in the mocks * Add comments * Added changeset: Fix and extend ACLP-supported region Linode mock examples
1 parent 2f35c4a commit eab5e74

File tree

2 files changed

+62
-3
lines changed

2 files changed

+62
-3
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@linode/manager": Upcoming Features
3+
---
4+
5+
Fix and extend ACLP-supported region Linode mock examples ([#12747](https://github.com/linode/manager/pull/12747))

packages/manager/src/mocks/serverHandlers.ts

Lines changed: 57 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -813,6 +813,11 @@ export const handlers = [
813813
region: 'us-east',
814814
id: 1005,
815815
}),
816+
linodeFactory.build({
817+
label: 'aclp-supported-region-linode-3',
818+
region: 'us-iad',
819+
id: 1006,
820+
}),
816821
];
817822
const linodes = [
818823
...mtcLinodes,
@@ -939,19 +944,58 @@ export const handlers = [
939944
}),
940945
];
941946
const linodeAclpSupportedRegionDetails = [
947+
/** Whether a Linode is ACLP-subscribed can be determined using the useIsLinodeAclpSubscribed hook. */
948+
949+
// 1. Example: ACLP-subscribed Linode in an ACLP-supported region (mock Linode ID: 1004)
942950
linodeFactory.build({
943951
id,
944952
backups: { enabled: false },
945953
label: 'aclp-supported-region-linode-1',
946954
region: 'us-iad',
947-
alerts: { user: [100, 101], system: [200] },
955+
alerts: {
956+
user: [21, 22, 23, 24, 25],
957+
system: [19, 20],
958+
cpu: 0,
959+
io: 0,
960+
network_in: 0,
961+
network_out: 0,
962+
transfer_quota: 0,
963+
},
948964
}),
965+
// 2. Example: Linode not subscribed to ACLP in an ACLP-supported region (mock Linode ID: 1005)
949966
linodeFactory.build({
950967
id,
951968
backups: { enabled: false },
952969
label: 'aclp-supported-region-linode-2',
953970
region: 'us-east',
954-
alerts: { user: [], system: [] },
971+
alerts: {
972+
user: [],
973+
system: [],
974+
cpu: 10,
975+
io: 10000,
976+
network_in: 0,
977+
network_out: 0,
978+
transfer_quota: 80,
979+
},
980+
}),
981+
// 3. Example: Linode in an ACLP-supported region with NO enabled alerts (mock Linode ID: 1006)
982+
// - Whether this Linode is ACLP-subscribed depends on the ACLP release stage:
983+
// a. Beta stage: NOT subscribed to ACLP
984+
// b. GA stage: Subscribed to ACLP
985+
linodeFactory.build({
986+
id,
987+
backups: { enabled: false },
988+
label: 'aclp-supported-region-linode-3',
989+
region: 'us-iad',
990+
alerts: {
991+
user: [],
992+
system: [],
993+
cpu: 0,
994+
io: 0,
995+
network_in: 0,
996+
network_out: 0,
997+
transfer_quota: 0,
998+
},
955999
}),
9561000
];
9571001
const linodeNonMTCPlanInMTCSupportedRegionsDetail = linodeFactory.build({
@@ -986,6 +1030,8 @@ export const handlers = [
9861030
return linodeAclpSupportedRegionDetails[0];
9871031
case 1005:
9881032
return linodeAclpSupportedRegionDetails[1];
1033+
case 1006:
1034+
return linodeAclpSupportedRegionDetails[2];
9891035
default:
9901036
return linodeDetail;
9911037
}
@@ -2733,11 +2779,19 @@ export const handlers = [
27332779
alertFactory.resetSequenceNumber();
27342780
return HttpResponse.json({
27352781
data: [
2736-
...alertFactory.buildList(20, {
2782+
...alertFactory.buildList(18, {
2783+
rule_criteria: {
2784+
rules: alertRulesFactory.buildList(2),
2785+
},
2786+
service_type: serviceType === 'dbaas' ? 'dbaas' : 'linode',
2787+
}),
2788+
// Mocked 2 alert definitions associated with mock Linode ID '1004' (aclp-supported-region-linode-1)
2789+
...alertFactory.buildList(2, {
27372790
rule_criteria: {
27382791
rules: alertRulesFactory.buildList(2),
27392792
},
27402793
service_type: serviceType === 'dbaas' ? 'dbaas' : 'linode',
2794+
entity_ids: ['1004'],
27412795
}),
27422796
...alertFactory.buildList(6, {
27432797
service_type: serviceType === 'dbaas' ? 'dbaas' : 'linode',

0 commit comments

Comments
 (0)