Skip to content

Commit

Permalink
skip dockerized tests in CI on M1 mac
Browse files Browse the repository at this point in the history
  • Loading branch information
benjamincburns committed Oct 20, 2024
1 parent dd64de1 commit b3a4833
Show file tree
Hide file tree
Showing 13 changed files with 62 additions and 14 deletions.
1 change: 1 addition & 0 deletions libs/checkpoint-validation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"@testcontainers/mongodb": "^10.13.2",
"@testcontainers/postgresql": "^10.13.2",
"@tsconfig/recommended": "^1.0.3",
"@types/jest": "^29.5.13",
"@types/uuid": "^10",
"@typescript-eslint/eslint-plugin": "^6.12.0",
"@typescript-eslint/parser": "^6.12.0",
Expand Down
1 change: 0 additions & 1 deletion libs/checkpoint-validation/src/spec/getTuple.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {
uuid6,
type BaseCheckpointSaver,
} from "@langchain/langgraph-checkpoint";
import { describe, it, beforeAll, afterAll, expect } from "@jest/globals";
import { mergeConfigs, RunnableConfig } from "@langchain/core/runnables";
import { CheckpointSaverTestInitializer } from "../types.js";
import { parentAndChildCheckpointTuplesWithWrites } from "./data.js";
Expand Down
1 change: 0 additions & 1 deletion libs/checkpoint-validation/src/spec/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { type BaseCheckpointSaver } from "@langchain/langgraph-checkpoint";
import { describe, beforeAll, afterAll } from "@jest/globals";

import { CheckpointSaverTestInitializer, TestTypeFilter } from "../types.js";
import { putTests } from "./put.js";
Expand Down
1 change: 0 additions & 1 deletion libs/checkpoint-validation/src/spec/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
uuid6,
type BaseCheckpointSaver,
} from "@langchain/langgraph-checkpoint";
import { describe, it, beforeAll, afterAll, expect } from "@jest/globals";
import { mergeConfigs, RunnableConfig } from "@langchain/core/runnables";
import { CheckpointSaverTestInitializer } from "../types.js";
import { generateTuplePairs } from "./data.js";
Expand Down
1 change: 0 additions & 1 deletion libs/checkpoint-validation/src/spec/put.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {
uuid6,
type BaseCheckpointSaver,
} from "@langchain/langgraph-checkpoint";
import { describe, it, afterEach, beforeEach, expect } from "@jest/globals";
import { mergeConfigs, RunnableConfig } from "@langchain/core/runnables";
import { CheckpointSaverTestInitializer } from "../types.js";
import { initialCheckpointTuple } from "./data.js";
Expand Down
1 change: 0 additions & 1 deletion libs/checkpoint-validation/src/spec/putWrites.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {
uuid6,
type BaseCheckpointSaver,
} from "@langchain/langgraph-checkpoint";
import { describe, it, beforeEach, afterEach, expect } from "@jest/globals";
import { mergeConfigs, RunnableConfig } from "@langchain/core/runnables";
import { CheckpointSaverTestInitializer } from "../types.js";
import { initialCheckpointTuple } from "./data.js";
Expand Down
1 change: 0 additions & 1 deletion libs/checkpoint-validation/src/spec/util.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { expect } from "@jest/globals";
import { mergeConfigs, RunnableConfig } from "@langchain/core/runnables";
import {
BaseCheckpointSaver,
Expand Down
6 changes: 2 additions & 4 deletions libs/checkpoint-validation/src/testUtils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { it } from "@jest/globals";

// to make the type signature of the skipOnModules function a bit more readable
export type SaverName = string;
export type WhySkipped = string;
Expand All @@ -21,7 +19,7 @@ export function it_skipForSomeModules(
if (skipReason) {
const skip = (
name: string,
test: () => void | Promise<void>,
test: jest.ProvidesCallback | undefined,
timeout?: number
) => {
it.skip(`[because ${skipReason}] ${name}`, test, timeout);
Expand All @@ -40,7 +38,7 @@ export function it_skipIfNot(
if (!savers.includes(saverName)) {
const skip = (
name: string,
test: () => void | Promise<void>,
test: jest.ProvidesCallback | undefined,
timeout?: number
) => {
it.skip(
Expand Down
7 changes: 6 additions & 1 deletion libs/checkpoint-validation/src/tests/mongodb.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import { specTest } from "../spec/index.js";
import { initializer } from "./mongoInitializer.js";
import { isCI, osHasSupportedContainerRuntime } from "./utils.js";

specTest(initializer);
if (isCI() && osHasSupportedContainerRuntime()) {
specTest(initializer);
} else {
it.skip(`${initializer.saverName} skipped in CI because no container runtime is available`, () => {});
}
7 changes: 6 additions & 1 deletion libs/checkpoint-validation/src/tests/postgres.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import { specTest } from "../spec/index.js";
import { initializer } from "./postgresInitializer.js";
import { isCI, osHasSupportedContainerRuntime } from "./utils.js";

specTest(initializer);
if (isCI() && osHasSupportedContainerRuntime()) {
specTest(initializer);
} else {
it.skip(`${initializer.saverName} skipped in CI because no container runtime is available`, () => {});
}
33 changes: 33 additions & 0 deletions libs/checkpoint-validation/src/tests/utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { platform, arch } from "node:os";

function isMSeriesMac() {
return platform() === "darwin" && arch() === "arm64";
}

function isWindows() {
return platform() === "win32";
}

export function isCI() {
// eslint-disable-next-line no-process-env
return (process.env.CI ?? "").toLowerCase() === "true";
}

/**
* GitHub Actions doesn't support containers on m-series macOS due to a lack of hypervisor support for nested
* virtualization.
*
* For details, see https://github.com/actions/runner-images/issues/9460#issuecomment-1981203045
*
* GitHub actions also doesn't support Linux containers on Windows, and may never do so. This is in part due to Docker
* Desktop licensing restrictions, and the complexity of setting up Moby or similar without Docker Desktop.
* Unfortunately, TestContainers doesn't support windows containers, so we can't run the tests on Windows either.
*
* For details, see https://github.com/actions/runner/issues/904 and
* https://java.testcontainers.org/supported_docker_environment/windows/#windows-container-on-windows-wcow
*
*
*/
export function osHasSupportedContainerRuntime() {
return !isWindows() && !isMSeriesMac();
}
1 change: 1 addition & 0 deletions libs/checkpoint-validation/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"rootDir": "./src",
"target": "ES2021",
"lib": ["ES2021", "ES2022.Object", "DOM"],
"types": ["node", "jest"],
"module": "ES2020",
"moduleResolution": "NodeNext",
"esModuleInterop": true,
Expand Down
15 changes: 13 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1785,6 +1785,7 @@ __metadata:
"@testcontainers/mongodb": ^10.13.2
"@testcontainers/postgresql": ^10.13.2
"@tsconfig/recommended": ^1.0.3
"@types/jest": ^29.5.13
"@types/uuid": ^10
"@typescript-eslint/eslint-plugin": ^6.12.0
"@typescript-eslint/parser": ^6.12.0
Expand Down Expand Up @@ -3494,6 +3495,16 @@ __metadata:
languageName: node
linkType: hard

"@types/jest@npm:^29.5.13":
version: 29.5.13
resolution: "@types/jest@npm:29.5.13"
dependencies:
expect: ^29.0.0
pretty-format: ^29.0.0
checksum: 875ac23c2398cdcf22aa56c6ba24560f11d2afda226d4fa23936322dde6202f9fdbd2b91602af51c27ecba223d9fc3c1e33c9df7e47b3bf0e2aefc6baf13ce53
languageName: node
linkType: hard

"@types/json-schema@npm:^7.0.12":
version: 7.0.15
resolution: "@types/json-schema@npm:7.0.15"
Expand Down Expand Up @@ -6871,7 +6882,7 @@ __metadata:
languageName: node
linkType: hard

"expect@npm:^29.7.0":
"expect@npm:^29.0.0, expect@npm:^29.7.0":
version: 29.7.0
resolution: "expect@npm:29.7.0"
dependencies:
Expand Down Expand Up @@ -10764,7 +10775,7 @@ __metadata:
languageName: node
linkType: hard

"pretty-format@npm:^29.7.0":
"pretty-format@npm:^29.0.0, pretty-format@npm:^29.7.0":
version: 29.7.0
resolution: "pretty-format@npm:29.7.0"
dependencies:
Expand Down

0 comments on commit b3a4833

Please sign in to comment.