diff --git a/extensions/integration-tests/src/notebook.test.ts b/extensions/integration-tests/src/notebook.test.ts index a0287858ef..ddba3993fe 100644 --- a/extensions/integration-tests/src/notebook.test.ts +++ b/extensions/integration-tests/src/notebook.test.ts @@ -14,6 +14,7 @@ import { context } from './testContext'; import { sqlNotebookContent, writeNotebookToFile, sqlKernelMetadata } from './notebook.util'; import { getBdcServer } from './testConfig'; import { connectToServer } from './utils'; +import * as fs from 'fs'; if (context.RunTest) { suite('Notebook integration test suite', () => { @@ -30,6 +31,9 @@ if (context.RunTest) { assert(actualOutput0 === expectedOutput0, `Expected row count: '${expectedOutput0}', Acutal: '${actualOutput0}'`); let actualOutput2 = (cellOutputs[2]).data['application/vnd.dataresource+json'].data[0]; assert(actualOutput2[0] === '1', `Expected result: 1, Acutal: '${actualOutput2[0]}'`); + if (fs.existsSync(notebook.document.fileName)) { + fs.unlink(notebook.document.fileName); + } console.log('Sql NB done'); }); diff --git a/extensions/integration-tests/src/notebook.util.ts b/extensions/integration-tests/src/notebook.util.ts index 389def4966..980a6c8169 100644 --- a/extensions/integration-tests/src/notebook.util.ts +++ b/extensions/integration-tests/src/notebook.util.ts @@ -8,7 +8,9 @@ import 'mocha'; import * as azdata from 'azdata'; import * as vscode from 'vscode'; -import * as tempWrite from 'temp-write'; +import * as fs from 'fs'; +import * as os from 'os'; +import * as path from 'path'; export class CellTypes { public static readonly Code = 'code'; @@ -73,7 +75,12 @@ export const pythonKernelMetadata = { export function writeNotebookToFile(pythonNotebook: azdata.nb.INotebookContents): vscode.Uri { let notebookContentString = JSON.stringify(pythonNotebook); - let localFile = tempWrite.sync(notebookContentString, 'notebook.ipynb'); + let localFile = path.join(os.tmpdir(), 'notebook' + Math.floor(Math.random() * 101) + '.ipynb'); + while (fs.existsSync(localFile)) { + localFile = path.join(os.tmpdir(), 'notebook' + Math.floor(Math.random() * 101) + '.ipynb'); + } + fs.writeFileSync(localFile, notebookContentString); + console.log(`Local file is created: '${localFile}'`); let uri = vscode.Uri.file(localFile); return uri; } diff --git a/extensions/integration-tests/src/setup.test.ts b/extensions/integration-tests/src/setup.test.ts index b9bb26e485..44370fc1ec 100644 --- a/extensions/integration-tests/src/setup.test.ts +++ b/extensions/integration-tests/src/setup.test.ts @@ -20,7 +20,10 @@ if (!context.RunTest) { assert(process.env.BDC_BACKEND_HOSTNAME !== undefined && process.env.BDC_BACKEND_USERNAME !== undefined && - process.env.BDC_BACKEND_PWD !== undefined, 'BDC_BACKEND_HOSTNAME, BDC_BACKEND_USERNAME, BDC_BACKEND_PWD must be set using ./scripts/setbackenvariables.sh or .\\scripts\\setbackendvaraibles.bat'); + process.env.BDC_BACKEND_PWD !== undefined && + process.env.STANDALONE_SQL_PWD !== undefined && + process.env.STANDALONE_SQL_USERNAME !== undefined && + process.env.PYTHON_TEST_PATH, 'BDC_BACKEND_HOSTNAME, BDC_BACKEND_USERNAME, BDC_BACKEND_PWD must be set using ./scripts/setbackenvariables.sh or .\\scripts\\setbackendvaraibles.bat'); }); }); } \ No newline at end of file