From 9bb15730a667e0c7c27492b1e62be09fffa80132 Mon Sep 17 00:00:00 2001
From: Pierre Souchay
Date: Wed, 18 Apr 2018 23:07:25 +0200
Subject: [PATCH] Added unit test on key length
---
agent/config/runtime_test.go | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/agent/config/runtime_test.go b/agent/config/runtime_test.go
index 4306ce6ad9..653490d258 100644
--- a/agent/config/runtime_test.go
+++ b/agent/config/runtime_test.go
@@ -1940,7 +1940,20 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
},
},
{
- desc: "service with wrong meta: too long",
+ desc: "service with wrong meta: too long key",
+ args: []string{
+ `-data-dir=` + dataDir,
+ },
+ json: []string{
+ `{ "service": { "name": "a", "port": 80, "meta": { "` + randomString(520) + `": "metaValue" } } }`,
+ },
+ hcl: []string{
+ `service = { name = "a" port = 80, meta={` + randomString(520) + `="metaValue"} }`,
+ },
+ err: `Key is too long`,
+ },
+ {
+ desc: "service with wrong meta: too long value",
args: []string{
`-data-dir=` + dataDir,
},