Skip to content

Commit

Permalink
fix: typos/missing types (#636)
Browse files Browse the repository at this point in the history
## Description

A couple minor, rando fixes containing things I noticed while writing
tests in #288.

## Type of change

- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Other (security config, docs update, etc)

## Checklist before merging

- [ ] Test, docs, adr added or updated as needed
- [ ] [Contributor Guide
Steps](https://github.com/defenseunicorns/pepr/blob/main/CONTRIBUTING.md#submitting-a-pull-request)
followed

---------

Co-authored-by: Case Wylie <cmwylie19@defenseunicorns.com>
  • Loading branch information
btlghrants and cmwylie19 committed Mar 11, 2024
1 parent e053871 commit d75c0e5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/lib/controller/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ export class Controller {
readonly #config: ModuleConfig;
readonly #capabilities: Capability[];
readonly #beforeHook?: (req: AdmissionRequest) => void;
readonly #afterHook?: (res: MutateResponse) => void;
readonly #afterHook?: (res: MutateResponse | ValidateResponse) => void;

constructor(
config: ModuleConfig,
capabilities: Capability[],
beforeHook?: (req: AdmissionRequest) => void,
afterHook?: (res: MutateResponse) => void,
afterHook?: (res: MutateResponse | ValidateResponse) => void,
onReady?: () => void,
) {
this.#config = config;
Expand Down
6 changes: 3 additions & 3 deletions src/lib/helpers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -442,14 +442,14 @@ describe("generateWatchNamespaceError", () => {
test("returns error for binding and capability namespace conflict", () => {
const error = generateWatchNamespaceError([""], ["ns2"], ["ns3"]);
expect(error).toBe(
"Binding uses namespace not governed by capability: bindingNamespaces: [ns2] capabilityNamespaces:$[ns3].",
"Binding uses namespace not governed by capability: bindingNamespaces: [ns2] capabilityNamespaces: [ns3].",
);
});

test("returns combined error for both conflicts", () => {
const error = generateWatchNamespaceError(["ns1"], ["ns1"], ["ns3", "ns4"]);
expect(error).toBe(
"Binding uses a Pepr ignored namespace: ignoredNamespaces: [ns1] bindingNamespaces: [ns1]. Binding uses namespace not governed by capability: bindingNamespaces: [ns1] capabilityNamespaces:$[ns3, ns4].",
"Binding uses a Pepr ignored namespace: ignoredNamespaces: [ns1] bindingNamespaces: [ns1]. Binding uses namespace not governed by capability: bindingNamespaces: [ns1] capabilityNamespaces: [ns3, ns4].",
);
});

Expand Down Expand Up @@ -563,7 +563,7 @@ describe("namespaceComplianceValidator", () => {
namespaceComplianceValidator(nsViolation[0]);
} catch (e) {
expect(e.message).toBe(
"Error in test-capability-namespaces capability. A binding violates namespace rules. Please check ignoredNamespaces and capability namespaces: Binding uses namespace not governed by capability: bindingNamespaces: [new york] capabilityNamespaces:$[miami, dallas, milwaukee].",
"Error in test-capability-namespaces capability. A binding violates namespace rules. Please check ignoredNamespaces and capability namespaces: Binding uses namespace not governed by capability: bindingNamespaces: [new york] capabilityNamespaces: [miami, dallas, milwaukee].",
);
}
});
Expand Down
2 changes: 1 addition & 1 deletion src/lib/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ export function generateWatchNamespaceError(
if (bindingAndCapabilityNSConflict(bindingNamespaces, capabilityNamespaces)) {
err += `Binding uses namespace not governed by capability: bindingNamespaces: [${bindingNamespaces.join(
", ",
)}] capabilityNamespaces:$[${capabilityNamespaces.join(", ")}].`;
)}] capabilityNamespaces: [${capabilityNamespaces.join(", ")}].`;
}

// add a space if there is a period in the middle of the string
Expand Down

0 comments on commit d75c0e5

Please sign in to comment.