From 8227c90e8cae974b194f01949131f74533527c1d Mon Sep 17 00:00:00 2001 From: dvirtz Date: Thu, 19 Oct 2023 17:04:38 +0100 Subject: [PATCH] test: exclude parquet-tools when running on M1 it fails with ``` org.xerial.snappy.SnappyError: [FAILED_TO_LOAD_NATIVE_LIBRARY] no native library is found for os.name=Mac and os.arch=aarch64 ``` --- .cspell.json | 3 ++- .../parquet-editor-provider.test.ts | 24 ++++++++++++------- test/unit/backend.test.ts | 7 ++++-- 3 files changed, 23 insertions(+), 11 deletions(-) diff --git a/.cspell.json b/.cspell.json index 99b2469..daffefd 100644 --- a/.cspell.json +++ b/.cspell.json @@ -34,7 +34,8 @@ "languageId": "git", "ignoreRegExpList": [ "/#\\s.*/", // comments - "/`.*?`/" // inline code + "/`.*?`/", // inline code + "/(```+)\\s?[\\s\\S]+?\\1/g" // code block ] } ] diff --git a/test/integration/parquet-editor-provider.test.ts b/test/integration/parquet-editor-provider.test.ts index 4ce9d42..2ba14ed 100644 --- a/test/integration/parquet-editor-provider.test.ts +++ b/test/integration/parquet-editor-provider.test.ts @@ -1,12 +1,13 @@ import { afterEach, beforeEach, describe, expect, jest, test } from '@jest/globals'; +import os from 'os'; import * as path from 'path'; import * as vscode from 'vscode'; -import { BackendName } from '../../src/backend-name'; import { initLogger } from '../../src/logger'; import { ParquetTextDocumentContentProvider } from "../../src/parquet-document-provider"; import { ParquetEditorProvider } from "../../src/parquet-editor-provider"; import * as settings from '../../src/settings'; import { getUri, readFile } from "./utils"; +import { BackendName } from '../../src/backend-name'; jest.setTimeout(60000); @@ -54,13 +55,20 @@ describe('ParquetEditorProvider', function () { return uri; } - test.each<[string, BackendName]>([ - ['small', 'parquet-tools'], - ['small', 'parquets'], - ['small', 'arrow'], - ['large', 'parquets'], - ['version_2', 'arrow'] - ])('shows %p using %p', async function (name, backend) { + const tests = (() => { + const tests: [string, BackendName][] = [ + ['small', 'parquets'], + ['small', 'arrow'], + ['large', 'parquets'], + ['version_2', 'arrow'] + ]; + if (os.type() != 'Darwin' || os.arch() == 'x64') { + return tests.concat([['small', 'parquet-tools']]); + } + return tests; + })(); + + test.each(tests)('shows %p using %p', async function (name, backend) { const parquet = await getUri(`${name}.parquet`); testFile = await copyTo(`${name}-${backend}.parquet`, parquet); const checkChanged = new Promise((resolve, reject) => { diff --git a/test/unit/backend.test.ts b/test/unit/backend.test.ts index f50b5e7..98e03c4 100644 --- a/test/unit/backend.test.ts +++ b/test/unit/backend.test.ts @@ -1,17 +1,20 @@ import toArray from '@async-generators/to-array'; import { afterEach, describe, expect, jest, test } from '@jest/globals'; import { createReadStream } from 'fs'; +import os from 'os'; import * as path from 'path'; import { createInterface } from 'readline'; +import * as vscode from 'vscode'; import { CancellationToken } from 'vscode'; import { BackendNames } from '../../src/backend-name'; import { createParquetBackend } from '../../src/parquet-backend-factory'; -import * as vscode from 'vscode'; import { workspace } from './workspace'; jest.setTimeout(60000); -describe.each(BackendNames)("%s backend tests", (backendName) => { +// parquet-tools doesn't work on Apple M1 +const backends = BackendNames.filter(backend => os.type() != 'Darwin' || os.arch() == 'x64' || backend != 'parquet-tools'); +describe.each(backends)("%s backend tests", (backendName) => { const backend = createParquetBackend(backendName); const testFiles = {