@appthrust/kest 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -2
- package/package.json +2 -2
- package/ts/actions/apply.ts +3 -1
- package/ts/kubectl/index.ts +18 -5
package/README.md
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
# Kest
|
|
2
2
|
|
|
3
|
+

|
|
4
|
+
|
|
3
5
|
> **Preview Release** -- Kest is currently in `0.x` preview. The API may change based on feedback. Breaking changes can occur in any `0.x` release. A stable `1.0.0` will be released once the API solidifies. Feel free to [open an issue](https://github.com/appthrust/kest/issues/new) if you have any feedback.
|
|
4
6
|
|
|
5
|
-
**
|
|
7
|
+
**Kubernetes E2E testing designed for humans and AI alike**
|
|
6
8
|
|
|
7
|
-
Kest makes it easy to write reliable end-to-end tests for Kubernetes controllers, operators, and admission webhooks. You write test scenarios in TypeScript with full type safety, autocompletion, and the familiar `expect()` API.
|
|
9
|
+
Kest makes it easy to write reliable end-to-end tests for Kubernetes controllers, operators, and admission webhooks. You write test scenarios in TypeScript with full type safety, autocompletion, and the familiar `expect()` API. When a test fails, Kest generates structured Markdown reports that are easy for humans to scan and for AI assistants to parse -- making troubleshooting straightforward regardless of who (or what) is debugging.
|
|
8
10
|
|
|
9
11
|
```ts
|
|
10
12
|
import { expect } from "bun:test";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appthrust/kest",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.1.2",
|
|
4
|
+
"description": "Kubernetes E2E testing framework designed for humans and AI alike",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "ts/index.ts",
|
|
7
7
|
"exports": {
|
package/ts/actions/apply.ts
CHANGED
|
@@ -17,7 +17,9 @@ export const apply = {
|
|
|
17
17
|
await kubectl.apply(result.value);
|
|
18
18
|
return {
|
|
19
19
|
async revert() {
|
|
20
|
-
await kubectl.delete(result.value.kind, result.value.metadata.name
|
|
20
|
+
await kubectl.delete(result.value.kind, result.value.metadata.name, {
|
|
21
|
+
ignoreNotFound: true,
|
|
22
|
+
});
|
|
21
23
|
},
|
|
22
24
|
output: undefined,
|
|
23
25
|
};
|
package/ts/kubectl/index.ts
CHANGED
|
@@ -126,17 +126,26 @@ export interface Kubectl {
|
|
|
126
126
|
*
|
|
127
127
|
* @param resource - The resource type (e.g., "configmap", "namespace")
|
|
128
128
|
* @param name - The name of the resource to delete
|
|
129
|
-
* @param
|
|
129
|
+
* @param options - Optional delete options (ignoreNotFound, context)
|
|
130
130
|
* @returns The trimmed stdout from kubectl (e.g., "configmap \"my-config\" deleted")
|
|
131
131
|
* @throws Error if kubectl exits with non-zero code
|
|
132
132
|
*/
|
|
133
133
|
delete(
|
|
134
134
|
resource: string,
|
|
135
135
|
name: string,
|
|
136
|
-
|
|
136
|
+
options?: KubectlDeleteOptions
|
|
137
137
|
): Promise<string>;
|
|
138
138
|
}
|
|
139
139
|
|
|
140
|
+
export interface KubectlDeleteOptions {
|
|
141
|
+
/**
|
|
142
|
+
* If true, adds `--ignore-not-found` so that deleting a resource
|
|
143
|
+
* that does not exist succeeds silently instead of failing.
|
|
144
|
+
*/
|
|
145
|
+
readonly ignoreNotFound?: undefined | boolean;
|
|
146
|
+
readonly context?: undefined | KubectlContext;
|
|
147
|
+
}
|
|
148
|
+
|
|
140
149
|
export class RealKubectl implements Kubectl {
|
|
141
150
|
private readonly recorder: Recorder;
|
|
142
151
|
private readonly cwd: undefined | string;
|
|
@@ -260,13 +269,17 @@ export class RealKubectl implements Kubectl {
|
|
|
260
269
|
async delete(
|
|
261
270
|
resource: string,
|
|
262
271
|
name: string,
|
|
263
|
-
|
|
272
|
+
options?: KubectlDeleteOptions
|
|
264
273
|
): Promise<string> {
|
|
274
|
+
const args: [string, ...Array<string>] = ["delete", `${resource}/${name}`];
|
|
275
|
+
if (options?.ignoreNotFound) {
|
|
276
|
+
args.push("--ignore-not-found");
|
|
277
|
+
}
|
|
265
278
|
return await this.runKubectl({
|
|
266
|
-
args
|
|
279
|
+
args,
|
|
267
280
|
stdoutLanguage: "text",
|
|
268
281
|
stderrLanguage: "text",
|
|
269
|
-
overrideContext: context,
|
|
282
|
+
overrideContext: options?.context,
|
|
270
283
|
});
|
|
271
284
|
}
|
|
272
285
|
|