From 6b5cf20b1c1ab7a47345dd2a58fe7c5f7ff3eadf Mon Sep 17 00:00:00 2001 From: Kyle Havlovitz Date: Mon, 9 Jan 2017 13:40:50 -0800 Subject: [PATCH] Fix formatting --- command/agent/agent.go | 9 +++------ command/agent/agent_test.go | 2 -- consul/structs/structs_test.go | 2 +- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/command/agent/agent.go b/command/agent/agent.go index 4b71fcce9..2753d3159 100644 --- a/command/agent/agent.go +++ b/command/agent/agent.go @@ -47,13 +47,13 @@ const ( metaKeyReservedPrefix = "consul-" // The maximum number of metadata key pairs allowed to be registered - metaMaxKeyPairs = 64 + metaMaxKeyPairs = 64 // The maximum allowed length of a metadata key - metaKeyMaxLength = 128 + metaKeyMaxLength = 128 // The maximum allowed length of a metadata value - metaValueMaxLength = 512 + metaValueMaxLength = 512 ) var ( @@ -1728,9 +1728,6 @@ func validateMetaPair(key, value string) error { if len(key) > metaKeyMaxLength { return fmt.Errorf("Key is longer than %d chars", metaKeyMaxLength) } - if strings.Contains(key, ":") { - return fmt.Errorf("Key contains ':' character") - } if strings.HasPrefix(key, metaKeyReservedPrefix) { return fmt.Errorf("Key prefix '%s' is reserved for internal use", metaKeyReservedPrefix) } diff --git a/command/agent/agent_test.go b/command/agent/agent_test.go index 42e3269f7..3306da285 100644 --- a/command/agent/agent_test.go +++ b/command/agent/agent_test.go @@ -1901,8 +1901,6 @@ func TestAgent_validateMetaPair(t *testing.T) { {"", "value", false}, // allowed special chars in key name {"k_e-y", "value", true}, - // ':' in key name - {"k:ey", "value", false}, // disallowed special chars in key name {"(%key&)", "value", false}, // key too long diff --git a/consul/structs/structs_test.go b/consul/structs/structs_test.go index 13714e993..c1a39c4f9 100644 --- a/consul/structs/structs_test.go +++ b/consul/structs/structs_test.go @@ -143,7 +143,7 @@ func TestStructs_RegisterRequest_ChangesNode(t *testing.T) { check(func() { req.Node = "nope" }, func() { req.Node = "test" }) check(func() { req.Address = "127.0.0.2" }, func() { req.Address = "127.0.0.1" }) check(func() { req.TaggedAddresses["wan"] = "nope" }, func() { delete(req.TaggedAddresses, "wan") }) - check(func() { req.NodeMeta["invalid"] = "nope" }, func() { delete(req.NodeMeta, "invalid")}) + check(func() { req.NodeMeta["invalid"] = "nope" }, func() { delete(req.NodeMeta, "invalid") }) if !req.ChangesNode(nil) { t.Fatalf("should change")