From fef5ae72d054dcf913f473e538a27f14889d03c6 Mon Sep 17 00:00:00 2001 From: "Philip K. Warren" Date: Tue, 18 Jul 2023 18:21:06 -0500 Subject: [PATCH] Add conformance tests for single dot hostnames --- .../internal/cases/cases_strings.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tools/protovalidate-conformance/internal/cases/cases_strings.go b/tools/protovalidate-conformance/internal/cases/cases_strings.go index 779e224a..771d6530 100644 --- a/tools/protovalidate-conformance/internal/cases/cases_strings.go +++ b/tools/protovalidate-conformance/internal/cases/cases_strings.go @@ -316,6 +316,11 @@ func stringSuite() suites.Suite { Expected: results.Violations( &validate.Violation{FieldPath: "val", ConstraintId: "string.email"}), }, + "email/invalid/only_dot_hostname": { + Message: &cases.StringEmail{Val: "foo@."}, + Expected: results.Violations( + &validate.Violation{FieldPath: "val", ConstraintId: "string.email"}), + }, "hostname/valid/lowercase": { Message: &cases.StringHostname{Val: "example.com"}, Expected: results.Success(true), @@ -367,6 +372,11 @@ func stringSuite() suites.Suite { Expected: results.Violations( &validate.Violation{FieldPath: "val", ConstraintId: "string.hostname"}), }, + "hostname/invalid/only_dot": { + Message: &cases.StringHostname{Val: "."}, + Expected: results.Violations( + &validate.Violation{FieldPath: "val", ConstraintId: "string.hostname"}), + }, "ip/valid/v4": { Message: &cases.StringIP{Val: "192.168.0.1"}, Expected: results.Success(true),