You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficcontrol.apache.org by GitBox <gi...@apache.org> on 2022/01/14 06:39:04 UTC

[GitHub] [trafficcontrol] ocket8888 commented on a change in pull request #6410: TPv2: Improve performance of hostname regular expression

ocket8888 commented on a change in pull request #6410:
URL: https://github.com/apache/trafficcontrol/pull/6410#discussion_r784551717



##########
File path: experimental/traffic-portal/src/app/core/new-delivery-service/new-delivery-service.component.spec.ts
##########
@@ -137,4 +137,14 @@ describe("NewDeliveryServiceComponent", () => {
 	// 	component.cdnObject.setValue({ name: 'testCDN', id: 1 } as CDN);
 	// 	component.dsType.setValue({ name: 'testType', id: 1 } as Type);
 	// });
+
+	it("should match hostnames", async () => {
+		const invalidHostnames: Array<string> = ["h.", "h-", "h-.o", "-h.o"];
+		invalidHostnames.forEach((invalidHostname: string) => void expect(() => component.setDNSBypass(invalidHostname)).toThrow());
+		const validHostnames: Array<string> = ["h", "h.o.s.T.n.a.m.e", "h-O-------s.tNaMe"];
+		expect(() => validHostnames.forEach((hostname: string) => {
+			component.setDNSBypass(hostname);
+			expect(component.deliveryService.dnsBypassCname).toBe(hostname);
+		})).not.toThrow();

Review comment:
       I'm going through the TPv2 code to increase test coverage atm, so I can do this myself when I get to this component.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@trafficcontrol.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org