Skip to content

Commit

Permalink
fix compilation without project analyzer (#988)
Browse files Browse the repository at this point in the history
* fix compilation without project analyzer

* bump version
  • Loading branch information
pgrivachev authored Jun 7, 2023
1 parent b5035cb commit 2defc0b
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 6 deletions.
4 changes: 4 additions & 0 deletions e2e/src/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,10 @@ async function showPreview(): Promise<void> {
await commands.executeCommand('WizardForDbtCore(TM).showQueryPreview');
}

export async function analyzeEntireProject(): Promise<void> {
await commands.executeCommand('WizardForDbtCore(TM).analyzeEntireProject');
}

export async function closeAllEditors(): Promise<void> {
await commands.executeCommand('workbench.action.closeAllEditors');
}
Expand Down
26 changes: 25 additions & 1 deletion e2e/src/postgres.spec.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,44 @@
import { assertThat, instanceOf } from 'hamjest';
import { assertThat, falsy, instanceOf, truthy } from 'hamjest';
import * as fs from 'node:fs';
import { MarkdownString, Position, Range } from 'vscode';
import { assertDefinitions } from './asserts';
import {
MAX_RANGE,
POSTGRES_PATH,
activateAndWait,
activateAndWaitManifestParsed,
analyzeEntireProject,
executeSignatureHelpProvider,
getAbsolutePath,
getCustomDocUri,
getPreviewText,
sleep,
} from './helper';
import path = require('node:path');

const ACTIVE_USERS_URI = getCustomDocUri('postgres/models/active_users.sql');
const ORDERS_COUNT_DOC_URI = getCustomDocUri('postgres/models/active_users_orders_count.sql');

suite('Postgres destination', () => {
test('Should compile postgres project successfully', async () => {
const targetFolder = getAbsolutePath('postgres/target');
const manifest = path.resolve(targetFolder, 'manifest.json');
try {
fs.rmdirSync(targetFolder, { recursive: true });
} catch {
// Ignore
}
assertThat(fs.existsSync(targetFolder), falsy());

await activateAndWaitManifestParsed(getCustomDocUri('postgres/dbt_project.yml'), POSTGRES_PATH);
await analyzeEntireProject();
while (!fs.existsSync(manifest)) {
await sleep(300);
}

assertThat(fs.existsSync(manifest), truthy());
});

test('Should compile postgres documents', async () => {
await activateAndWait(ACTIVE_USERS_URI);

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"displayName": "Wizard for dbt Core (TM)",
"description": "This extension will help you work with dbt",
"icon": "images/Icon.png",
"version": "0.26.0",
"version": "0.26.1",
"publisher": "Fivetran",
"license": "MIT",
"preview": true,
Expand Down
3 changes: 1 addition & 2 deletions server/src/DestinationContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,7 @@ export class DestinationContext {
}

resetTables(): void {
this.ensureProjectAnalyzer(this.projectAnalyzer);
this.projectAnalyzer.resetTables();
this.projectAnalyzer?.resetTables();
}

getColumnsInRelation(db: string | undefined, schema: string | undefined, tableName: string): KnownColumn[] | undefined {
Expand Down

0 comments on commit 2defc0b

Please sign in to comment.