Skip to content

Commit 264113d

Browse files
update
1 parent f97ae3d commit 264113d

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

test/cdn.test.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -94,24 +94,24 @@ describe("loadFromAzureFrontDoor", function() {
9494
]));
9595

9696
stub.onCall(1).returns(getCachedIterator([
97-
{ items: [kv1, kv2_updated], response: { status: 200, headers: createTimestampHeaders("2025-09-07T00:00:00Z") } }
97+
{ items: [kv1, kv2_updated], response: { status: 200, headers: createTimestampHeaders("2025-09-07T00:00:01Z") } }
9898
]));
9999
stub.onCall(2).returns(getCachedIterator([
100-
{ items: [kv1, kv2_updated], response: { status: 200, headers: createTimestampHeaders("2025-09-07T00:00:00Z") } }
100+
{ items: [kv1, kv2_updated], response: { status: 200, headers: createTimestampHeaders("2025-09-07T00:00:01Z") } }
101101
]));
102102

103103
stub.onCall(3).returns(getCachedIterator([
104-
{ items: [kv1], response: { status: 200, headers: createTimestampHeaders("2025-09-07T00:00:00Z") } }
104+
{ items: [kv1], response: { status: 200, headers: createTimestampHeaders("2025-09-07T00:00:03Z") } }
105105
]));
106106
stub.onCall(4).returns(getCachedIterator([
107-
{ items: [kv1], response: { status: 200, headers: createTimestampHeaders("2025-09-07T00:00:00Z") } }
107+
{ items: [kv1], response: { status: 200, headers: createTimestampHeaders("2025-09-07T00:00:03Z") } }
108108
]));
109109

110110
stub.onCall(5).returns(getCachedIterator([
111-
{ items: [kv1, kv3], response: { status: 200, headers: createTimestampHeaders("2025-09-07T00:00:00Z") } }
111+
{ items: [kv1, kv3], response: { status: 200, headers: createTimestampHeaders("2025-09-07T00:00:05Z") } }
112112
]));
113113
stub.onCall(6).returns(getCachedIterator([
114-
{ items: [kv1, kv3], response: { status: 200, headers: createTimestampHeaders("2025-09-07T00:00:00Z") } }
114+
{ items: [kv1, kv3], response: { status: 200, headers: createTimestampHeaders("2025-09-07T00:00:05Z") } }
115115
]));
116116

117117
const endpoint = createMockedAzureFrontDoorEndpoint();
@@ -121,23 +121,23 @@ describe("loadFromAzureFrontDoor", function() {
121121
enabled: true,
122122
refreshIntervalInMs: 1000
123123
}
124-
});
124+
}); // 1 call listConfigurationSettings
125125

126126
expect(appConfig.get("app.key1")).to.equal("value1");
127127
expect(appConfig.get("app.key2")).to.equal("value2");
128128

129-
await sleepInMs(1000);
130-
await appConfig.refresh();
129+
await sleepInMs(1500); // key2 updated
130+
await appConfig.refresh(); // 1 call listConfigurationSettings for watching changes and 1 call for reloading
131131

132132
expect(appConfig.get("app.key2")).to.equal("value2-updated");
133133

134-
await sleepInMs(1000);
135-
await appConfig.refresh();
134+
await sleepInMs(1500); // key2 deleted
135+
await appConfig.refresh(); // 1 call listConfigurationSettings for watching changes and 1 call for reloading
136136

137137
expect(appConfig.get("app.key2")).to.be.undefined;
138138

139-
await sleepInMs(1000);
140-
await appConfig.refresh();
139+
await sleepInMs(1500); // key3 added
140+
await appConfig.refresh(); // 1 call listConfigurationSettings for watching changes and 1 call for reloading
141141

142142
expect(appConfig.get("app.key3")).to.equal("value3");
143143
});
@@ -177,7 +177,7 @@ describe("loadFromAzureFrontDoor", function() {
177177
expect(featureFlags[0].id).to.equal("Beta");
178178
expect(featureFlags[0].enabled).to.equal(true);
179179

180-
await sleepInMs(1000);
180+
await sleepInMs(1500);
181181
await appConfig.refresh();
182182

183183
featureFlags = appConfig.get<any>("feature_management").feature_flags;
@@ -226,13 +226,13 @@ describe("loadFromAzureFrontDoor", function() {
226226

227227
expect(appConfig.get("app.key2")).to.equal("value2");
228228

229-
await sleepInMs(1000);
229+
await sleepInMs(1500);
230230
await appConfig.refresh();
231231

232232
// cdn cache hasn't expired, even if the sentinel key changed, key2 should still return the old value
233233
expect(appConfig.get("app.key2")).to.equal("value2");
234234

235-
await sleepInMs(1000);
235+
await sleepInMs(1500);
236236
await appConfig.refresh();
237237

238238
// cdn cache has expired, key2 should return the updated value even if sentinel remains the same

0 commit comments

Comments
 (0)