Skip to content

Commit

Permalink
Add e2e tests for the deployment cancellation (#1396)
Browse files Browse the repository at this point in the history
## Changes
I'm testing it in the run flow because the tests checks are simpler
there.

## Tests
e2e
  • Loading branch information
ilia-db authored Oct 17, 2024
1 parent 97daab1 commit 94bf23b
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 3 deletions.
29 changes: 29 additions & 0 deletions packages/databricks-vscode/src/test/e2e/run_files.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,35 @@ describe("Run files", async function () {
}
});

it("should cancel a run during deployment", async () => {
const workbench = await driver.getWorkbench();
await workbench.executeQuickPick("Databricks: Upload and Run File");
await browser.waitUntil(async () => {
const notifications = await workbench.getNotifications();
for (const notification of notifications) {
const message = await notification.getMessage();
if (message.includes("Deploying")) {
// Make sure the CLI is actually spawned before cancelling
await sleep(1000);
await notification.takeAction("Cancel");
return true;
}
}
return false;
});
const debugOutput = await workbench
.getBottomBar()
.openDebugConsoleView();
while (true) {
const text = await (await debugOutput.elem).getHTML();
if (text && text.includes("Cancelled")) {
break;
} else {
await sleep(2000);
}
}
});

it("should run a python file as a workflow", async () => {
const workbench = await driver.getWorkbench();
await workbench.executeQuickPick("Databricks: Run File as Workflow");
Expand Down
5 changes: 2 additions & 3 deletions packages/databricks-vscode/src/test/e2e/utils/dabsFixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import lodash from "lodash";

type SimpleJob = Pick<
Resource<BundleTarget, "jobs">,
"name" | "tasks" | "job_clusters" | "compute"
"name" | "tasks" | "job_clusters"
>;

export function getSimpleJobsResource(def: Omit<SimpleJob, "name">) {
Expand All @@ -36,8 +36,7 @@ export function getSimpleJobsResource(def: Omit<SimpleJob, "name">) {
if (
task.job_cluster_key === undefined &&
task.new_cluster === undefined &&
task.existing_cluster_id === undefined &&
task.compute_key === undefined
task.existing_cluster_id === undefined
) {
task.job_cluster_key = "job_cluster";
}
Expand Down

0 comments on commit 94bf23b

Please sign in to comment.