1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00
lens/integration/helpers/minikube.ts
Jari Kolehmainen b5e7be7591
Initial command palette feature (#1957)
* wip: command palette

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* register shortcut to global menu

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* introduce openCommandDialog & closeCommandDialog

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* fix ipc broadcast to frames from renderer

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* tweak

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* add more commands

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* cleanup

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* ipc fix

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* add integration tests

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* ipc fix

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* implement workspace edit

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* workspace edit fixes

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* make tests green

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* fixes from code review

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* cleanup ipc

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* cleanup CommandRegistry

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* ipc fix

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* fix ClusterManager cluster auto-init

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* ensure cluster view is active before sending a command

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* switch to last active cluster when workspace change

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* tweak integration tests

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* run integration tests serially

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* cleanup

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* fixes based on code review

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* cleanup

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* cleanup more

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* cleanup

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* add workspace fixes

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* cleanup

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
2021-02-02 12:34:13 +02:00

60 lines
2.0 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 addMinikubeCluster(app: Application) {
await app.client.click("div.add-cluster");
await app.client.waitUntilTextExists("div", "Select kubeconfig file");
await app.client.click("div.Select__control"); // show the context drop-down list
await app.client.waitUntilTextExists("div", "minikube");
if (!await app.client.$("button.primary").isEnabled()) {
await app.client.click("div.minikube"); // select minikube context
} // else the only context, which must be 'minikube', is automatically selected
await app.client.click("div.Select__control"); // hide the context drop-down list (it might be obscuring the Add cluster(s) button)
await app.client.click("button.primary"); // add minikube cluster
}
export async function waitForMinikubeDashboard(app: Application) {
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");
}