mirror of
https://github.com/VibedByKaKi/t3-code-android-nightly.git
synced 2026-10-15 06:47:44 +02:00
70 lines
2.2 KiB
TypeScript
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 },
|
|
);
|