From 30144caaa7a5a4f77174c1eebf986c27b53de400 Mon Sep 17 00:00:00 2001 From: zhangjian Date: Fri, 1 Apr 2022 16:15:53 +0800 Subject: [PATCH 01/12] style: Optimize debug startup Signed-off-by: zhangjian --- src/main/commands/DebugCommand.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/commands/DebugCommand.ts b/src/main/commands/DebugCommand.ts index 14518a5c..45e17a6e 100644 --- a/src/main/commands/DebugCommand.ts +++ b/src/main/commands/DebugCommand.ts @@ -50,6 +50,8 @@ export default class DebugCommand implements ICommand { this.node = node; this.container = await getContainer(node); + const debugProvider = await this.getDebugProvider(); + this.validateDebugConfig(this.container); if (!param?.command) { @@ -64,8 +66,6 @@ export default class DebugCommand implements ICommand { } } - const debugProvider = await this.getDebugProvider(); - await waitForSync(node, DEBUG); this.startDebugging(node, debugProvider); From 9ae269567e1d516b311afd2422b75d9b5e5c9b74 Mon Sep 17 00:00:00 2001 From: zhangjian Date: Fri, 1 Apr 2022 16:56:21 +0800 Subject: [PATCH 02/12] test: Fix get webview timeout Signed-off-by: zhangjian --- test/extension/integration/connect.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/test/extension/integration/connect.js b/test/extension/integration/connect.js index 1ac1b896..789dc3e0 100644 --- a/test/extension/integration/connect.js +++ b/test/extension/integration/connect.js @@ -35,7 +35,8 @@ async function loginServer() { async function getIframe() { const parentHandle = await page.waitForSelector( - "#webview-webviewview-nocalhost-home .webview.ready" + "#webview-webviewview-nocalhost-home .webview.ready", + { timeout: 60_000 } ); const parent = await parentHandle.contentFrame(); @@ -55,9 +56,9 @@ async function pasteAsText() { const tabs = await (await iframe.$(".nocalhost-tab")).$$(":scope > *"); await tabs[0].click(); - const buttons = await (await iframe.$(".MuiTabs-flexContainer")).$$( - ":scope > *" - ); + const buttons = await ( + await iframe.$(".MuiTabs-flexContainer") + ).$$(":scope > *"); await buttons[1].click(); await iframe.focus('[placeholder="KubeConfig"]'); From 40d0cbe267f529198633d14c0e4aa289d26cd187 Mon Sep 17 00:00:00 2001 From: zhangjian Date: Fri, 1 Apr 2022 17:07:51 +0800 Subject: [PATCH 03/12] test: fix get webview timeout Signed-off-by: zhangjian --- test/extension/integration/connect.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/test/extension/integration/connect.js b/test/extension/integration/connect.js index 789dc3e0..a7d2fb75 100644 --- a/test/extension/integration/connect.js +++ b/test/extension/integration/connect.js @@ -34,10 +34,11 @@ async function loginServer() { } async function getIframe() { - const parentHandle = await page.waitForSelector( - "#webview-webviewview-nocalhost-home .webview.ready", - { timeout: 60_000 } - ); + const parentHandle = await page + .waitForSelector("#webview-webviewview-nocalhost-home .webview.ready") + .catch(() => { + process.exit(-1); + }); const parent = await parentHandle.contentFrame(); From f420cb11eb7d31d94513300f062b39fee0afd0e9 Mon Sep 17 00:00:00 2001 From: zhangjian Date: Fri, 1 Apr 2022 17:15:48 +0800 Subject: [PATCH 04/12] test: Fix get webview timeout Signed-off-by: zhangjian --- test/extension/integration/connect.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/extension/integration/connect.js b/test/extension/integration/connect.js index a7d2fb75..dc4b34a6 100644 --- a/test/extension/integration/connect.js +++ b/test/extension/integration/connect.js @@ -37,7 +37,7 @@ async function getIframe() { const parentHandle = await page .waitForSelector("#webview-webviewview-nocalhost-home .webview.ready") .catch(() => { - process.exit(-1); + process.kill(); }); const parent = await parentHandle.contentFrame(); From 0bc690bf3caec4fd4032fc4ef19acacbae43d378 Mon Sep 17 00:00:00 2001 From: zhangjian Date: Fri, 1 Apr 2022 17:30:42 +0800 Subject: [PATCH 05/12] style: Fix get webview timeout Signed-off-by: zhangjian --- test/extension/integration/connect.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/test/extension/integration/connect.js b/test/extension/integration/connect.js index dc4b34a6..99e028c0 100644 --- a/test/extension/integration/connect.js +++ b/test/extension/integration/connect.js @@ -34,13 +34,17 @@ async function loginServer() { } async function getIframe() { - const parentHandle = await page - .waitForSelector("#webview-webviewview-nocalhost-home .webview.ready") + await page + .waitForSelector(".webview.ready", { + timeout: 60_000, + }) .catch(() => { - process.kill(); + process.kill(process.pid); }); - const parent = await parentHandle.contentFrame(); + const parentHandle = await page.$$(".webview.ready"); + + const parent = await parentHandle[1].contentFrame(); assert.ok(parent); From c3fd97b70cf2d6e2abd61687346dbbc6b62a5407 Mon Sep 17 00:00:00 2001 From: zhangjian Date: Sat, 2 Apr 2022 12:04:36 +0800 Subject: [PATCH 06/12] test: fix bug Signed-off-by: zhangjian --- package.json | 12 ++++++------ test/extension/integration/connect.js | 19 ++++++++++--------- test/extension/integration/connect.test.js | 9 ++++++++- test/extension/integration/nhctl.js | 2 +- test/extension/integration/nhctl.test.js | 12 +++++++++++- 5 files changed, 36 insertions(+), 18 deletions(-) diff --git a/package.json b/package.json index 79784b9a..9705e844 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nocalhost", - "version": "0.6.16-alpha.f0d3f86", + "version": "0.6.16-alpha.0bc690b", "displayName": "Nocalhost", "description": "Makes developing with Kubernetes feel like on local. IDE tool for cloud-native development", "license": "Apache-2.0", @@ -151,7 +151,7 @@ { "command": "Nocalhost.run", "when": "viewItem =~ /^workload-(deployment|statefulSet|job|daemonSet|cronjob|pod|crd-resources)-dev-(?!vpn_)/i", - "group": "developing@3" + "group": "inline" }, { "command": "Nocalhost.debug", @@ -181,7 +181,7 @@ { "command": "Nocalhost.applyKubernetesObject", "when": "viewItem =~ /^application-(.*)-installed/i", - "group": "application@2" + "group": "inline" }, { "command": "Nocalhost.upgradeApp", @@ -206,7 +206,7 @@ { "command": "Nocalhost.startCopyDevMode", "when": "viewItem =~ /^workload-(deployment|statefulSet|job|daemonSet|cronjob|pod|crd-resources)-dev-(?!(developing-duplicate|developing-replace-self|starting|vpn_healthy|vpn_unhealthy))/i", - "group": "navigation" + "group": "inline" }, { "command": "Nocalhost.endDevMode", @@ -241,7 +241,7 @@ { "command": "Nocalhost.log", "when": "viewItem =~ /^(viewer:|)workload-(deployment|statefulSet|daemonSet|job|cronJob|pod|crd-resources)-dev-(?!vpn_)/i", - "group": "1" + "group": "inline" }, { "command": "Nocalhost.editManifest", @@ -252,7 +252,7 @@ { "command": "Nocalhost.portForward", "when": "viewItem =~ /^(viewer:|)workload-(deployment|statefulSet|job|daemonSet|cronjob|pod|pod-Running|crd-resources)-dev-(?!vpn_)/i", - "group": "1" + "group": "inline" }, { "command": "Nocalhost.portForward", diff --git a/test/extension/integration/connect.js b/test/extension/integration/connect.js index 99e028c0..57f55403 100644 --- a/test/extension/integration/connect.js +++ b/test/extension/integration/connect.js @@ -34,21 +34,22 @@ async function loginServer() { } async function getIframe() { - await page - .waitForSelector(".webview.ready", { + const parentHandle = await page.waitForSelector( + `.webview.ready[src$="purpose=webviewView"]`, + { timeout: 60_000, - }) - .catch(() => { - process.kill(process.pid); - }); - - const parentHandle = await page.$$(".webview.ready"); + } + ); - const parent = await parentHandle[1].contentFrame(); + const parent = await parentHandle.contentFrame(); assert.ok(parent); const iframeHandle = await parent.waitForSelector("#active-frame"); + + assert.ok(parent); + assert.ok(iframeHandle); + const iframe = await iframeHandle.contentFrame(); await iframe.waitForSelector(".nocalhost-tab"); diff --git a/test/extension/integration/connect.test.js b/test/extension/integration/connect.test.js index fb5dfe70..0f418017 100644 --- a/test/extension/integration/connect.test.js +++ b/test/extension/integration/connect.test.js @@ -3,7 +3,14 @@ const { pasteAsText, loadKubeConfig } = require("./connect"); const connectTests = () => { describe("connect to Cluster", () => { it.skip("paste as Text", pasteAsText); - it("load KubeConfig", loadKubeConfig); + it("load KubeConfig", () => { + return loadKubeConfig().catch((err) => { + setTimeout(() => { + process.kill(process.pid); + }, 1_000); + throw err; + }); + }); }); }; diff --git a/test/extension/integration/nhctl.js b/test/extension/integration/nhctl.js index 1bf4d442..a3c983ed 100644 --- a/test/extension/integration/nhctl.js +++ b/test/extension/integration/nhctl.js @@ -11,7 +11,7 @@ async function download() { path.resolve(homedir(), ".nh", "bin", "nhctl"), { nothrow: true } ); - if (result && result.code === 0) { + if (result) { return; } diff --git a/test/extension/integration/nhctl.test.js b/test/extension/integration/nhctl.test.js index 214e1923..cfacb44f 100644 --- a/test/extension/integration/nhctl.test.js +++ b/test/extension/integration/nhctl.test.js @@ -1,7 +1,17 @@ const { download } = require("./nhctl"); const nhctlTests = () => { - it("download", download, 10 * 60 * 1000); + it( + "download", + () => + download.catch((err) => { + setTimeout(() => { + process.kill(process.pid); + }, 1_000); + throw err; + }), + 10 * 60 * 1000 + ); }; module.exports = { nhctlTests }; From 1163816d955559d19ea2cbffcc1295b4853d3d2d Mon Sep 17 00:00:00 2001 From: zhangjian Date: Sat, 2 Apr 2022 12:10:01 +0800 Subject: [PATCH 07/12] test: fix nhctl download fail Signed-off-by: zhangjian --- test/extension/integration/nhctl.test.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/test/extension/integration/nhctl.test.js b/test/extension/integration/nhctl.test.js index cfacb44f..a6c098d9 100644 --- a/test/extension/integration/nhctl.test.js +++ b/test/extension/integration/nhctl.test.js @@ -3,13 +3,14 @@ const { download } = require("./nhctl"); const nhctlTests = () => { it( "download", - () => - download.catch((err) => { + () => { + return download.catch((err) => { setTimeout(() => { process.kill(process.pid); }, 1_000); throw err; - }), + }); + }, 10 * 60 * 1000 ); }; From dab9acf066a4f5101f2b32e30c3ba4e370393ad7 Mon Sep 17 00:00:00 2001 From: zhangjian Date: Sat, 2 Apr 2022 14:22:17 +0800 Subject: [PATCH 08/12] test: fix download fail Signed-off-by: zhangjian --- test/extension/integration/nhctl.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/extension/integration/nhctl.test.js b/test/extension/integration/nhctl.test.js index a6c098d9..19b90793 100644 --- a/test/extension/integration/nhctl.test.js +++ b/test/extension/integration/nhctl.test.js @@ -4,7 +4,7 @@ const nhctlTests = () => { it( "download", () => { - return download.catch((err) => { + return download().catch((err) => { setTimeout(() => { process.kill(process.pid); }, 1_000); From 8b6af55f0e6e367900d3ffd7403ecae39f928214 Mon Sep 17 00:00:00 2001 From: zhangjian Date: Sat, 2 Apr 2022 15:43:13 +0800 Subject: [PATCH 09/12] test: fix timeout Signed-off-by: zhangjian --- .github/workflows/ui-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ui-test.yml b/.github/workflows/ui-test.yml index ba8fcbff..dced1b90 100644 --- a/.github/workflows/ui-test.yml +++ b/.github/workflows/ui-test.yml @@ -67,7 +67,7 @@ jobs: action: devSpace.create - name: Run tests - timeout-minutes: 20 + timeout-minutes: 30 env: CYPRESS_EVERY_NTH_FRAME: 1 VIDEO_CAPTURE: 1 From 120b6b45baa9cb34302ac226d0a7f398d3f24b40 Mon Sep 17 00:00:00 2001 From: zhangjian Date: Sat, 2 Apr 2022 15:53:42 +0800 Subject: [PATCH 10/12] WIP Signed-off-by: zhangjian --- .github/workflows/ui-test.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ui-test.yml b/.github/workflows/ui-test.yml index dced1b90..1e62edbe 100644 --- a/.github/workflows/ui-test.yml +++ b/.github/workflows/ui-test.yml @@ -28,12 +28,16 @@ jobs: with: version: 6 run_install: false + - run: | + BRANCH=${GITHUB_HEAD_REF:-$(git rev-parse --abbrev-ref HEAD)} + BRANCH=${BRANCH/\//-} + echo "BRANCH=$BRANCH">>$GITHUB_ENV - uses: actions/cache@v2 id: pnpm-cache with: path: "**/node_modules" - key: ${{ runner.os }}-ui-test-${{ hashFiles('**/pnpm-lock.yaml') }} + key: ${BRANCH}-${{ runner.os }}-ui-test-${{ hashFiles('**/pnpm-lock.yaml') }} restore-keys: ${{ runner.os }}-ui-test - uses: pnpm/action-setup@v2.1.0 From fc6561de7bca62746b45ca9dbaa7c5e9d76cf0dc Mon Sep 17 00:00:00 2001 From: zhangjian Date: Sat, 2 Apr 2022 15:55:07 +0800 Subject: [PATCH 11/12] WIP Signed-off-by: zhangjian --- .github/workflows/ui-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ui-test.yml b/.github/workflows/ui-test.yml index 1e62edbe..2d0138bd 100644 --- a/.github/workflows/ui-test.yml +++ b/.github/workflows/ui-test.yml @@ -37,7 +37,7 @@ jobs: id: pnpm-cache with: path: "**/node_modules" - key: ${BRANCH}-${{ runner.os }}-ui-test-${{ hashFiles('**/pnpm-lock.yaml') }} + key: ${{ BRANCH }}-${{ runner.os }}-ui-test-${{ hashFiles('**/pnpm-lock.yaml') }} restore-keys: ${{ runner.os }}-ui-test - uses: pnpm/action-setup@v2.1.0 From 75d9d99983094eedbb14b913bccfa2555adc1a51 Mon Sep 17 00:00:00 2001 From: zhangjian Date: Sat, 2 Apr 2022 15:56:40 +0800 Subject: [PATCH 12/12] WIP Signed-off-by: zhangjian --- .github/workflows/ui-test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ui-test.yml b/.github/workflows/ui-test.yml index 2d0138bd..acc7f1d3 100644 --- a/.github/workflows/ui-test.yml +++ b/.github/workflows/ui-test.yml @@ -31,13 +31,13 @@ jobs: - run: | BRANCH=${GITHUB_HEAD_REF:-$(git rev-parse --abbrev-ref HEAD)} BRANCH=${BRANCH/\//-} - echo "BRANCH=$BRANCH">>$GITHUB_ENV + echo "BRANCH=${BRANCH}">>$GITHUB_ENV - uses: actions/cache@v2 id: pnpm-cache with: path: "**/node_modules" - key: ${{ BRANCH }}-${{ runner.os }}-ui-test-${{ hashFiles('**/pnpm-lock.yaml') }} + key: ${{ env.BRANCH }}-${{ runner.os }}-ui-test-${{ hashFiles('**/pnpm-lock.yaml') }} restore-keys: ${{ runner.os }}-ui-test - uses: pnpm/action-setup@v2.1.0