mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Merge remote-tracking branch 'origin/master' into fix-1898/watch-api-streaming
This commit is contained in:
commit
4ddd32b05f
@ -58,6 +58,7 @@ jobs:
|
||||
- script: make test-extensions
|
||||
displayName: Run In-tree Extension tests
|
||||
- bash: |
|
||||
set -e
|
||||
rm -rf extensions/telemetry
|
||||
make integration-win
|
||||
git checkout extensions/telemetry
|
||||
@ -102,6 +103,7 @@ jobs:
|
||||
- script: make test-extensions
|
||||
displayName: Run In-tree Extension tests
|
||||
- bash: |
|
||||
set -e
|
||||
rm -rf extensions/telemetry
|
||||
make integration-mac
|
||||
git checkout extensions/telemetry
|
||||
@ -159,6 +161,7 @@ jobs:
|
||||
sudo chown -R $USER $HOME/.kube $HOME/.minikube
|
||||
displayName: Install integration test dependencies
|
||||
- bash: |
|
||||
set -e
|
||||
rm -rf extensions/telemetry
|
||||
xvfb-run --auto-servernum --server-args='-screen 0, 1600x900x24' make integration-linux
|
||||
git checkout extensions/telemetry
|
||||
|
||||
@ -6,10 +6,10 @@
|
||||
*/
|
||||
import { Application } from "spectron";
|
||||
import * as utils from "../helpers/utils";
|
||||
import { spawnSync, exec } from "child_process";
|
||||
import * as util from "util";
|
||||
import { spawnSync } from "child_process";
|
||||
import { listHelmRepositories } from "../helpers/utils";
|
||||
import { fail } from "assert";
|
||||
|
||||
export const promiseExec = util.promisify(exec);
|
||||
|
||||
jest.setTimeout(60000);
|
||||
|
||||
@ -96,8 +96,11 @@ describe("Lens integration tests", () => {
|
||||
});
|
||||
|
||||
it("ensures helm repos", async () => {
|
||||
const { stdout: reposJson } = await promiseExec("helm repo list -o json");
|
||||
const repos = JSON.parse(reposJson);
|
||||
const repos = await listHelmRepositories();
|
||||
|
||||
if (!repos[0]) {
|
||||
fail("Lens failed to add Bitnami repository");
|
||||
}
|
||||
|
||||
await app.client.waitUntilTextExists("div.repos #message-bitnami", repos[0].name); // wait for the helm-cli to fetch the repo(s)
|
||||
await app.client.click("#HelmRepoSelect"); // click the repo select to activate the drop-down
|
||||
@ -505,19 +508,35 @@ describe("Lens integration tests", () => {
|
||||
await app.client.click(".sidebar-nav [data-test-id='workloads'] span.link-text");
|
||||
await app.client.waitUntilTextExists('a[href^="/pods"]', "Pods");
|
||||
await app.client.click('a[href^="/pods"]');
|
||||
await app.client.click(".NamespaceSelect");
|
||||
await app.client.keys("kube-system");
|
||||
await app.client.keys("Enter");// "\uE007"
|
||||
await app.client.waitUntilTextExists("div.TableCell", "kube-apiserver");
|
||||
let podMenuItemEnabled = false;
|
||||
|
||||
// Wait until extensions are enabled on renderer
|
||||
while (!podMenuItemEnabled) {
|
||||
const logs = await app.client.getRenderProcessLogs();
|
||||
|
||||
podMenuItemEnabled = !!logs.find(entry => entry.message.includes("[EXTENSION]: enabled lens-pod-menu@"));
|
||||
|
||||
if (!podMenuItemEnabled) {
|
||||
await new Promise(r => setTimeout(r, 1000));
|
||||
}
|
||||
}
|
||||
await new Promise(r => setTimeout(r, 500)); // Give some extra time to prepare extensions
|
||||
// Open logs tab in dock
|
||||
await app.client.click(".list .TableRow:first-child");
|
||||
await app.client.waitForVisible(".Drawer");
|
||||
await app.client.click(".drawer-title .Menu li:nth-child(2)");
|
||||
// Check if controls are available
|
||||
await app.client.waitForVisible(".Logs .VirtualList");
|
||||
await app.client.waitForVisible(".LogList .VirtualList");
|
||||
await app.client.waitForVisible(".LogResourceSelector");
|
||||
await app.client.waitForVisible(".LogResourceSelector .SearchInput");
|
||||
await app.client.waitForVisible(".LogResourceSelector .SearchInput input");
|
||||
//await app.client.waitForVisible(".LogSearch .SearchInput");
|
||||
await app.client.waitForVisible(".LogSearch .SearchInput input");
|
||||
// Search for semicolon
|
||||
await app.client.keys(":");
|
||||
await app.client.waitForVisible(".Logs .list span.active");
|
||||
await app.client.waitForVisible(".LogList .list span.active");
|
||||
// Click through controls
|
||||
await app.client.click(".LogControls .show-timestamps");
|
||||
await app.client.click(".LogControls .show-previous");
|
||||
@ -556,7 +575,10 @@ describe("Lens integration tests", () => {
|
||||
await app.client.click(".sidebar-nav [data-test-id='workloads'] span.link-text");
|
||||
await app.client.waitUntilTextExists('a[href^="/pods"]', "Pods");
|
||||
await app.client.click('a[href^="/pods"]');
|
||||
await app.client.waitUntilTextExists("div.TableCell", "kube-apiserver");
|
||||
|
||||
await app.client.click(".NamespaceSelect");
|
||||
await app.client.keys(TEST_NAMESPACE);
|
||||
await app.client.keys("Enter");// "\uE007"
|
||||
await app.client.click(".Icon.new-dock-tab");
|
||||
await app.client.waitUntilTextExists("li.MenuItem.create-resource-tab", "Create resource");
|
||||
await app.client.click("li.MenuItem.create-resource-tab");
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
import { Application } from "spectron";
|
||||
import * as util from "util";
|
||||
import { exec } from "child_process";
|
||||
|
||||
const AppPaths: Partial<Record<NodeJS.Platform, string>> = {
|
||||
"win32": "./dist/win-unpacked/Lens.exe",
|
||||
@ -26,7 +28,12 @@ export function setup(): Application {
|
||||
});
|
||||
}
|
||||
|
||||
type HelmRepository = {
|
||||
name: string;
|
||||
url: string;
|
||||
};
|
||||
type AsyncPidGetter = () => Promise<number>;
|
||||
export const promiseExec = util.promisify(exec);
|
||||
|
||||
export async function tearDown(app: Application) {
|
||||
const pid = await (app.mainProcess.pid as any as AsyncPidGetter)();
|
||||
@ -39,3 +46,19 @@ export async function tearDown(app: Application) {
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
export async function listHelmRepositories(retries = 0): Promise<HelmRepository[]>{
|
||||
if (retries < 5) {
|
||||
try {
|
||||
const { stdout: reposJson } = await promiseExec("helm repo list -o json");
|
||||
|
||||
return JSON.parse(reposJson);
|
||||
} catch {
|
||||
await new Promise(r => setTimeout(r, 2000)); // if no repositories, wait for Lens adding bitnami repository
|
||||
|
||||
return await listHelmRepositories((retries + 1));
|
||||
}
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
@ -200,7 +200,7 @@
|
||||
"jsonpath": "^1.0.2",
|
||||
"lodash": "^4.17.15",
|
||||
"mac-ca": "^1.0.4",
|
||||
"marked": "^1.1.0",
|
||||
"marked": "^1.2.7",
|
||||
"md5-file": "^5.0.0",
|
||||
"mobx": "^5.15.7",
|
||||
"mobx-observable-history": "^1.0.3",
|
||||
@ -313,7 +313,7 @@
|
||||
"jest-canvas-mock": "^2.3.0",
|
||||
"jest-fetch-mock": "^3.0.3",
|
||||
"jest-mock-extended": "^1.0.10",
|
||||
"make-plural": "^6.2.1",
|
||||
"make-plural": "^6.2.2",
|
||||
"mini-css-extract-plugin": "^0.9.0",
|
||||
"moment": "^2.26.0",
|
||||
"node-loader": "^0.6.0",
|
||||
|
||||
@ -51,6 +51,10 @@ export class Nodes extends React.Component<Props> {
|
||||
if (!metrics || !metrics[1]) return <LineProgress value={0}/>;
|
||||
const usage = metrics[0];
|
||||
const cores = metrics[1];
|
||||
const cpuUsagePercent = Math.ceil(usage * 100) / cores;
|
||||
const cpuUsagePercentLabel: String = cpuUsagePercent % 1 === 0
|
||||
? cpuUsagePercent.toString()
|
||||
: cpuUsagePercent.toFixed(2);
|
||||
|
||||
return (
|
||||
<LineProgress
|
||||
@ -58,7 +62,7 @@ export class Nodes extends React.Component<Props> {
|
||||
value={usage}
|
||||
tooltip={{
|
||||
preferredPositions: TooltipPosition.BOTTOM,
|
||||
children: `CPU: ${Math.ceil(usage * 100) / cores}\%, cores: ${cores}`
|
||||
children: `CPU: ${cpuUsagePercentLabel}\%, cores: ${cores}`
|
||||
}}
|
||||
/>
|
||||
);
|
||||
|
||||
22
yarn.lock
22
yarn.lock
@ -4811,9 +4811,9 @@ electron@^9.4.0:
|
||||
extract-zip "^1.0.3"
|
||||
|
||||
elliptic@^6.0.0, elliptic@^6.5.2:
|
||||
version "6.5.2"
|
||||
resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.2.tgz#05c5678d7173c049d8ca433552224a495d0e3762"
|
||||
integrity sha512-f4x70okzZbIQl/NSRLkI/+tteV/9WqL98zx+SQ69KbXxmVrmjwsNUPn/gYJJ0sHvEak24cZgHIPegRePAtA/xw==
|
||||
version "6.5.3"
|
||||
resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.3.tgz#cb59eb2efdaf73a0bd78ccd7015a62ad6e0f93d6"
|
||||
integrity sha512-IMqzv5wNQf+E6aHeIqATs0tOLeOTwj1QKbRcS3jBbYkl5oLAserA8yJTT7/VyHUYG91PRmPyeQDObKLPpeS4dw==
|
||||
dependencies:
|
||||
bn.js "^4.4.0"
|
||||
brorand "^1.0.1"
|
||||
@ -8766,10 +8766,10 @@ make-fetch-happen@^5.0.0:
|
||||
socks-proxy-agent "^4.0.0"
|
||||
ssri "^6.0.0"
|
||||
|
||||
make-plural@^6.2.1:
|
||||
version "6.2.1"
|
||||
resolved "https://registry.yarnpkg.com/make-plural/-/make-plural-6.2.1.tgz#2790af1d05fb2fc35a111ce759ffdb0aca1339a3"
|
||||
integrity sha512-AmkruwJ9EjvyTv6AM8MBMK3TAeOJvhgTv5YQXzF0EP2qawhpvMjDpHvsdOIIT0Vn+BB0+IogmYZ1z+Ulm/m0Fg==
|
||||
make-plural@^6.2.2:
|
||||
version "6.2.2"
|
||||
resolved "https://registry.yarnpkg.com/make-plural/-/make-plural-6.2.2.tgz#beb5fd751355e72660eeb2218bb98eec92853c6c"
|
||||
integrity sha512-8iTuFioatnTTmb/YJjywkVIHLjcwkFD9Ms0JpxjEm9Mo8eQYkh1z+55dwv4yc1jQ8ftVBxWQbihvZL1DfzGGWA==
|
||||
|
||||
makeerror@1.0.x:
|
||||
version "1.0.11"
|
||||
@ -8807,10 +8807,10 @@ marked@^0.8.0:
|
||||
resolved "https://registry.yarnpkg.com/marked/-/marked-0.8.2.tgz#4faad28d26ede351a7a1aaa5fec67915c869e355"
|
||||
integrity sha512-EGwzEeCcLniFX51DhTpmTom+dSA/MG/OBUDjnWtHbEnjAH180VzUeAw+oE4+Zv+CoYBWyRlYOTR0N8SO9R1PVw==
|
||||
|
||||
marked@^1.1.0:
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/marked/-/marked-1.1.0.tgz#62504ad4d11550c942935ccc5e39d64e5a4c4e50"
|
||||
integrity sha512-EkE7RW6KcXfMHy2PA7Jg0YJE1l8UPEZE8k45tylzmZM30/r1M1MUXWQfJlrSbsTeh7m/XTwHbWUENvAJZpp1YA==
|
||||
marked@^1.2.7:
|
||||
version "1.2.7"
|
||||
resolved "https://registry.yarnpkg.com/marked/-/marked-1.2.7.tgz#6e14b595581d2319cdcf033a24caaf41455a01fb"
|
||||
integrity sha512-No11hFYcXr/zkBvL6qFmAp1z6BKY3zqLMHny/JN/ey+al7qwCM2+CMBL9BOgqMxZU36fz4cCWfn2poWIf7QRXA==
|
||||
|
||||
matcher@^3.0.0:
|
||||
version "3.0.0"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user