mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-11 18:48:33 -05:00
Add log to help debug failure in the lab (#4706)
This commit is contained in:
@@ -16,24 +16,31 @@ import { getBdcServer } from './testConfig';
|
||||
import { connectToServer } from './utils';
|
||||
|
||||
if (context.RunTest) {
|
||||
suite('Notebook integration test suite', async () => {
|
||||
suite('Notebook integration test suite', () => {
|
||||
test('Sql NB test', async function () {
|
||||
console.log('Start Sql NB test');
|
||||
let notebook = await openNotebook(sqlNotebookContent, sqlKernelMetadata);
|
||||
|
||||
const expectedOutput0 = '(1 row affected)';
|
||||
let cellOutputs = notebook.document.cells[0].contents.outputs;
|
||||
console.log('Got cell outputs');
|
||||
assert(cellOutputs.length === 3, `Expected length: 3, Acutal: '${cellOutputs.length}'`);
|
||||
let actualOutput0 = (<azdata.nb.IDisplayData>cellOutputs[0]).data['text/html'];
|
||||
console.log('Got first output');
|
||||
assert(actualOutput0 === expectedOutput0, `Expected row count: '${expectedOutput0}', Acutal: '${actualOutput0}'`);
|
||||
let actualOutput2 = (<azdata.nb.IExecuteResult>cellOutputs[2]).data['application/vnd.dataresource+json'].data[0];
|
||||
assert(actualOutput2[0] === '1', `Expected result: 1, Acutal: '${actualOutput2[0]}'`);
|
||||
console.log('Sql NB done');
|
||||
});
|
||||
|
||||
test('Python3 notebook test', async function () {
|
||||
console.log('Start Python3 NB test');
|
||||
let notebook = await openNotebook(pySparkNotebookContent, pythonKernelMetadata);
|
||||
let cellOutputs = notebook.document.cells[0].contents.outputs;
|
||||
console.log('Got cell outputs');
|
||||
let result = (<azdata.nb.IExecuteResult>cellOutputs[0]).data['text/plain'];
|
||||
assert(result === '2', `Expected: 2, Acutal: '${result}'`);
|
||||
console.log('Python3 NB done');
|
||||
});
|
||||
|
||||
// test('PySpark3 notebook test', async function () {
|
||||
@@ -52,10 +59,15 @@ async function openNotebook(content: azdata.nb.INotebookContents, kernelMetadata
|
||||
await connectToServer(server, 6000);
|
||||
let pythonNotebook = Object.assign({}, content, { metadata: kernelMetadata });
|
||||
let uri = writeNotebookToFile(pythonNotebook);
|
||||
console.log(uri);
|
||||
let notebook = await azdata.nb.showNotebookDocument(uri);
|
||||
console.log('Notebook is opened');
|
||||
assert(notebook.document.cells.length === 1, 'Notebook should have 1 cell');
|
||||
console.log('Before run notebook cell');
|
||||
let ran = await notebook.runCell(notebook.document.cells[0]);
|
||||
console.log('After run notebook cell');
|
||||
assert(ran, 'Notebook runCell should succeed');
|
||||
assert(notebook !== undefined && notebook !== null, 'Expected notebook object is defined');
|
||||
return notebook;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user