t3-code-android-nightly/.repos/alchemy-effect/packages/alchemy/test/GCP/GKEBackup/RestoreChannel.test.ts
Julius Marminge 6f9cea00ae
chore(refs): sync Effect and Alchemy references to 4.0.1 and beta.80 (#16170)
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-05 13:22:30 -07:00

70 lines
2.2 KiB
TypeScript

import { GcpEnvironment } from "@/GCP/Environment";
import * as GCP from "@/GCP";
import * as Test from "@/Test/Alchemy";
import * as gkebackup from "@distilled.cloud/gcp/gkebackup_v1";
import { expect } from "alchemy-test";
import * as Effect from "effect/Effect";
import { MinimumLogLevel } from "effect/References";
const { test } = Test.make({ providers: GCP.providers() });
const logLevel = Effect.provideService(
MinimumLogLevel,
process.env.DEBUG ? "Debug" : "Info",
);
test.provider(
"getProjectsLocationsRestoreChannels on a missing channel fails with a typed tag",
(stack) =>
Effect.gen(function* () {
const { project } = yield* GcpEnvironment.current;
yield* stack.destroy();
const error = yield* Effect.flip(
gkebackup.getProjectsLocationsRestoreChannels({
name: `projects/${project}/locations/us-central1/restoreChannels/alchemy-missing-channel`,
}),
);
expect(error._tag).toEqual("NotFound");
const page = yield* gkebackup.listProjectsLocationsRestoreChannels({
parent: `projects/${project}/locations/-`,
pageSize: 10,
});
expect(
(page.restoreChannels ?? []).map((item) => item.name),
).not.toContain(
`projects/${project}/locations/us-central1/restoreChannels/alchemy-missing-channel`,
);
yield* stack.destroy();
}).pipe(logLevel),
{ tags: ["provider:gcp", "provider:gcp:gkebackup", "live"], timeout: 90_000 },
);
test.provider(
"create with same-project destination is rejected with BadRequest",
(stack) =>
Effect.gen(function* () {
const { project } = yield* GcpEnvironment.current;
yield* stack.destroy();
const error = yield* Effect.flip(
stack.deploy(
Effect.gen(function* () {
return yield* GCP.GKEBackup.RestoreChannel("Channel", {
destinationProject: `projects/${project}`,
description: "alchemy-test-channel",
labels: { env: "test" },
});
}),
),
);
expect(error._tag).toEqual("BadRequest");
yield* stack.destroy();
}).pipe(logLevel),
{ tags: ["provider:gcp", "provider:gcp:gkebackup", "live"], timeout: 90_000 },
);