|
@@ -102,7 +102,7 @@ func TestValidateLogOptAddress(t *testing.T) {
|
|
},
|
|
},
|
|
{
|
|
{
|
|
addr: "corrupted:c",
|
|
addr: "corrupted:c",
|
|
- expectedErr: "invalid syntax",
|
|
|
|
|
|
+ expectedErr: "invalid port",
|
|
},
|
|
},
|
|
{
|
|
{
|
|
addr: "tcp://example.com:port",
|
|
addr: "tcp://example.com:port",
|
|
@@ -112,6 +112,10 @@ func TestValidateLogOptAddress(t *testing.T) {
|
|
addr: "tcp://example.com:-1",
|
|
addr: "tcp://example.com:-1",
|
|
expectedErr: "invalid port",
|
|
expectedErr: "invalid port",
|
|
},
|
|
},
|
|
|
|
+ {
|
|
|
|
+ addr: "unix://",
|
|
|
|
+ expectedErr: "path is empty",
|
|
|
|
+ },
|
|
{
|
|
{
|
|
addr: "unix:///some/socket.sock",
|
|
addr: "unix:///some/socket.sock",
|
|
expected: location{
|
|
expected: location{
|
|
@@ -136,6 +140,10 @@ func TestValidateLogOptAddress(t *testing.T) {
|
|
address := tc.addr + path
|
|
address := tc.addr + path
|
|
t.Run(address, func(t *testing.T) {
|
|
t.Run(address, func(t *testing.T) {
|
|
err := ValidateLogOpt(map[string]string{addressKey: address})
|
|
err := ValidateLogOpt(map[string]string{addressKey: address})
|
|
|
|
+ if path != "" {
|
|
|
|
+ assert.ErrorContains(t, err, "should not contain a path element")
|
|
|
|
+ return
|
|
|
|
+ }
|
|
if tc.expectedErr != "" {
|
|
if tc.expectedErr != "" {
|
|
assert.ErrorContains(t, err, tc.expectedErr)
|
|
assert.ErrorContains(t, err, tc.expectedErr)
|
|
return
|
|
return
|