Skip to content

Commit 937b46c

Browse files
Update Databricks CLI to v0.218.1 (#1197)
Update Databricks CLI to v0.218.1 --------- Co-authored-by: eng-dev-ecosystem-bot <eng-dev-ecosystem-bot@users.noreply.github.com> Co-authored-by: kartikgupta-db <kartik.gupta@databricks.com> Co-authored-by: Kartik Gupta <88345179+kartikgupta-db@users.noreply.github.com>
1 parent 8867b46 commit 937b46c

File tree

3 files changed

+16
-38
lines changed

3 files changed

+16
-38
lines changed

packages/databricks-vscode/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -650,7 +650,7 @@
650650
"useYarn": false
651651
},
652652
"cli": {
653-
"version": "0.216.0"
653+
"version": "0.218.1"
654654
},
655655
"scripts": {
656656
"vscode:prepublish": "rm -rf out && yarn run package:compile && yarn run package:wrappers:write && yarn run package:jupyter-init-script:write && yarn run package:copy-webview-toolkit && yarn run generate-telemetry",

packages/databricks-vscode/src/cli/CliWrapper.test.ts

Lines changed: 15 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import os from "node:os";
1717
import crypto from "node:crypto";
1818
import {Context} from "@databricks/databricks-sdk/dist/context";
1919
import {logging} from "@databricks/databricks-sdk";
20+
import {writeFileSync} from "fs";
2021

2122
const execFile = promisify(execFileCb);
2223
const cliPath = path.join(__dirname, "../../bin/databricks");
@@ -118,21 +119,22 @@ describe(__filename, () => {
118119
assert.equal(profiles.length, 0);
119120
});
120121

121-
it("should list profiles", async function () {
122+
it("should list profiles", async () => {
122123
const logFilePath = getTempLogFilePath();
123124
const cli = createCliWrapper(logFilePath);
124125

125126
await withFile(async ({path}) => {
126-
await writeFile(
127+
writeFileSync(
127128
path,
128129
`
129-
host = https://cloud.databricks.com/
130-
token = dapitest1234
130+
host = https://cloud.databricks.com/
131+
token = dapitest1234
131132
132-
[STAGING]
133-
host = https://staging.cloud.databricks.com/
134-
token = dapitest54321
135-
`
133+
[STAGING]
134+
host = https://staging.cloud.databricks.com/
135+
token = dapitest54321
136+
`,
137+
"utf-8"
136138
);
137139

138140
const profiles = await cli.listProfiles(path);
@@ -149,12 +151,12 @@ describe(__filename, () => {
149151
});
150152
});
151153

152-
it("should load all valid profiles and return errors for rest", async () => {
154+
it("should load all valid profiles", async () => {
153155
const logFilePath = getTempLogFilePath();
154156
const cli = createCliWrapper(logFilePath);
155157

156158
await withFile(async ({path}) => {
157-
await writeFile(
159+
writeFileSync(
158160
path,
159161
`[correct]
160162
host = https://cloud.databricks.com/
@@ -168,41 +170,18 @@ host = https://cloud.databricks.com/
168170
169171
[missing-host-token]
170172
nothing = true
171-
172-
[typo-host]
173-
host = example.com
174-
`
173+
`,
174+
"utf-8"
175175
);
176176

177-
const logs: {level: string; msg?: string; meta: any}[] = [];
178-
const profiles = await cli.listProfiles(
179-
path,
180-
new Context({
181-
logger: logging.NamedLogger.getOrCreate(
182-
"cli-profile-format-test",
183-
{
184-
factory: () => {
185-
return {
186-
log: (level, msg, meta) => {
187-
logs.push({level, msg, meta});
188-
},
189-
};
190-
},
191-
}
192-
),
193-
})
194-
);
177+
const profiles = await cli.listProfiles(path);
195178
assert.equal(profiles.length, 2);
196179

197180
assert.equal(profiles[0].name, "correct");
198181
assert.equal(profiles[0].host, "https://cloud.databricks.com/");
199182

200183
assert.equal(profiles[1].name, "no-token");
201184
assert.equal(profiles[1].host, "https://cloud.databricks.com/");
202-
203-
const typoLog = logs.find((log) => log.msg?.includes("typo-host"));
204-
assert.ok(typoLog !== undefined);
205-
assert.ok(typoLog.level === "error");
206185
});
207186
});
208187

packages/databricks-vscode/src/cli/CliWrapper.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,6 @@ export class CliWrapper {
138138
profiles = profiles.filter((p: any) => !p.account_id);
139139

140140
const result = [];
141-
142141
for (const profile of profiles) {
143142
try {
144143
result.push({

0 commit comments

Comments
 (0)