Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 7 additions & 10 deletions vscode/extension/tests/bad_setup.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@ import {
test('missing LSP dependencies shows install prompt', async ({
page,
sharedCodeServer,
tempDir,
}) => {
const tempDir = await fs.mkdtemp(
path.join(os.tmpdir(), 'vscode-test-tcloud-'),
)
const pythonEnvDir = path.join(tempDir, '.venv')
const pythonDetails = await createVirtualEnvironment(pythonEnvDir)
const custom_materializations = path.join(
Expand Down Expand Up @@ -60,10 +58,11 @@ test('missing LSP dependencies shows install prompt', async ({
expect(await page.locator('text=Install').count()).toBeGreaterThanOrEqual(1)
})

test('lineage, no sqlmesh found', async ({ page, sharedCodeServer }) => {
const tempDir = await fs.mkdtemp(
path.join(os.tmpdir(), 'vscode-test-tcloud-'),
)
test('lineage, no sqlmesh found', async ({
page,
sharedCodeServer,
tempDir,
}) => {
const pythonEnvDir = path.join(tempDir, '.venv')
const pythonDetails = await createVirtualEnvironment(pythonEnvDir)

Expand Down Expand Up @@ -95,10 +94,8 @@ test('lineage, no sqlmesh found', async ({ page, sharedCodeServer }) => {
test.skip('check that the LSP runs correctly by opening lineage when looking at another file before not in workspace', async ({
page,
sharedCodeServer,
tempDir,
}) => {
const tempDir = await fs.mkdtemp(
path.join(os.tmpdir(), 'vscode-test-tcloud-'),
)
await fs.copy(SUSHI_SOURCE_PATH, tempDir)
const pythonEnvDir = path.join(tempDir, '.venv')
const pythonDetails = await createVirtualEnvironment(pythonEnvDir)
Expand Down
31 changes: 13 additions & 18 deletions vscode/extension/tests/broken_project.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { test, expect } from './fixtures'
import fs from 'fs-extra'
import os from 'os'
import path from 'path'
import {
openLineageView,
Expand All @@ -12,10 +11,11 @@ import {
} from './utils'
import { createPythonInterpreterSettingsSpecifier } from './utils_code_server'

test('bad project, double model', async ({ page, sharedCodeServer }) => {
const tempDir = await fs.mkdtemp(
path.join(os.tmpdir(), 'vscode-test-tcloud-'),
)
test('bad project, double model', async ({
tempDir,
page,
sharedCodeServer,
}) => {
await fs.copy(SUSHI_SOURCE_PATH, tempDir)

// Read the customers.sql file
Expand Down Expand Up @@ -52,11 +52,9 @@ test('bad project, double model', async ({ page, sharedCodeServer }) => {

test('working project, then broken through adding double model, then refixed', async ({
page,
tempDir,
sharedCodeServer,
}) => {
const tempDir = await fs.mkdtemp(
path.join(os.tmpdir(), 'vscode-test-tcloud-'),
)
await fs.copy(SUSHI_SOURCE_PATH, tempDir)

await createPythonInterpreterSettingsSpecifier(tempDir)
Expand Down Expand Up @@ -149,11 +147,9 @@ test('working project, then broken through adding double model, then refixed', a

test('bad project, double model, then fixed', async ({
page,
tempDir,
sharedCodeServer,
}) => {
const tempDir = await fs.mkdtemp(
path.join(os.tmpdir(), 'vscode-test-tcloud-'),
)
await fs.copy(SUSHI_SOURCE_PATH, tempDir)

// Read the customers.sql file
Expand Down Expand Up @@ -218,10 +214,8 @@ test('bad project, double model, then fixed', async ({
test('bad project, double model, check lineage', async ({
page,
sharedCodeServer,
tempDir,
}) => {
const tempDir = await fs.mkdtemp(
path.join(os.tmpdir(), 'vscode-test-tcloud-'),
)
await fs.copy(SUSHI_SOURCE_PATH, tempDir)

// Read the customers.sql file
Expand All @@ -248,10 +242,11 @@ test('bad project, double model, check lineage', async ({
await page.waitForTimeout(500)
})

test('bad model block, then fixed', async ({ page, sharedCodeServer }) => {
const tempDir = await fs.mkdtemp(
path.join(os.tmpdir(), 'vscode-test-tcloud-'),
)
test('bad model block, then fixed', async ({
page,
sharedCodeServer,
tempDir,
}) => {
// Copy over the sushi project
await fs.copy(SUSHI_SOURCE_PATH, tempDir)
await createPythonInterpreterSettingsSpecifier(tempDir)
Expand Down
39 changes: 15 additions & 24 deletions vscode/extension/tests/diagnostics.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import yaml from 'yaml'
test('Workspace diagnostics show up in the diagnostics panel', async ({
page,
sharedCodeServer,
tempDir,
}) => {
const tempDir = await fs.mkdtemp(path.join(os.tmpdir(), 'vscode-test-sushi-'))
await fs.copy(SUSHI_SOURCE_PATH, tempDir)
await createPythonInterpreterSettingsSpecifier(tempDir)

Expand Down Expand Up @@ -55,10 +55,8 @@ test.describe('Bad config.py/config.yaml file issues', () => {
test('sqlmesh init, then corrupted config.yaml, bad yaml', async ({
page,
sharedCodeServer,
tempDir,
}) => {
const tempDir = await fs.mkdtemp(
path.join(os.tmpdir(), 'vscode-test-tcloud-'),
)
await setup(tempDir)
await createPythonInterpreterSettingsSpecifier(tempDir)

Expand Down Expand Up @@ -135,10 +133,8 @@ test.describe('Bad config.py/config.yaml file issues', () => {
test('sushi example, correct python, bad config', async ({
page,
sharedCodeServer,
tempDir,
}) => {
const tempDir = await fs.mkdtemp(
path.join(os.tmpdir(), 'vscode-test-tcloud-'),
)
await fs.copy(SUSHI_SOURCE_PATH, tempDir)
await createPythonInterpreterSettingsSpecifier(tempDir)

Expand Down Expand Up @@ -170,10 +166,11 @@ test.describe('Bad config.py/config.yaml file issues', () => {
await expect(errorElement).toBeVisible({ timeout: 5000 })
})

test('sushi example, bad config.py', async ({ page, sharedCodeServer }) => {
const tempDir = await fs.mkdtemp(
path.join(os.tmpdir(), 'vscode-test-tcloud-'),
)
test('sushi example, bad config.py', async ({
page,
sharedCodeServer,
tempDir,
}) => {
await fs.copy(SUSHI_SOURCE_PATH, tempDir)
await createPythonInterpreterSettingsSpecifier(tempDir)

Expand Down Expand Up @@ -205,10 +202,7 @@ test.describe('Bad config.py/config.yaml file issues', () => {
})

test.describe('Diagnostics for bad SQLMesh models', () => {
test('duplicate model names', async ({ page, sharedCodeServer }) => {
const tempDir = await fs.mkdtemp(
path.join(os.tmpdir(), 'vscode-test-tcloud-'),
)
test('duplicate model names', async ({ page, sharedCodeServer, tempDir }) => {
// Copy over the sushi project
await fs.copy(SUSHI_SOURCE_PATH, tempDir)
await createPythonInterpreterSettingsSpecifier(tempDir)
Expand Down Expand Up @@ -246,10 +240,7 @@ test.describe('Diagnostics for bad SQLMesh models', () => {
.isVisible({ timeout: 5_000 })
})

test('bad model block', async ({ page, sharedCodeServer }) => {
const tempDir = await fs.mkdtemp(
path.join(os.tmpdir(), 'vscode-test-tcloud-'),
)
test('bad model block', async ({ page, sharedCodeServer, tempDir }) => {
// Copy over the sushi project
await fs.copy(SUSHI_SOURCE_PATH, tempDir)
await createPythonInterpreterSettingsSpecifier(tempDir)
Expand Down Expand Up @@ -289,11 +280,11 @@ test.describe('Diagnostics for bad SQLMesh models', () => {
})

test.describe('Diagnostics for bad audits', () => {
test('bad audit block in audit', async ({ page, sharedCodeServer }) => {
const tempDir = await fs.mkdtemp(
path.join(os.tmpdir(), 'vscode-test-tcloud-'),
)

test('bad audit block in audit', async ({
page,
sharedCodeServer,
tempDir,
}) => {
// Copy over the sushi project
await fs.copy(SUSHI_SOURCE_PATH, tempDir)
await createPythonInterpreterSettingsSpecifier(tempDir)
Expand Down
11 changes: 2 additions & 9 deletions vscode/extension/tests/external_models.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import os from 'os'
import {
openServerPage,
SUSHI_SOURCE_PATH,
Expand All @@ -10,12 +9,9 @@ import fs from 'fs-extra'
import path from 'path'

test.describe('External model files trigger lsp', () => {
test('external_models.yaml', async ({ page, sharedCodeServer }) => {
test('external_models.yaml', async ({ page, sharedCodeServer, tempDir }) => {
const file = 'external_models.yaml'

const tempDir = await fs.mkdtemp(
path.join(os.tmpdir(), 'vscode-test-sushi-'),
)
await fs.copy(SUSHI_SOURCE_PATH, tempDir)

// Assert external_models.yaml exists
Expand All @@ -38,12 +34,9 @@ test.describe('External model files trigger lsp', () => {
await waitForLoadedSQLMesh(page)
})

test('external_models.yml', async ({ page, sharedCodeServer }) => {
test('external_models.yml', async ({ page, sharedCodeServer, tempDir }) => {
const file = 'external_models.yml'

const tempDir = await fs.mkdtemp(
path.join(os.tmpdir(), 'vscode-test-sushi-'),
)
await fs.copy(SUSHI_SOURCE_PATH, tempDir)

// Move external_models.yaml to external_models.yml
Expand Down
Loading
Loading