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,40 @@
import { createBuilder } from './.modules/aspire.js';

const builder = await createBuilder();

// addK6 — minimal overload (defaults)
const defaultK6 = await builder.addK6("k6-default");

// addK6 — exercise optional parameters
const browserK6 = await builder.addK6("k6-browser", {
enableBrowserExtensions: true,
port: 6566
});

// withBindMount — mount the local scripts directory into each container
await defaultK6.withBindMount("./scripts", "/scripts", { isReadOnly: true });
await browserK6.withBindMount("./scripts", "/scripts", { isReadOnly: true });

// withScript — default optional parameters
await defaultK6.withScript("/scripts/main.js");

// withK6OtlpEnvironment — no-arg fluent method
await defaultK6.withK6OtlpEnvironment();

// withScript — explicit optional parameters
await browserK6.withScript("/scripts/main.js", {
virtualUsers: 5,
duration: "45s"
});

// withK6OtlpEnvironment — chain on second resource too
await browserK6.withK6OtlpEnvironment();

// ---- Property access on K6Resource (ExposeProperties = true) ----
const defaultK6Resource = await defaultK6;
const _defaultPrimaryEndpoint = await defaultK6Resource.primaryEndpoint.get();

const browserK6Resource = await browserK6;
const _browserPrimaryEndpoint = await browserK6Resource.primaryEndpoint.get();

await builder.build().run();
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"appHost": {
"path": "apphost.ts",
"language": "typescript/nodejs"
},
"profiles": {
"https": {
"applicationUrl": "https://localhost:29750;http://localhost:28931",
"environmentVariables": {
"ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:10975",
"ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:13319"
}
}
},
"packages": {
"CommunityToolkit.Aspire.Hosting.k6": ""
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// @ts-check

import { defineConfig } from 'eslint/config';
import tseslint from 'typescript-eslint';

export default defineConfig({
files: ['apphost.ts'],
extends: [tseslint.configs.base],
languageOptions: {
parserOptions: {
projectService: true,
},
},
rules: {
'@typescript-eslint/no-floating-promises': ['error', { checkThenables: true }],
},
});
Loading
Loading