From e0ff8fcf1d23581eab896236b212904745c34065 Mon Sep 17 00:00:00 2001 From: Christoph Strobl Date: Wed, 10 Feb 2016 12:01:27 +0100 Subject: [PATCH] DATAREDIS-455 - Increase expire time in RedisTemplateTests. Increase the expiration time to prevent test from failing randomly when executed in cluster environment. Needs to be done as a cluster refresh on driver level might take longer than the actual expiration, which then causes the key to already be expired when checking the assertion. --- .../springframework/data/redis/core/RedisTemplateTests.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/test/java/org/springframework/data/redis/core/RedisTemplateTests.java b/src/test/java/org/springframework/data/redis/core/RedisTemplateTests.java index 784ab8dc4..f6df2210f 100644 --- a/src/test/java/org/springframework/data/redis/core/RedisTemplateTests.java +++ b/src/test/java/org/springframework/data/redis/core/RedisTemplateTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2015 the original author or authors. + * Copyright 2013-2016 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -439,10 +439,12 @@ public class RedisTemplateTests { @Test public void testExpireAndGetExpireMillis() { + final K key1 = keyFactory.instance(); V value1 = valueFactory.instance(); redisTemplate.boundValueOps(key1).set(value1); - redisTemplate.expire(key1, 10, TimeUnit.MILLISECONDS); + redisTemplate.expire(key1, 250, TimeUnit.MILLISECONDS); + assertTrue(redisTemplate.getExpire(key1, TimeUnit.MILLISECONDS) > 0l); // Timeout is longer because expire will be 1 sec if pExpire not supported waitFor(new TestCondition() {