From 7eaf1048d576ca3d5902addda4729792624de9c0 Mon Sep 17 00:00:00 2001 From: Harald Musum Date: Thu, 9 Sep 2021 14:41:28 +0200 Subject: Revert "Use both xxhash64 and md5 for config payload in requests and responses [run-systemtest]" --- .../com/yahoo/vespa/config/proxy/ConfigTester.java | 16 +++++--------- .../yahoo/vespa/config/proxy/MemoryCacheTest.java | 25 +++++++++++----------- .../yahoo/vespa/config/proxy/ProxyServerTest.java | 6 +++--- 3 files changed, 20 insertions(+), 27 deletions(-) (limited to 'config-proxy/src/test') diff --git a/config-proxy/src/test/java/com/yahoo/vespa/config/proxy/ConfigTester.java b/config-proxy/src/test/java/com/yahoo/vespa/config/proxy/ConfigTester.java index 45f52479cbd..1b009b80fc1 100644 --- a/config-proxy/src/test/java/com/yahoo/vespa/config/proxy/ConfigTester.java +++ b/config-proxy/src/test/java/com/yahoo/vespa/config/proxy/ConfigTester.java @@ -5,8 +5,6 @@ import com.yahoo.jrt.Request; import com.yahoo.slime.Slime; import com.yahoo.vespa.config.ConfigKey; import com.yahoo.vespa.config.ConfigPayload; -import com.yahoo.vespa.config.PayloadChecksum; -import com.yahoo.vespa.config.PayloadChecksums; import com.yahoo.vespa.config.RawConfig; import com.yahoo.vespa.config.protocol.CompressionType; import com.yahoo.vespa.config.protocol.DefContent; @@ -21,9 +19,6 @@ import java.util.Collections; import java.util.List; import java.util.Optional; -import static com.yahoo.vespa.config.PayloadChecksum.Type.MD5; -import static com.yahoo.vespa.config.PayloadChecksum.Type.XXHASH64; - /** * @author bratseth */ @@ -47,8 +42,7 @@ public class ConfigTester { long generation = 1; String defMd5 = ConfigUtils.getDefMd5(defContent); - PayloadChecksums configMd5 = PayloadChecksums.from(new PayloadChecksum(ConfigUtils.getMd5(fooConfigPayload), MD5), - PayloadChecksum.empty(XXHASH64)); + String configMd5 = ConfigUtils.getMd5(fooConfigPayload); fooConfig = new RawConfig(configKey, defMd5, fooPayload, configMd5, generation, false, defContent, Optional.empty()); @@ -63,24 +57,24 @@ public class ConfigTester { JRTServerConfigRequest createRequest(RawConfig config, long timeout) { return createRequest(config.getName(), config.getConfigId(), config.getNamespace(), - config.getPayloadChecksums(), config.getGeneration(), timeout); + config.getConfigMd5(), config.getGeneration(), timeout); } JRTServerConfigRequest createRequest(String configName, String configId, String namespace, long timeout) { - return createRequest(configName, configId, namespace, PayloadChecksums.empty(), 0, timeout); + return createRequest(configName, configId, namespace, null, 0, timeout); } private JRTServerConfigRequest createRequest(String configName, String configId, String namespace, - PayloadChecksums payloadChecksums, + String md5, long generation, long timeout) { Request request = JRTClientConfigRequestV3. createWithParams(new ConfigKey<>(configName, configId, namespace, null), DefContent.fromList(defContent), "fromHost", - payloadChecksums, + md5, generation, timeout, Trace.createDummy(), diff --git a/config-proxy/src/test/java/com/yahoo/vespa/config/proxy/MemoryCacheTest.java b/config-proxy/src/test/java/com/yahoo/vespa/config/proxy/MemoryCacheTest.java index b47c0bcc5ce..485a091d9ae 100644 --- a/config-proxy/src/test/java/com/yahoo/vespa/config/proxy/MemoryCacheTest.java +++ b/config-proxy/src/test/java/com/yahoo/vespa/config/proxy/MemoryCacheTest.java @@ -1,11 +1,10 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.config.proxy; import com.yahoo.slime.Slime; import com.yahoo.vespa.config.ConfigCacheKey; import com.yahoo.vespa.config.ConfigKey; import com.yahoo.vespa.config.ConfigPayload; -import com.yahoo.vespa.config.PayloadChecksums; import com.yahoo.vespa.config.RawConfig; import com.yahoo.vespa.config.protocol.Payload; import org.junit.Before; @@ -19,24 +18,24 @@ import static org.junit.Assert.*; /** * @author hmusum + * @since 5.1.9 */ public class MemoryCacheTest { - - private final String defName = "foo"; - private final String configId = "id"; - private final String namespace = "bar"; + private String defName = "foo"; + private String configId = "id"; + private String namespace = "bar"; private static final String defMd5 = "a"; - private final long generation = 1L; - private final String defName2 = "baz-quux"; - private final String namespace2 = "search.config"; + private long generation = 1L; + private String defName2 = "baz-quux"; + private String namespace2 = "search.config"; // Test with a config id with / in it - private final String configId2 = "clients/gateways/gateway/component/com.yahoo.feedhandler.VespaFeedHandlerRemoveLocation"; + private String configId2 = "clients/gateways/gateway/component/com.yahoo.feedhandler.VespaFeedHandlerRemoveLocation"; private static final String defMd52 = "a2"; private static final String differentDefMd5 = "09ef"; - private static final PayloadChecksums configMd5 = PayloadChecksums.from("b", ""); - private final ConfigKey configKey = new ConfigKey<>(defName, configId, namespace); - private final ConfigKey configKey2 = new ConfigKey<>(defName2, configId2, namespace2); + private static final String configMd5 = "b"; + private ConfigKey configKey = new ConfigKey<>(defName, configId, namespace); + private ConfigKey configKey2 = new ConfigKey<>(defName2, configId2, namespace2); private ConfigCacheKey cacheKey; private ConfigCacheKey cacheKeyDifferentMd5; private ConfigCacheKey cacheKey2; diff --git a/config-proxy/src/test/java/com/yahoo/vespa/config/proxy/ProxyServerTest.java b/config-proxy/src/test/java/com/yahoo/vespa/config/proxy/ProxyServerTest.java index 32e68c662e8..87c1fa151f8 100644 --- a/config-proxy/src/test/java/com/yahoo/vespa/config/proxy/ProxyServerTest.java +++ b/config-proxy/src/test/java/com/yahoo/vespa/config/proxy/ProxyServerTest.java @@ -35,7 +35,7 @@ public class ProxyServerTest { // errorConfig based on fooConfig private static final ConfigKey errorConfigKey = new ConfigKey<>("error", fooConfig.getConfigId(), fooConfig.getNamespace()); static final RawConfig errorConfig = new RawConfig(errorConfigKey, fooConfig.getDefMd5(), fooConfig.getPayload(), - fooConfig.getPayloadChecksums(), fooConfig.getGeneration(), false, + fooConfig.getConfigMd5(), fooConfig.getGeneration(), false, ErrorCode.UNKNOWN_DEFINITION, fooConfig.getDefContent(), Optional.empty()); @Rule @@ -179,7 +179,7 @@ public class ProxyServerTest { // Simulate an empty response RawConfig emptyConfig = new RawConfig(fooConfig.getKey(), fooConfig.getDefMd5(), Payload.from("{}"), - fooConfig.getPayloadChecksums(), 0, false, + fooConfig.getConfigMd5(), 0, false, 0, fooConfig.getDefContent(), Optional.empty()); source.put(fooConfig.getKey(), emptyConfig); @@ -238,7 +238,7 @@ public class ProxyServerTest { static RawConfig createConfigWithNextConfigGeneration(RawConfig config, int errorCode, Payload payload, long configGeneration) { return new RawConfig(config.getKey(), config.getDefMd5(), - payload, config.getPayloadChecksums(), + payload, config.getConfigMd5(), configGeneration, false, errorCode, config.getDefContent(), Optional.empty()); } -- cgit v1.2.3