@appthrust/kest 0.8.0 → 0.9.0
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/package.json
CHANGED
|
@@ -10,8 +10,15 @@ export const assertAbsence = {
|
|
|
10
10
|
async <T extends K8sResource>(
|
|
11
11
|
resource: K8sResourceReference<T>
|
|
12
12
|
): Promise<void> => {
|
|
13
|
+
const overrideContext = resource.namespace
|
|
14
|
+
? { namespace: resource.namespace }
|
|
15
|
+
: undefined;
|
|
13
16
|
try {
|
|
14
|
-
await kubectl.get(
|
|
17
|
+
await kubectl.get(
|
|
18
|
+
toKubectlType(resource),
|
|
19
|
+
resource.name,
|
|
20
|
+
overrideContext
|
|
21
|
+
);
|
|
15
22
|
} catch (error) {
|
|
16
23
|
if (isNotFoundError(error)) {
|
|
17
24
|
return;
|
|
@@ -11,7 +11,13 @@ export const assertList = {
|
|
|
11
11
|
async <T extends K8sResource>(
|
|
12
12
|
condition: ResourceListTest<T>
|
|
13
13
|
): Promise<Array<T>> => {
|
|
14
|
-
const
|
|
14
|
+
const overrideContext = condition.namespace
|
|
15
|
+
? { namespace: condition.namespace }
|
|
16
|
+
: undefined;
|
|
17
|
+
const yaml = await kubectl.list(
|
|
18
|
+
toKubectlType(condition),
|
|
19
|
+
overrideContext
|
|
20
|
+
);
|
|
15
21
|
const result = parseK8sResourceListYaml(yaml);
|
|
16
22
|
if (!result.ok) {
|
|
17
23
|
throw new Error(
|
package/ts/actions/assert-one.ts
CHANGED
|
@@ -11,7 +11,13 @@ export const assertOne = {
|
|
|
11
11
|
async <T extends K8sResource>(
|
|
12
12
|
condition: ResourceOneTest<T>
|
|
13
13
|
): Promise<T> => {
|
|
14
|
-
const
|
|
14
|
+
const overrideContext = condition.namespace
|
|
15
|
+
? { namespace: condition.namespace }
|
|
16
|
+
: undefined;
|
|
17
|
+
const yaml = await kubectl.list(
|
|
18
|
+
toKubectlType(condition),
|
|
19
|
+
overrideContext
|
|
20
|
+
);
|
|
15
21
|
const result = parseK8sResourceListYaml(yaml);
|
|
16
22
|
if (!result.ok) {
|
|
17
23
|
throw new Error(
|
package/ts/actions/assert.ts
CHANGED
|
@@ -8,7 +8,14 @@ export const assert = {
|
|
|
8
8
|
query:
|
|
9
9
|
({ kubectl }: Deps) =>
|
|
10
10
|
async <T extends K8sResource>(condition: ResourceTest<T>): Promise<T> => {
|
|
11
|
-
const
|
|
11
|
+
const overrideContext = condition.namespace
|
|
12
|
+
? { namespace: condition.namespace }
|
|
13
|
+
: undefined;
|
|
14
|
+
const yaml = await kubectl.get(
|
|
15
|
+
toKubectlType(condition),
|
|
16
|
+
condition.name,
|
|
17
|
+
overrideContext
|
|
18
|
+
);
|
|
12
19
|
const result = parseK8sResourceYaml(yaml);
|
|
13
20
|
if (!result.ok) {
|
|
14
21
|
throw new Error(
|
package/ts/actions/delete.ts
CHANGED
|
@@ -8,7 +8,14 @@ export const deleteResource = {
|
|
|
8
8
|
mutate:
|
|
9
9
|
({ kubectl }) =>
|
|
10
10
|
async <T extends K8sResource>(resource: K8sResourceReference<T>) => {
|
|
11
|
-
|
|
11
|
+
const overrideContext = resource.namespace
|
|
12
|
+
? { context: { namespace: resource.namespace } }
|
|
13
|
+
: undefined;
|
|
14
|
+
await kubectl.delete(
|
|
15
|
+
toKubectlType(resource),
|
|
16
|
+
resource.name,
|
|
17
|
+
overrideContext
|
|
18
|
+
);
|
|
12
19
|
return undefined;
|
|
13
20
|
},
|
|
14
21
|
describe: (resource) => {
|
package/ts/apis/index.ts
CHANGED
|
@@ -1254,6 +1254,15 @@ export interface K8sResourceReference<T extends K8sResource = K8sResource> {
|
|
|
1254
1254
|
* `metadata.name` of the target resource.
|
|
1255
1255
|
*/
|
|
1256
1256
|
readonly name: string;
|
|
1257
|
+
|
|
1258
|
+
/**
|
|
1259
|
+
* Optional namespace override.
|
|
1260
|
+
*
|
|
1261
|
+
* When used on a {@link Namespace}-scoped API surface the namespace is
|
|
1262
|
+
* already set; this field is mainly useful at the {@link Scenario} or
|
|
1263
|
+
* {@link Cluster} level for namespaced resources.
|
|
1264
|
+
*/
|
|
1265
|
+
readonly namespace?: undefined | string;
|
|
1257
1266
|
}
|
|
1258
1267
|
|
|
1259
1268
|
/**
|
|
@@ -1326,6 +1335,15 @@ export interface ResourceTest<T extends K8sResource = K8sResource> {
|
|
|
1326
1335
|
*/
|
|
1327
1336
|
readonly name: string;
|
|
1328
1337
|
|
|
1338
|
+
/**
|
|
1339
|
+
* Optional namespace override.
|
|
1340
|
+
*
|
|
1341
|
+
* When used on a {@link Namespace}-scoped API surface the namespace is
|
|
1342
|
+
* already set; this field is mainly useful at the {@link Scenario} or
|
|
1343
|
+
* {@link Cluster} level for namespaced resources.
|
|
1344
|
+
*/
|
|
1345
|
+
readonly namespace?: undefined | string;
|
|
1346
|
+
|
|
1329
1347
|
/**
|
|
1330
1348
|
* Assertion callback.
|
|
1331
1349
|
*
|
|
@@ -1349,6 +1367,15 @@ export interface ResourceListTest<T extends K8sResource = K8sResource> {
|
|
|
1349
1367
|
*/
|
|
1350
1368
|
readonly kind: T["kind"];
|
|
1351
1369
|
|
|
1370
|
+
/**
|
|
1371
|
+
* Optional namespace override.
|
|
1372
|
+
*
|
|
1373
|
+
* When used on a {@link Namespace}-scoped API surface the namespace is
|
|
1374
|
+
* already set; this field is mainly useful at the {@link Scenario} or
|
|
1375
|
+
* {@link Cluster} level for namespaced resources.
|
|
1376
|
+
*/
|
|
1377
|
+
readonly namespace?: undefined | string;
|
|
1378
|
+
|
|
1352
1379
|
/**
|
|
1353
1380
|
* Assertion callback.
|
|
1354
1381
|
*
|
|
@@ -1378,6 +1405,15 @@ export interface ResourceOneTest<T extends K8sResource = K8sResource> {
|
|
|
1378
1405
|
*/
|
|
1379
1406
|
readonly kind: T["kind"];
|
|
1380
1407
|
|
|
1408
|
+
/**
|
|
1409
|
+
* Optional namespace override.
|
|
1410
|
+
*
|
|
1411
|
+
* When used on a {@link Namespace}-scoped API surface the namespace is
|
|
1412
|
+
* already set; this field is mainly useful at the {@link Scenario} or
|
|
1413
|
+
* {@link Cluster} level for namespaced resources.
|
|
1414
|
+
*/
|
|
1415
|
+
readonly namespace?: undefined | string;
|
|
1416
|
+
|
|
1381
1417
|
/**
|
|
1382
1418
|
* Optional predicate to narrow which resources are candidates.
|
|
1383
1419
|
*
|