diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2022-02-04 14:36:50 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-04 14:36:50 +0100 |
commit | 977313847c8b93403e2ebf6b643b603de2d0bf16 (patch) | |
tree | 4a29370332d4620a4a7d667d064ce0bd92fb91e8 | |
parent | 6ce04b4c552363500f756d96e0ee8a70af905b21 (diff) | |
parent | 73d0478580aa235a0978ca8672958dcd3d11bcfa (diff) |
Merge pull request #21068 from vespa-engine/hmusum/output-config-name-in-simpler-format
Use simpler format for string representation of config key
5 files changed, 7 insertions, 16 deletions
diff --git a/config/src/main/java/com/yahoo/vespa/config/ConfigKey.java b/config/src/main/java/com/yahoo/vespa/config/ConfigKey.java index 9a7ac58e339..2fccabe111b 100755 --- a/config/src/main/java/com/yahoo/vespa/config/ConfigKey.java +++ b/config/src/main/java/com/yahoo/vespa/config/ConfigKey.java @@ -108,16 +108,7 @@ public class ConfigKey<CONFIGCLASS extends ConfigInstance> implements Comparable return configClass; } - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("name="); - sb.append(name); - sb.append(",namespace="); - sb.append(namespace); - sb.append(",configId="); - sb.append(configId); - return sb.toString(); - } + public String toString() { return "name=" + namespace + "." + name + ",configId=" + configId; } public static ConfigKey<?> createFull(String name, String configId, String namespace) { return new ConfigKey<>(name, configId, namespace, null); diff --git a/config/src/test/java/com/yahoo/config/subscription/ConfigSetTest.java b/config/src/test/java/com/yahoo/config/subscription/ConfigSetTest.java index c9e7bb23402..c141ed8403c 100644 --- a/config/src/test/java/com/yahoo/config/subscription/ConfigSetTest.java +++ b/config/src/test/java/com/yahoo/config/subscription/ConfigSetTest.java @@ -18,7 +18,7 @@ public class ConfigSetTest { ConfigSet set = new ConfigSet(); SimpletypesConfig.Builder builder = new SimpletypesConfig.Builder(); set.addBuilder("foo", builder); - assertTrue(Pattern.matches("name=simpletypes,namespace=foo,configId=foo=>com.yahoo.foo.SimpletypesConfig.*", + assertTrue(Pattern.matches("name=foo.simpletypes,configId=foo=>com.yahoo.foo.SimpletypesConfig.*", set.toString())); } } diff --git a/config/src/tests/configretriever/configretriever.cpp b/config/src/tests/configretriever/configretriever.cpp index 1c39b20a1ff..dbbcd0dec24 100644 --- a/config/src/tests/configretriever/configretriever.cpp +++ b/config/src/tests/configretriever/configretriever.cpp @@ -351,8 +351,8 @@ TEST_FF("require that snapshots throws exception if invalid key", ConfigTestFixt f1.addComponent("c3", "foo3", "bar3"); ConfigSnapshot snap1 = f2.retriever->getBootstrapConfigs(); ASSERT_FALSE(snap1.hasConfig<BarConfig>("doesnotexist")); - ASSERT_EXCEPTION(snap1.getConfig<BarConfig>("doesnotexist"), IllegalConfigKeyException, "Unable to find config for key name=bar,namespace=config,configId=doesnotexist"); - ASSERT_EXCEPTION(snap1.isChanged<BarConfig>("doesnotexist", 0), IllegalConfigKeyException, "Unable to find config for key name=bar,namespace=config,configId=doesnotexist"); + ASSERT_EXCEPTION(snap1.getConfig<BarConfig>("doesnotexist"), IllegalConfigKeyException, "Unable to find config for key name=config.bar,configId=doesnotexist"); + ASSERT_EXCEPTION(snap1.isChanged<BarConfig>("doesnotexist", 0), IllegalConfigKeyException, "Unable to find config for key name=config.bar,configId=doesnotexist"); ASSERT_TRUE(snap1.hasConfig<BootstrapConfig>("myid")); } diff --git a/config/src/vespa/config/common/configkey.cpp b/config/src/vespa/config/common/configkey.cpp index 248890b05f9..f6f0b6cba00 100644 --- a/config/src/vespa/config/common/configkey.cpp +++ b/config/src/vespa/config/common/configkey.cpp @@ -73,9 +73,9 @@ ConfigKey::toString() const { vespalib::string s; s.append("name="); - s.append(_defName); - s.append(",namespace="); s.append(_defNamespace); + s.append("."); + s.append(_defName); s.append(",configId="); s.append(_configId); return s; diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/rpc/security/MultiTenantRpcAuthorizerTest.java b/configserver/src/test/java/com/yahoo/vespa/config/server/rpc/security/MultiTenantRpcAuthorizerTest.java index 854abee91f5..30d3dcffc30 100644 --- a/configserver/src/test/java/com/yahoo/vespa/config/server/rpc/security/MultiTenantRpcAuthorizerTest.java +++ b/configserver/src/test/java/com/yahoo/vespa/config/server/rpc/security/MultiTenantRpcAuthorizerTest.java @@ -116,7 +116,7 @@ public class MultiTenantRpcAuthorizerTest { new ConfigKey<>(LbServicesConfig.CONFIG_DEF_NAME, "*", LbServicesConfig.CONFIG_DEF_NAMESPACE), HOSTNAME); - exceptionRule.expectMessage("Node with type 'tenant' is not allowed to access global config [name=lb-services,namespace=cloud.config,configId=*]"); + exceptionRule.expectMessage("Node with type 'tenant' is not allowed to access global config [name=cloud.config.lb-services,configId=*]"); exceptionRule.expectCause(instanceOf(AuthorizationException.class)); authorizer.authorizeConfigRequest(configRequest) |