Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

Delete fuzzing workflow (#68880)

Fraser27fd3aac3645
diff --git a/.github/workflows/fuzzing.yml b/.github/workflows/fuzzing.yml
deleted file mode 100644
index 554408c1ba3..00000000000
--- a/.github/workflows/fuzzing.yml
+++ /dev/null
@@ -1,56 +0,0 @@
-name: Fuzzing
-
-on:
- workflow_dispatch:
- push:
- branches:
- - "master"
- - "release-**"
- paths:
- - "frontend/src/metabase/querying/expressions/**"
- pull_request:
- paths:
- - "frontend/src/metabase/querying/expressions/**"
-
-jobs:
- fe-fuzz-lexifier:
- runs-on: ubuntu-22.04
- timeout-minutes: 15
- steps:
- - uses: actions/checkout@v4
- - name: Prepare front-end environment
- uses: ./.github/actions/prepare-frontend
- - name: Prepare back-end environment
- uses: ./.github/actions/prepare-backend
- - run: yarn test-unit frontend/src/metabase/querying/expressions/pratt/fuzz.lexifier.unit.spec.ts
- env:
- MB_FUZZ: 1
- name: Run fuzz testing on the lexifier
-
- fe-fuzz-compiler:
- runs-on: ubuntu-22.04
- timeout-minutes: 15
- steps:
- - uses: actions/checkout@v4
- - name: Prepare front-end environment
- uses: ./.github/actions/prepare-frontend
- - name: Prepare back-end environment
- uses: ./.github/actions/prepare-backend
- - run: yarn test-unit frontend/src/metabase/querying/expressions/fuzz.compiler.unit.spec.ts
- env:
- MB_FUZZ: 1
- name: Run fuzz testing on the custom expression compiler
-
- fe-fuzz-string-quoting:
- runs-on: ubuntu-22.04
- timeout-minutes: 15
- steps:
- - uses: actions/checkout@v4
- - name: Prepare front-end environment
- uses: ./.github/actions/prepare-frontend
- - name: Prepare back-end environment
- uses: ./.github/actions/prepare-backend
- - run: yarn test-unit frontend/src/metabase/querying/expressions/fuzz.string.unit.spec.ts
- env:
- MB_FUZZ: 1
- name: Run fuzz testing on the custom expression string quoter
diff --git a/frontend/src/metabase/querying/expressions/fuzz.compiler.unit.spec.ts b/frontend/src/metabase/querying/expressions/fuzz.compiler.unit.spec.ts
deleted file mode 100644
index 2127da54d83..00000000000
--- a/frontend/src/metabase/querying/expressions/fuzz.compiler.unit.spec.ts
+++ /dev/null
@@ -1,63 +0,0 @@
-import * as Lib from "metabase-lib";
-
-import { compileExpression } from "./compile-expression";
-import { fuzz } from "./test/fuzz";
-import { generateExpression } from "./test/generator";
-import { query, stageIndex } from "./test/shared";
-
-/*
- * TODO: This is set to a very low value because the memory
- * blows up in CI. We should figure out why and increase it again.
- */
-const MAX_SEED = 5;
-
-function compile(
- expression: string,
- expressionMode: Lib.ExpressionMode = "expression",
-) {
- const columns = Lib.expressionableColumns(query, stageIndex);
-
- const result = compileExpression({
- source: expression,
- query,
- stageIndex,
- expressionMode,
- availableColumns: columns,
- resolver() {
- return columns[0];
- },
- });
- if (result.error) {
- throw result.error;
- }
-}
-
-beforeAll(() => {
- console.warn = () => undefined;
-});
-
-describe("metabase/querying/expressions/compiler", () => {
- // quick sanity check before the real fuzzing
- it("should parse custom expression", () => {
- expect(() => compile("CASE([Deal],[Price]*7e-1,[Price])")).not.toThrow();
- });
-});
-
-fuzz("FUZZING metabase/querying/expressions/compiler", () => {
- for (let seed = 1; seed < MAX_SEED; ++seed) {
- it("should parse generated number expression from seed " + seed, () => {
- const { expression } = generateExpression(seed, "number");
- expect(() => compile(expression)).not.toThrow();
- });
-
- it("should parse generated string expression from seed " + seed, () => {
- const { expression } = generateExpression(seed, "string");
- expect(() => compile(expression)).not.toThrow();
- });
-
- it("should parse generated boolean expression from seed " + seed, () => {
- const { expression } = generateExpression(seed, "boolean");
- expect(() => compile(expression, "filter")).not.toThrow();
- });
- }
-});
diff --git a/frontend/src/metabase/querying/expressions/fuzz.string.unit.spec.ts b/frontend/src/metabase/querying/expressions/fuzz.string.unit.spec.ts
deleted file mode 100644
index 88c75b78a6b..00000000000
--- a/frontend/src/metabase/querying/expressions/fuzz.string.unit.spec.ts
+++ /dev/null
@@ -1,78 +0,0 @@
-import { quoteString, unquoteString } from "./string";
-import { fuzz } from "./test/fuzz";
-import { createRandom } from "./test/generator";
-
-const MAX_SEED = 1000;
-
-const simple = [
- ..."abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_(){}",
-];
-
-const special = ["\\n", "\\r", "\\f", "\\b", "\\t", "\\v"];
-
-const alphabet = [
- ...simple,
- ...simple.map((char) => `\\${char}`).filter((str) => !special.includes(str)),
- ..."\n\r\t\f\b\v",
- ..."[]'\"`",
- "\\\\",
-];
-
-function randomString(seed: number): string {
- const random = createRandom(seed);
-
- const randomInt = (max: number): number => Math.floor(max * random());
- const randomChar = () => alphabet[randomInt(alphabet.length)];
-
- const len = randomInt(100);
- const res = [];
- for (let i = 0; i < len; i++) {
- res.push(randomChar());
- }
- return res.join("");
-}
-
-describe("metabase/querying/expressions/compiler", () => {
- it("should parse a convoluted string with single quotes", () => {
- const str = alphabet.join("");
-
- const quoted = quoteString(str, "'");
- const unquoted = unquoteString(quoted);
-
- expect(unquoted).toEqual(str);
- });
-
- it("should parse a convoluted string with double quotes", () => {
- const str = alphabet.join("");
-
- const quoted = quoteString(str, '"');
- const unquoted = unquoteString(quoted);
-
- expect(unquoted).toEqual(str);
- });
-
- it("should parse a convoluted string with brackets", () => {
- const str = alphabet.join("");
-
- const quoted = quoteString(str, "[");
- const unquoted = unquoteString(quoted);
-
- expect(unquoted).toEqual(str);
- });
-});
-
-fuzz("metabase/querying/expressions/string", () => {
- const QUOTES = ["'", '"', "["] as const;
-
- QUOTES.forEach((QUOTE) => {
- for (let seed = 0; seed <= MAX_SEED; seed++) {
- it(`should round trip strings through ${QUOTE} (seed=${seed})`, () => {
- const str = randomString(seed);
- const quoted = quoteString(str, QUOTE);
- const unquoted = unquoteString(quoted);
-
- expect(unquoted).toEqual(str);
- });
- }
- });
-});
diff --git a/frontend/src/metabase/querying/expressions/pratt/fuzz.lexifier.unit.spec.ts b/frontend/src/metabase/querying/expressions/pratt/fuzz.lexifier.unit.spec.ts
deleted file mode 100644
index 297621c0ed9..00000000000
--- a/frontend/src/metabase/querying/expressions/pratt/fuzz.lexifier.unit.spec.ts
+++ /dev/null
@@ -1,21 +0,0 @@
-import { lexify } from "../pratt/lexifier";
-import { fuzz } from "../test/fuzz";
-import { generateExpression } from "../test/generator";
-
-describe("metabase/querying/expressions/tokenizer", () => {
- // quick sanity check before the real fuzzing
- it("should tokenize custom expression", () => {
- expect(() => lexify("CASE([Deal],[Price]*7e-1,[Price]")).not.toThrow();
- });
-});
-
-fuzz("FUZZING metabas/querying/expressions/lexifier", () => {
- const MAX_SEED = 2e4;
-
- for (let seed = 0; seed < MAX_SEED; ++seed) {
- it("should handle generated expression from seed " + seed, () => {
- const { expression } = generateExpression(seed);
- expect(() => lexify(expression)).not.toThrow();
- });
- }
-});
diff --git a/frontend/src/metabase/querying/expressions/test/fuzz.ts b/frontend/src/metabase/querying/expressions/test/fuzz.ts
deleted file mode 100644
index a6b4d68d954..00000000000
--- a/frontend/src/metabase/querying/expressions/test/fuzz.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-import _ from "underscore";
-
-export const fuzz = process.env.MB_FUZZ ? describe : _.noop;