Skip to content

Commit

Permalink
Temporarily remove host_and_port conformance tests until protos make …
Browse files Browse the repository at this point in the history
…it into buf (#165)

Conformance tests depend on the protos making it into buf first. Will
reapply these changes once I can update that dependency for the tools
module.
  • Loading branch information
rodaine authored Feb 12, 2024
1 parent eb72e87 commit edfcfb7
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 258 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -180,15 +180,3 @@ message StringInOneof {
}];
}
}

message StringHostAndPort {
string val = 1 [(buf.validate.field).string.host_and_port = true];
}

message StringHostAndOptionalPort {
string val = 1 [(field).cel = {
id: "string.host_and_port.optional_port",
message: "value must be a host and (optional) port pair",
expression: "this.isHostAndPort(false)",
}];
}
176 changes: 21 additions & 155 deletions tools/internal/gen/buf/validate/conformance/cases/strings.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

91 changes: 0 additions & 91 deletions tools/protovalidate-conformance/internal/cases/cases_strings.go
Original file line number Diff line number Diff line change
Expand Up @@ -852,96 +852,5 @@ func stringSuite() suites.Suite {
Expected: results.Violations(
&validate.Violation{FieldPath: "val", ConstraintId: "string.well_known_regex.header_value"}),
},
"host_and_port/valid/hostname": {
Message: &cases.StringHostAndPort{Val: "localhost:1234"},
Expected: results.Success(true),
},
"host_and_port/valid/ipv4": {
Message: &cases.StringHostAndPort{Val: "127.0.0.1:12345"},
Expected: results.Success(true),
},
"host_and_port/valid/ipv6": {
Message: &cases.StringHostAndPort{Val: "[::1]:8080"},
Expected: results.Success(true),
},
"host_and_port/invalid/empty": {
Message: &cases.StringHostAndPort{Val: ""},
Expected: results.Violations(
&validate.Violation{FieldPath: "val", ConstraintId: "string.host_and_port_empty"}),
},
"host_and_port/invalid/missing_port": {
Message: &cases.StringHostAndPort{Val: "localhost"},
Expected: results.Violations(
&validate.Violation{FieldPath: "val", ConstraintId: "string.host_and_port"}),
},
"host_and_port/invalid/whitespace": {
Message: &cases.StringHostAndPort{Val: " localhost:8080 "},
Expected: results.Violations(
&validate.Violation{FieldPath: "val", ConstraintId: "string.host_and_port"}),
},
"host_and_port/invalid/malformed_hostname": {
Message: &cases.StringHostAndPort{Val: "abc#123:456"},
Expected: results.Violations(
&validate.Violation{FieldPath: "val", ConstraintId: "string.host_and_port"}),
},
"host_and_port/invalid/malformed_ipv4": {
Message: &cases.StringHostAndPort{Val: "123.456.789.100:8080"},
Expected: results.Violations(
&validate.Violation{FieldPath: "val", ConstraintId: "string.host_and_port"}),
},
"host_and_port/invalid/malformed_ipv6": {
Message: &cases.StringHostAndPort{Val: "[1::jk::3]:8080"},
Expected: results.Violations(
&validate.Violation{FieldPath: "val", ConstraintId: "string.host_and_port"}),
},
"host_and_port/invalid/unbracketed_ipv6": {
Message: &cases.StringHostAndPort{Val: "::1:8080"},
Expected: results.Violations(
&validate.Violation{FieldPath: "val", ConstraintId: "string.host_and_port"}),
},
"host_and_port/invalid/port_out_of_range": {
Message: &cases.StringHostAndPort{Val: "localhost:99999"},
Expected: results.Violations(
&validate.Violation{FieldPath: "val", ConstraintId: "string.host_and_port"}),
},
"host_and_port/optional_port/valid/hostname": {
Message: &cases.StringHostAndOptionalPort{Val: "localhost"},
Expected: results.Success(true),
},
"host_and_port/optional_port/valid/ipv4": {
Message: &cases.StringHostAndOptionalPort{Val: "192.168.0.1"},
Expected: results.Success(true),
},
"host_and_port/optional_port/valid/ipv6": {
Message: &cases.StringHostAndOptionalPort{Val: "[838e:3861:529f:0e68:2c40:906a:d7b6:4006]"},
Expected: results.Success(true),
},
"host_and_port/optional_port/valid/hostname_and_port": {
Message: &cases.StringHostAndOptionalPort{Val: "localhost:1234"},
Expected: results.Success(true),
},
"host_and_port/optional_port/valid/ipv4_and_port": {
Message: &cases.StringHostAndOptionalPort{Val: "127.0.0.1:12345"},
Expected: results.Success(true),
},
"host_and_port/optional_port/valid/ipv6_and_port": {
Message: &cases.StringHostAndOptionalPort{Val: "[::1]:8080"},
Expected: results.Success(true),
},
"host_and_port/optional_port/invalid/malformed_hostname": {
Message: &cases.StringHostAndOptionalPort{Val: "abc#123"},
Expected: results.Violations(
&validate.Violation{FieldPath: "val", ConstraintId: "string.host_and_port.optional_port"}),
},
"host_and_port/optional_port/invalid/malformed_ipv4": {
Message: &cases.StringHostAndOptionalPort{Val: "123.456.789.100"},
Expected: results.Violations(
&validate.Violation{FieldPath: "val", ConstraintId: "string.host_and_port.optional_port"}),
},
"host_and_port/optional_port/invalid/malformed_ipv6": {
Message: &cases.StringHostAndOptionalPort{Val: "[1::jk::3]"},
Expected: results.Violations(
&validate.Violation{FieldPath: "val", ConstraintId: "string.host_and_port.optional_port"}),
},
}
}

0 comments on commit edfcfb7

Please sign in to comment.