Skip to content

Commit 94bf23b

Browse files
authored
Add e2e tests for the deployment cancellation (#1396)
## Changes I'm testing it in the run flow because the tests checks are simpler there. ## Tests e2e
1 parent 97daab1 commit 94bf23b

File tree

2 files changed

+31
-3
lines changed

2 files changed

+31
-3
lines changed

packages/databricks-vscode/src/test/e2e/run_files.e2e.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,35 @@ describe("Run files", async function () {
6565
}
6666
});
6767

68+
it("should cancel a run during deployment", async () => {
69+
const workbench = await driver.getWorkbench();
70+
await workbench.executeQuickPick("Databricks: Upload and Run File");
71+
await browser.waitUntil(async () => {
72+
const notifications = await workbench.getNotifications();
73+
for (const notification of notifications) {
74+
const message = await notification.getMessage();
75+
if (message.includes("Deploying")) {
76+
// Make sure the CLI is actually spawned before cancelling
77+
await sleep(1000);
78+
await notification.takeAction("Cancel");
79+
return true;
80+
}
81+
}
82+
return false;
83+
});
84+
const debugOutput = await workbench
85+
.getBottomBar()
86+
.openDebugConsoleView();
87+
while (true) {
88+
const text = await (await debugOutput.elem).getHTML();
89+
if (text && text.includes("Cancelled")) {
90+
break;
91+
} else {
92+
await sleep(2000);
93+
}
94+
}
95+
});
96+
6897
it("should run a python file as a workflow", async () => {
6998
const workbench = await driver.getWorkbench();
7099
await workbench.executeQuickPick("Databricks: Run File as Workflow");

packages/databricks-vscode/src/test/e2e/utils/dabsFixtures.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import lodash from "lodash";
99

1010
type SimpleJob = Pick<
1111
Resource<BundleTarget, "jobs">,
12-
"name" | "tasks" | "job_clusters" | "compute"
12+
"name" | "tasks" | "job_clusters"
1313
>;
1414

1515
export function getSimpleJobsResource(def: Omit<SimpleJob, "name">) {
@@ -36,8 +36,7 @@ export function getSimpleJobsResource(def: Omit<SimpleJob, "name">) {
3636
if (
3737
task.job_cluster_key === undefined &&
3838
task.new_cluster === undefined &&
39-
task.existing_cluster_id === undefined &&
40-
task.compute_key === undefined
39+
task.existing_cluster_id === undefined
4140
) {
4241
task.job_cluster_key = "job_cluster";
4342
}

0 commit comments

Comments
 (0)