Fix memory leak in unit tests (#5597)

This commit is contained in:
Sebastian Malton authored and GitHub committed 2022-06-13 11:00:07 -04:00
1 parent 2eb585e88e
commit 3058bea88f
37 files changed
+1502 -1777

No files matched your search

@@ -449,7 +449,7 @@ describe("KubeApi", () => {
expect(spy).toHaveBeenCalledWith("/api/v1/namespaces/kube-system/pods?watch=1&resourceVersion=", { query: { timeoutSeconds: 60 }}, expect.anything());
});
it("aborts watch using abortController", async (done) => {
it("aborts watch using abortController", (done) => {
const spy = jest.spyOn(request, "getResponse");
mockFetch.mockResponse(async request => {
@@ -472,10 +472,7 @@ describe("KubeApi", () => {
});
expect(spy).toHaveBeenCalledWith("/api/v1/namespaces/kube-system/pods?watch=1&resourceVersion=", { query: { timeoutSeconds: 60 }}, expect.anything());
await delay(100);
abortController.abort();
delay(100).then(() => abortController.abort());
});
describe("retries", () => {