mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
allow to call KubeApi.delete without namespace parameter (#4349)
Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
1 parent
53dd538350
commit
385de469ad
2 files changed
+27
-4
No files matched your search
@@ -245,17 +245,40 @@ describe("KubeApi", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("sends correct request", async () => {
|
||||
it("sends correct request with empty namespace", async () => {
|
||||
expect.hasAssertions();
|
||||
(fetch as any).mockResponse(async (request: Request) => {
|
||||
expect(request.method).toEqual("DELETE");
|
||||
expect(request.url).toEqual("http://127.0.0.1:9999/api-kube/api/v1/pods/foo?propagationPolicy=Background");
|
||||
|
||||
return {};
|
||||
});
|
||||
|
||||
await api.delete({ name: "foo", namespace: "" });
|
||||
});
|
||||
|
||||
it("sends correct request without namespace", async () => {
|
||||
expect.hasAssertions();
|
||||
(fetch as any).mockResponse(async (request: Request) => {
|
||||
console.log(request.url);
|
||||
expect(request.method).toEqual("DELETE");
|
||||
expect(request.url).toEqual("http://127.0.0.1:9999/api-kube/api/v1/namespaces/default/pods/foo?propagationPolicy=Background");
|
||||
|
||||
return {};
|
||||
});
|
||||
|
||||
await api.delete({ name: "foo", namespace: "default" });
|
||||
await api.delete({ name: "foo" });
|
||||
});
|
||||
|
||||
it("sends correct request with namespace", async () => {
|
||||
expect.hasAssertions();
|
||||
(fetch as any).mockResponse(async (request: Request) => {
|
||||
expect(request.method).toEqual("DELETE");
|
||||
expect(request.url).toEqual("http://127.0.0.1:9999/api-kube/api/v1/namespaces/kube-system/pods/foo?propagationPolicy=Background");
|
||||
|
||||
return {};
|
||||
});
|
||||
|
||||
await api.delete({ name: "foo", namespace: "kube-system" });
|
||||
});
|
||||
|
||||
it("allows to change propagationPolicy", async () => {
|
||||
|
||||
Reference in new issue
Block a user