Implement cluster metadata detectors (#1106)

Signed-off-by: Lauri Nevala <lauri.nevala@gmail.com>
This commit is contained in:
Lauri Nevala authored and GitHub committed 2020-10-22 21:45:54 +03:00
1 parent 99db7aca19
commit ce995f3deb
14 files changed
+293 -49

No files matched your search

+4 -2
View File
@@ -38,6 +38,7 @@ import { getFreePort } from "../port";
import { V1ResourceAttributes } from "@kubernetes/client-node";
import { apiResources } from "../../common/rbac";
import request from "request-promise-native"
import { Kubectl } from "../kubectl";
const mockedRequest = request as jest.MockedFunction<typeof request>
@@ -73,6 +74,7 @@ describe("create clusters", () => {
})
}
mockFs(mockOpts)
jest.spyOn(Kubectl.prototype, "ensureKubectl").mockReturnValue(Promise.resolve(true))
})
afterEach(() => {
@@ -116,7 +118,7 @@ describe("create clusters", () => {
}
}
}
jest.spyOn(Cluster.prototype, "isClusterAdmin").mockReturnValue(Promise.resolve(true))
jest.spyOn(Cluster.prototype, "canI")
.mockImplementationOnce((attr: V1ResourceAttributes): Promise<boolean> => {
expect(attr.namespace).toBe("default")
@@ -159,7 +161,7 @@ describe("create clusters", () => {
expect(c.accessible).toBe(true)
expect(c.allowedNamespaces.length).toBe(1)
expect(c.allowedResources.length).toBe(apiResources.length)
c.disconnect()
jest.resetAllMocks()
})
})