Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
Racer159 committed May 9, 2024
1 parent 3ff3482 commit 10a0c7e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
6 changes: 4 additions & 2 deletions src/pepr/operator/controllers/istio/service-entry.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe("test generate service entry", () => {

const host = "test";
const port = 8080;
const service = "test-service"
const service = "test-service";

const namespace = "test";
const pkgName = "test";
Expand Down Expand Up @@ -46,6 +46,8 @@ describe("test generate service entry", () => {
expect(payload.spec!.ports![0].protocol).toEqual("HTTPS");

expect(payload.spec?.endpoints).toBeDefined();
expect(payload.spec!.endpoints![0].address).toEqual(`${Gateway.Tenant}-ingressgateway.istio-${Gateway.Tenant}-gateway.svc.cluster.local`);
expect(payload.spec!.endpoints![0].address).toEqual(
`${Gateway.Tenant}-ingressgateway.istio-${Gateway.Tenant}-gateway.svc.cluster.local`,
);
});
});
22 changes: 15 additions & 7 deletions src/pepr/operator/controllers/istio/virtual-service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe("test generate virtual service", () => {

const host = "test";
const port = 8080;
const service = "test-service"
const service = "test-service";

const namespace = "test";
const pkgName = "test";
Expand All @@ -31,19 +31,25 @@ describe("test generate virtual service", () => {
const payload = generateVirtualService(expose, namespace, pkgName, generation, ownerRefs);

expect(payload).toBeDefined();
expect(payload.metadata?.name).toEqual(`${pkgName}-${Gateway.Tenant}-${host}-${port}-${service}`);
expect(payload.metadata?.name).toEqual(
`${pkgName}-${Gateway.Tenant}-${host}-${port}-${service}`,
);
expect(payload.metadata?.namespace).toEqual(namespace);

expect(payload.spec?.hosts).toBeDefined();
expect(payload.spec!.hosts![0]).toEqual(`${host}.${UDSConfig.domain}`);

expect(payload.spec?.http).toBeDefined();
expect(payload.spec!.http![0].route).toBeDefined();
expect(payload.spec!.http![0].route![0].destination?.host).toEqual(`${service}.${namespace}.svc.cluster.local`);
expect(payload.spec!.http![0].route![0].destination?.host).toEqual(
`${service}.${namespace}.svc.cluster.local`,
);
expect(payload.spec!.http![0].route![0].destination?.port?.number).toEqual(port);

expect(payload.spec?.gateways).toBeDefined();
expect(payload.spec!.gateways![0]).toEqual(`istio-${Gateway.Tenant}-gateway/${Gateway.Tenant}-gateway`);
expect(payload.spec!.gateways![0]).toEqual(
`istio-${Gateway.Tenant}-gateway/${Gateway.Tenant}-gateway`,
);
});

it("should create an admin VirtualService object", () => {
Expand All @@ -64,8 +70,8 @@ describe("test generate virtual service", () => {

it("should create an advancedHttp VirtualService object", () => {
const advancedHTTP = {
directResponse: { status: 404 }
}
directResponse: { status: 404 },
};
const expose: Expose = {
host,
port,
Expand Down Expand Up @@ -98,7 +104,9 @@ describe("test generate virtual service", () => {
expect(payload.spec!.tls![0].match![0].port).toEqual(443);
expect(payload.spec!.tls![0].match![0].sniHosts![0]).toEqual(`${host}.${UDSConfig.domain}`);
expect(payload.spec!.tls![0].route).toBeDefined();
expect(payload.spec!.http![0].route![0].destination?.host).toEqual(`${service}.${namespace}.svc.cluster.local`);
expect(payload.spec!.http![0].route![0].destination?.host).toEqual(
`${service}.${namespace}.svc.cluster.local`,
);
expect(payload.spec!.http![0].route![0].destination?.port?.number).toEqual(port);
});
});

0 comments on commit 10a0c7e

Please sign in to comment.