mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
- Removed `getFreePort` as its use is always a race condition. Change all uses of it to retrive the port after listening - Added `getPortFrom` as a helper function to read a port from a stream - Remove `Cluster.ownerRef` as it is outdated and no longer needed for 5.0 - Remove `Cluster.enabled`, no longer needed because of above - Removed `Cluster.init`, moved its contents into `Cluster.constructor` as nothing in that function is asyncronous. Currently only being run on `main` as a stop gap until `renderer` gets its own version of `Cluster` - Refactored `LensProxy` so as to prevent `pty.node` (a NodeJS extension) being included in `webpack.extension.ts`'s run - Removed the passing around of the proxy port as that can now be accessed from an instance of `LensProxy` - purge ContextHandler's cache on disconnect Co-authored-by: Sebastian Malton <sebastian@malton.name>
52 lines
1.6 KiB
TypeScript
52 lines
1.6 KiB
TypeScript
import { spawnSync } from "child_process";
|
|
import { Application } from "spectron";
|
|
|
|
export function minikubeReady(testNamespace: string): boolean {
|
|
// determine if minikube is running
|
|
{
|
|
const { status } = spawnSync("minikube status", { shell: true });
|
|
|
|
if (status !== 0) {
|
|
console.warn("minikube not running");
|
|
|
|
return false;
|
|
}
|
|
}
|
|
|
|
// Remove TEST_NAMESPACE if it already exists
|
|
{
|
|
const { status } = spawnSync(`minikube kubectl -- get namespace ${testNamespace}`, { shell: true });
|
|
|
|
if (status === 0) {
|
|
console.warn(`Removing existing ${testNamespace} namespace`);
|
|
|
|
const { status, stdout, stderr } = spawnSync(
|
|
`minikube kubectl -- delete namespace ${testNamespace}`,
|
|
{ shell: true },
|
|
);
|
|
|
|
if (status !== 0) {
|
|
console.warn(`Error removing ${testNamespace} namespace: ${stderr.toString()}`);
|
|
|
|
return false;
|
|
}
|
|
|
|
console.log(stdout.toString());
|
|
}
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
export async function waitForMinikubeDashboard(app: Application) {
|
|
await app.client.waitUntilTextExists("div.TableCell", "minikube");
|
|
await app.client.waitForExist(".Input.SearchInput input");
|
|
await app.client.setValue(".Input.SearchInput input", "minikube");
|
|
await app.client.waitUntilTextExists("div.TableCell", "minikube");
|
|
await app.client.click("div.TableRow");
|
|
await app.client.waitUntilTextExists("pre.kube-auth-out", "Authentication proxy started");
|
|
await app.client.waitForExist(`iframe[name="minikube"]`);
|
|
await app.client.frame("minikube");
|
|
await app.client.waitUntilTextExists("span.link-text", "Cluster");
|
|
}
|