Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(tests): use DEFAULT_SDK #113

Merged
merged 1 commit into from
Oct 22, 2024
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
2 changes: 1 addition & 1 deletion apps/cli/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@
*/
const DEFAULT_FORMAT = "ext2";
const DEFAULT_RAM = "128Mi";
const DEFAULT_RAM_IMAGE_DOCKER = "/usr/share/cartesi-machine/images/linux.bin";

Check warning on line 77 in apps/cli/src/config.ts

View workflow job for this annotation

GitHub Actions / lint

'DEFAULT_RAM_IMAGE_DOCKER' is assigned a value but never used

Check warning on line 77 in apps/cli/src/config.ts

View workflow job for this annotation

GitHub Actions / build

'DEFAULT_RAM_IMAGE_DOCKER' is assigned a value but never used
const DEFAULT_RAM_IMAGE_LINUX = "/usr/share/cartesi-machine/images/linux.bin";
const DEFAULT_RAM_IMAGE_MAC =
"/opt/homebrew/share/cartesi-machine/images/linux.bin";
const DEFAULT_SDK = "cartesi/sdk:0.12.0-alpha.0";
export const DEFAULT_SDK = "cartesi/sdk:0.12.0-alpha.0";

type Builder = "directory" | "docker" | "empty" | "none" | "tar";
type DriveFormat = "ext2" | "sqfs";
Expand Down
4 changes: 2 additions & 2 deletions apps/cli/test/builder/directory.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import fs from "fs-extra";
import path from "path";
import { describe, expect } from "vitest";
import { build } from "../../src/builder/directory";
import { DirectoryDriveConfig } from "../../src/config";
import { DEFAULT_SDK, DirectoryDriveConfig } from "../../src/config";
import { tmpdirTest } from "./tmpdirTest";

describe("when building with the directory builder", () => {
const image = "cartesi/sdk:0.11.0";
const image = DEFAULT_SDK;

tmpdirTest(
"should fail when the directory doesn't exists",
Expand Down
4 changes: 2 additions & 2 deletions apps/cli/test/builder/docker.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import { beforeEach } from "node:test";
import path from "path";
import { describe, expect } from "vitest";
import { build } from "../../src/builder/docker";
import { DockerDriveConfig } from "../../src/config";
import { DEFAULT_SDK, DockerDriveConfig } from "../../src/config";
import { tmpdirTest } from "./tmpdirTest";

describe("when building with the docker builder", () => {
const image = "cartesi/sdk:0.11.0";
const image = DEFAULT_SDK;

beforeEach(({ name }) => {
fs.mkdirpSync(path.join(__dirname, "output", name));
Expand Down
4 changes: 2 additions & 2 deletions apps/cli/test/builder/empty.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import fs from "fs-extra";
import path from "path";
import { describe, expect } from "vitest";
import { build } from "../../src/builder/empty";
import { EmptyDriveConfig } from "../../src/config";
import { DEFAULT_SDK, EmptyDriveConfig } from "../../src/config";
import { tmpdirTest } from "./tmpdirTest";

describe("when building with the empty builder", () => {
const image = "cartesi/sdk:0.11.0";
const image = DEFAULT_SDK;

tmpdirTest("should fail with an invalid size", async ({ tmpdir }) => {
const destination = tmpdir;
Expand Down
4 changes: 2 additions & 2 deletions apps/cli/test/builder/tar.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import fs from "fs-extra";
import path from "path";
import { describe, expect } from "vitest";
import { build } from "../../src/builder/tar";
import { TarDriveConfig } from "../../src/config";
import { DEFAULT_SDK, TarDriveConfig } from "../../src/config";
import { tmpdirTest } from "./tmpdirTest";

describe("when building with the tar builder", () => {
const image = "cartesi/sdk:0.11.0";
const image = DEFAULT_SDK;

tmpdirTest("should not build a missing file", async ({ tmpdir }) => {
const destination = tmpdir;
Expand Down
3 changes: 2 additions & 1 deletion apps/cli/test/exec/cartesi-machine.test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { satisfies } from "semver";
import { describe, expect, it } from "vitest";
import { DEFAULT_SDK } from "../../src/config.js";
import { cartesiMachine } from "../../src/exec/index.js";

describe("cartesi-machine", () => {
it("should report version", async () => {
const version = await cartesiMachine.version({
forceDocker: true,
image: "cartesi/sdk:0.11.0",
image: DEFAULT_SDK,
});
expect(version).toBeDefined();
expect(
Expand Down
3 changes: 2 additions & 1 deletion apps/cli/test/exec/crane.test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { satisfies } from "semver";
import { describe, expect, it } from "vitest";
import { DEFAULT_SDK } from "../../src/config.js";
import { crane } from "../../src/exec/index.js";

describe("crane", () => {
it("should report version", async () => {
const version = await crane.version({
forceDocker: true,
image: "cartesi/sdk:0.11.0",
image: DEFAULT_SDK,
});
expect(version).toBeDefined();
expect(
Expand Down
3 changes: 2 additions & 1 deletion apps/cli/test/exec/genext2fs.test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { satisfies } from "semver";
import { describe, expect, it } from "vitest";
import { DEFAULT_SDK } from "../../src/config.js";
import { genext2fs } from "../../src/exec/index.js";

describe("genext2fs", () => {
it("should report version", async () => {
const version = await genext2fs.version({
forceDocker: true,
image: "cartesi/sdk:0.11.0",
image: DEFAULT_SDK,
});

expect(version).toBeDefined();
Expand Down
3 changes: 2 additions & 1 deletion apps/cli/test/exec/mksquashfs.test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { satisfies } from "semver";
import { describe, expect, it } from "vitest";
import { DEFAULT_SDK } from "../../src/config.js";
import { mksquashfs } from "../../src/exec/index.js";

describe("mksquashfs", () => {
it("should report version", async () => {
const version = await mksquashfs.version({
forceDocker: true,
image: "cartesi/sdk:0.11.0",
image: DEFAULT_SDK,
});
expect(version).toBeDefined();
expect(
Expand Down
Loading