Skip to content

Commit

Permalink
fix more tests?
Browse files Browse the repository at this point in the history
  • Loading branch information
leonitousconforti committed Oct 22, 2024
1 parent d13ce8c commit 75088d8
Show file tree
Hide file tree
Showing 16 changed files with 46 additions and 30 deletions.
4 changes: 2 additions & 2 deletions test/configs.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { expect, layer } from "@effect/vitest";
import { Effect, Layer } from "effect";
import { Duration, Effect, Layer } from "effect";
import { Configs } from "the-moby-effect/MobyEndpoints";
import { testLayer } from "./shared.js";

layer(Layer.fresh(testLayer))("MobyApi Configs tests", (it) => {
layer(Layer.fresh(testLayer), { timeout: Duration.minutes(2) })("MobyApi Configs tests", (it) => {
it.effect("Should see no configs", () =>
Effect.gen(function* () {
const configs = yield* Configs;
Expand Down
4 changes: 2 additions & 2 deletions test/containers.test.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { expect, layer } from "@effect/vitest";
import { Effect, Layer, Stream } from "effect";
import { Duration, Effect, Layer, Stream } from "effect";
import * as DockerEngine from "the-moby-effect/DockerEngine";
import * as Convey from "the-moby-effect/MobyConvey";
import { Containers } from "the-moby-effect/MobyEndpoints";
import { testLayer } from "./shared.js";

layer(Layer.fresh(testLayer))("MobyApi Containers tests", (it) => {
layer(Layer.fresh(testLayer), { timeout: Duration.minutes(2) })("MobyApi Containers tests", (it) => {
it.effect.skip(
"Should create, list, pause, unpause, top, kill, start, restart, stop, rename, changes, prune, and finally force delete a container (this test could be flaky because it pulls the alpine image from docker hub)",
() =>
Expand Down
16 changes: 16 additions & 0 deletions test/demux.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { expect, layer } from "@effect/vitest";
import { Duration, Effect, Layer } from "effect";
import { Distributions } from "the-moby-effect/MobyEndpoints";
import { testLayer } from "./shared.js";

layer(Layer.fresh(testLayer), { timeout: Duration.minutes(2) })("MobyApi Demux tests", (it) => {
it.effect("Should inspect an image", () =>
Effect.gen(function* () {
const distribution = yield* Distributions;
const testData = yield* distribution.inspect({ name: "docker.io/library/docker:dind" });
expect(testData.Platforms).toBeInstanceOf(Array);
expect(testData.Platforms).toHaveLength(8);
expect(testData.Descriptor?.mediaType).toBe("application/vnd.oci.image.index.v1+json");
})
);
});
4 changes: 2 additions & 2 deletions test/distribution.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { expect, layer } from "@effect/vitest";
import { Effect, Layer } from "effect";
import { Duration, Effect, Layer } from "effect";
import { Distributions } from "the-moby-effect/MobyEndpoints";
import { testLayer } from "./shared.js";

layer(Layer.fresh(testLayer))("MobyApi Distribution tests", (it) => {
layer(Layer.fresh(testLayer), { timeout: Duration.minutes(2) })("MobyApi Distribution tests", (it) => {
it.effect("Should inspect an image", () =>
Effect.gen(function* () {
const distribution = yield* Distributions;
Expand Down
4 changes: 2 additions & 2 deletions test/exec.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { expect, layer } from "@effect/vitest";
import { Effect, Layer } from "effect";
import { Duration, Effect, Layer } from "effect";
import { Execs } from "the-moby-effect/MobyEndpoints";
import { testLayer } from "./shared.js";

layer(Layer.fresh(testLayer))("MobyApi Execs tests", (it) => {
layer(Layer.fresh(testLayer), { timeout: Duration.minutes(2) })("MobyApi Execs tests", (it) => {
it.effect("Should create an exec instance", () =>
Effect.gen(function* () {
yield* Execs;
Expand Down
4 changes: 2 additions & 2 deletions test/images.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { expect, layer } from "@effect/vitest";
import { Effect, Layer, Stream } from "effect";
import { Duration, Effect, Layer, Stream } from "effect";
import { Images } from "the-moby-effect/MobyEndpoints";
import { testLayer } from "./shared.js";

layer(Layer.fresh(testLayer))("MobyApi Images tests", (it) => {
layer(Layer.fresh(testLayer), { timeout: Duration.minutes(2) })("MobyApi Images tests", (it) => {
it.effect(
"Should search for an image (this test could be flaky depending on docker hub availability and transient network conditions)",
() =>
Expand Down
4 changes: 2 additions & 2 deletions test/networks.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { layer } from "@effect/vitest";
import { Effect, Layer } from "effect";
import { Duration, Effect, Layer } from "effect";
import { Networks } from "the-moby-effect/MobyEndpoints";
import { testLayer } from "./shared.js";

layer(Layer.fresh(testLayer))("MobyApi Networks tests", (it) => {
layer(Layer.fresh(testLayer), { timeout: Duration.minutes(2) })("MobyApi Networks tests", (it) => {
it.effect("Should list all the networks", () =>
Effect.gen(function* () {
const networks = yield* Networks;
Expand Down
4 changes: 2 additions & 2 deletions test/nodes.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { expect, layer } from "@effect/vitest";
import { Effect, Layer } from "effect";
import { Duration, Effect, Layer } from "effect";
import { Nodes } from "the-moby-effect/MobyEndpoints";
import { testLayer } from "./shared.js";

layer(Layer.fresh(testLayer))("MobyApi Nodes tests", (it) => {
layer(Layer.fresh(testLayer), { timeout: Duration.minutes(2) })("MobyApi Nodes tests", (it) => {
it("Should see and inspect one node", () =>
Effect.gen(function* () {
const nodes = yield* Nodes;
Expand Down
4 changes: 2 additions & 2 deletions test/plugins.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { expect, layer } from "@effect/vitest";
import { Effect, Layer } from "effect";
import { Duration, Effect, Layer } from "effect";
import { Plugins } from "the-moby-effect/MobyEndpoints";
import { testLayer } from "./shared.js";

layer(Layer.fresh(testLayer))("MobyApi Plugins tests", (it) => {
layer(Layer.fresh(testLayer), { timeout: Duration.minutes(2) })("MobyApi Plugins tests", (it) => {
it.effect("Should see no plugins", () =>
Effect.gen(function* () {
const plugins = yield* Plugins;
Expand Down
4 changes: 2 additions & 2 deletions test/secrets.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { expect, layer } from "@effect/vitest";
import { Effect, Layer } from "effect";
import { Duration, Effect, Layer } from "effect";
import { Secrets } from "the-moby-effect/MobyEndpoints";
import { testLayer } from "./shared.js";

layer(Layer.fresh(testLayer))("MobyApi Secrets tests", (it) => {
layer(Layer.fresh(testLayer), { timeout: Duration.minutes(2) })("MobyApi Secrets tests", (it) => {
it.effect("Should see no secrets", () =>
Effect.gen(function* () {
const secrets = yield* Secrets;
Expand Down
4 changes: 2 additions & 2 deletions test/services.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { expect, layer } from "@effect/vitest";
import { Effect, Layer } from "effect";
import { Duration, Effect, Layer } from "effect";
import { Services } from "the-moby-effect/MobyEndpoints";
import { testLayer } from "./shared.js";

layer(Layer.fresh(testLayer))("MobyApi Services tests", (it) => {
layer(Layer.fresh(testLayer), { timeout: Duration.minutes(2) })("MobyApi Services tests", (it) => {
it.effect("Should see no services", () =>
Effect.gen(function* () {
const services = yield* Services;
Expand Down
4 changes: 2 additions & 2 deletions test/session.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { inject, layer } from "@effect/vitest";
import { Effect, Layer } from "effect";
import { Duration, Effect, Layer } from "effect";
import { Sessions } from "the-moby-effect/MobyEndpoints";
import { testLayer } from "./shared.js";

layer(Layer.fresh(testLayer))("MobyApi Session tests", (it) => {
layer(Layer.fresh(testLayer), { timeout: Duration.minutes(2) })("MobyApi Session tests", (it) => {
it.scoped.skipIf(inject("__PLATFORM_VARIANT").includes("undici"))("Should be able to request a session", () =>
Effect.gen(function* () {
const sessions = yield* Sessions;
Expand Down
4 changes: 2 additions & 2 deletions test/swarm.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { expect, layer } from "@effect/vitest";
import { Effect, Layer } from "effect";
import { Duration, Effect, Layer } from "effect";
import { Swarm } from "the-moby-effect/MobyEndpoints";
import { testLayer } from "./shared.js";

layer(Layer.fresh(testLayer))("MobyApi Swarm tests", (it) => {
layer(Layer.fresh(testLayer), { timeout: Duration.minutes(2) })("MobyApi Swarm tests", (it) => {
it.effect("Should leave, rejoin, unlock, update, and get the unlock key of the swarm", () =>
Effect.gen(function* () {
const swarm = yield* Swarm;
Expand Down
4 changes: 2 additions & 2 deletions test/system.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { expect, layer } from "@effect/vitest";
import { Effect, Layer, Stream } from "effect";
import { Duration, Effect, Layer, Stream } from "effect";
import { Systems } from "the-moby-effect/MobyEndpoints";
import { testLayer } from "./shared.js";

layer(Layer.fresh(testLayer))("MobyApi System tests", (it) => {
layer(Layer.fresh(testLayer), { timeout: Duration.minutes(2) })("MobyApi System tests", (it) => {
it.effect("Should ping the docker daemon", () =>
Effect.gen(function* () {
const system = yield* Systems;
Expand Down
4 changes: 2 additions & 2 deletions test/tasks.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { expect, layer } from "@effect/vitest";
import { Effect, Layer } from "effect";
import { Duration, Effect, Layer } from "effect";
import { Tasks } from "the-moby-effect/MobyEndpoints";
import { testLayer } from "./shared.js";

layer(Layer.fresh(testLayer))("MobyApi Tasks tests", (it) => {
layer(Layer.fresh(testLayer), { timeout: Duration.minutes(2) })("MobyApi Tasks tests", (it) => {
it.effect("Should see no tasks", () =>
Effect.gen(function* () {
const tasks = yield* Tasks;
Expand Down
4 changes: 2 additions & 2 deletions test/volumes.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { expect, layer } from "@effect/vitest";
import { Effect, Layer } from "effect";
import { Duration, Effect, Layer } from "effect";
import { Volumes } from "the-moby-effect/MobyEndpoints";
import { testLayer } from "./shared.js";

layer(Layer.fresh(testLayer))("MobyApi Volumes tests", (it) => {
layer(Layer.fresh(testLayer), { timeout: Duration.minutes(2) })("MobyApi Volumes tests", (it) => {
it.effect("Should see no volumes", () =>
Effect.gen(function* () {
const volumes = yield* Volumes;
Expand Down

0 comments on commit 75088d8

Please sign in to comment.