Skip to content
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import { createBuilder, CrdWaitBehavior } from './.aspire/modules/aspire.mjs';
import { fileURLToPath } from 'node:url';

const builder = await createBuilder();
const cluster = await builder.addKindCluster('ts-kind');

let manifestConfigured = false;
const manifest = await cluster.addManifestFromContent('ts-manifest', `
apiVersion: v1
kind: Namespace
metadata:
name: ts-crd-wait
`);
await manifest.withCrdWait(async options => {
await options.timeout.set(120_000);
await options.failureBehavior.set(CrdWaitBehavior.BestEffort);
if (await options.timeout.get() !== 120_000 ||
await options.failureBehavior.get() !== CrdWaitBehavior.BestEffort) {
throw new Error('Manifest CRD-wait options did not round-trip through the generated SDK.');
}
manifestConfigured = true;
});

let chartConfigured = false;
const chart = await cluster.addHelmChart('ts-chart', fileURLToPath(new URL('./chart', import.meta.url)));
await chart.withCrdWait(async options => {
await options.timeout.set(180_000);
await options.failureBehavior.set(CrdWaitBehavior.BestEffort);
if (await options.timeout.get() !== 180_000 ||
await options.failureBehavior.get() !== CrdWaitBehavior.BestEffort) {
throw new Error('Helm CRD-wait options did not round-trip through the generated SDK.');
}
chartConfigured = true;
});

if (!manifestConfigured || !chartConfigured) {
throw new Error('CRD-wait callbacks were not invoked for both Kind builders.');
}

if (await manifest.crdWaitTimeout.get() !== 120_000 ||
await manifest.crdWaitBehavior.get() !== CrdWaitBehavior.BestEffort) {
throw new Error('Manifest CRD-wait policy did not retain the configured options.');
}

await manifest.withCrdWaitTimeout(90_000);
await manifest.withCrdWaitBehavior(CrdWaitBehavior.Fail);
if (await manifest.crdWaitTimeout.get() !== 90_000 ||
await manifest.crdWaitBehavior.get() !== CrdWaitBehavior.Fail) {
throw new Error('Legacy manifest CRD-wait methods did not update the configured options.');
}

await builder.build().run();
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"appHost": {
"path": "apphost.mts",
"language": "typescript/nodejs"
},
"sdk": {
"version": "13.5.0"
},
"packages": {
"CommunityToolkit.Aspire.Hosting.Kind": "../../../src/CommunityToolkit.Aspire.Hosting.Kind/CommunityToolkit.Aspire.Hosting.Kind.csproj"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
apiVersion: v2
name: crd-wait-test
version: 0.1.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: crd-wait-test
data:
test: kind
Loading
Loading