DATAREDIS-358 - Precise version resolution within RedisTestProfileValueSource.
We now resolve the precise redis version including patch level for the 2.8 line. This allows us to disable tests when building against older versions that might not have the complete featureset available.
This commit is contained in:
@@ -52,7 +52,7 @@ public class RedisTestProfileValueSource implements ProfileValueSource {
|
||||
public String get(String key) {
|
||||
if (REDIS_VERSION_KEY.equals(key)) {
|
||||
if (redisVersion.compareTo(RedisVersionUtils.parseVersion(REDIS_28)) >= 0) {
|
||||
return REDIS_28;
|
||||
return redisVersion.toString();
|
||||
}
|
||||
if (redisVersion.compareTo(RedisVersionUtils.parseVersion(REDIS_26)) >= 0) {
|
||||
return REDIS_26;
|
||||
|
||||
@@ -2071,6 +2071,7 @@ public abstract class AbstractConnectionIntegrationTests {
|
||||
* @see DATAREDIS-308
|
||||
*/
|
||||
@Test
|
||||
@IfProfileValue(name = "redisVersion", value = "2.8.9+")
|
||||
public void pfAddShouldAddToNonExistingKeyCorrectly() {
|
||||
|
||||
if (!ConnectionUtils.isJedis(connectionFactory)) {
|
||||
@@ -2087,6 +2088,7 @@ public abstract class AbstractConnectionIntegrationTests {
|
||||
* @see DATAREDIS-308
|
||||
*/
|
||||
@Test
|
||||
@IfProfileValue(name = "redisVersion", value = "2.8.9+")
|
||||
public void pfAddShouldReturnZeroWhenValueAlreadyExists() {
|
||||
|
||||
if (!ConnectionUtils.isJedis(connectionFactory)) {
|
||||
@@ -2107,6 +2109,7 @@ public abstract class AbstractConnectionIntegrationTests {
|
||||
* @see DATAREDIS-308
|
||||
*/
|
||||
@Test
|
||||
@IfProfileValue(name = "redisVersion", value = "2.8.9+")
|
||||
public void pfCountShouldReturnCorrectly() {
|
||||
|
||||
if (!ConnectionUtils.isJedis(connectionFactory)) {
|
||||
@@ -2125,6 +2128,7 @@ public abstract class AbstractConnectionIntegrationTests {
|
||||
* @see DATAREDIS-308
|
||||
*/
|
||||
@Test
|
||||
@IfProfileValue(name = "redisVersion", value = "2.8.9+")
|
||||
public void pfCountWithMultipleKeysShouldReturnCorrectly() {
|
||||
|
||||
if (!ConnectionUtils.isJedis(connectionFactory)) {
|
||||
@@ -2145,6 +2149,7 @@ public abstract class AbstractConnectionIntegrationTests {
|
||||
* @see DATAREDIS-308
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@IfProfileValue(name = "redisVersion", value = "2.8.9+")
|
||||
public void pfCountWithNullKeysShouldThrowIllegalArgumentException() {
|
||||
|
||||
if (!ConnectionUtils.isJedis(connectionFactory)) {
|
||||
|
||||
@@ -22,7 +22,7 @@ import java.util.Collection;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.ClassRule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
@@ -36,6 +36,7 @@ import org.springframework.test.annotation.IfProfileValue;
|
||||
* @author Christoph Strobl
|
||||
*/
|
||||
@RunWith(Parameterized.class)
|
||||
@IfProfileValue(name = "redisVersion", value = "2.8.9+")
|
||||
public class DefaultHyperLogLogOperationsTests<K, V> {
|
||||
|
||||
private RedisTemplate<K, V> redisTemplate;
|
||||
@@ -46,7 +47,7 @@ public class DefaultHyperLogLogOperationsTests<K, V> {
|
||||
|
||||
private HyperLogLogOperations<K, V> hyperLogLogOps;
|
||||
|
||||
public @Rule MinimumRedisVersionRule versionRule = new MinimumRedisVersionRule();
|
||||
public static @ClassRule MinimumRedisVersionRule versionRule = new MinimumRedisVersionRule();
|
||||
|
||||
public DefaultHyperLogLogOperationsTests(RedisTemplate<K, V> redisTemplate, ObjectFactory<K> keyFactory,
|
||||
ObjectFactory<V> valueFactory) {
|
||||
@@ -80,7 +81,6 @@ public class DefaultHyperLogLogOperationsTests<K, V> {
|
||||
*/
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
@IfProfileValue(name = "redisVersion", value = "2.8+")
|
||||
public void addShouldAddDistinctValuesCorrectly() {
|
||||
|
||||
K key = keyFactory.instance();
|
||||
@@ -96,7 +96,6 @@ public class DefaultHyperLogLogOperationsTests<K, V> {
|
||||
*/
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
@IfProfileValue(name = "redisVersion", value = "2.8+")
|
||||
public void addShouldNotAddExistingValuesCorrectly() {
|
||||
|
||||
K key = keyFactory.instance();
|
||||
@@ -113,7 +112,6 @@ public class DefaultHyperLogLogOperationsTests<K, V> {
|
||||
*/
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
@IfProfileValue(name = "redisVersion", value = "2.8+")
|
||||
public void sizeShouldCountValuesCorrectly() {
|
||||
|
||||
K key = keyFactory.instance();
|
||||
@@ -130,7 +128,6 @@ public class DefaultHyperLogLogOperationsTests<K, V> {
|
||||
*/
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
@IfProfileValue(name = "redisVersion", value = "2.8+")
|
||||
public void sizeShouldCountValuesOfMultipleKeysCorrectly() {
|
||||
|
||||
K key = keyFactory.instance();
|
||||
@@ -152,7 +149,6 @@ public class DefaultHyperLogLogOperationsTests<K, V> {
|
||||
*/
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
@IfProfileValue(name = "redisVersion", value = "2.8+")
|
||||
public void unionShouldMergeValuesOfMultipleKeysCorrectly() throws InterruptedException {
|
||||
|
||||
K sourceKey_1 = keyFactory.instance();
|
||||
|
||||
@@ -20,6 +20,8 @@ import java.lang.reflect.Method;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.runners.model.FrameworkMethod;
|
||||
import org.junit.runners.model.InitializationError;
|
||||
import org.springframework.data.redis.Version;
|
||||
import org.springframework.data.redis.VersionParser;
|
||||
import org.springframework.test.annotation.IfProfileValue;
|
||||
import org.springframework.test.annotation.ProfileValueSource;
|
||||
import org.springframework.test.annotation.ProfileValueUtils;
|
||||
@@ -64,8 +66,8 @@ public class RelaxedJUnit4ClassRunner extends SpringJUnit4ClassRunner {
|
||||
|
||||
if (value.endsWith("+")) {
|
||||
|
||||
String expected = value.replace("+", "");
|
||||
if (expected.compareTo(environmentValue) <= 0) {
|
||||
Version expected = VersionParser.parseVersion(value.replace("+", ""));
|
||||
if (expected.compareTo(VersionParser.parseVersion(environmentValue)) <= 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user