You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2018/10/22 17:53:16 UTC
ignite git commit: Try make test more robust
Repository: ignite
Updated Branches:
refs/heads/ignite-9720-1 [created] fc0d0080d
Try make test more robust
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/fc0d0080
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/fc0d0080
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/fc0d0080
Branch: refs/heads/ignite-9720-1
Commit: fc0d0080dd3fdc330a4f56d6403dcd135fbbfc33
Parents: 4bc08da
Author: sboikov <sb...@apache.org>
Authored: Mon Oct 22 20:52:44 2018 +0300
Committer: sboikov <sb...@apache.org>
Committed: Mon Oct 22 20:52:44 2018 +0300
----------------------------------------------------------------------
.../IgniteCacheConfigVariationsFullApiTest.java | 40 ++++++++++++++++----
1 file changed, 33 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/fc0d0080/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheConfigVariationsFullApiTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheConfigVariationsFullApiTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheConfigVariationsFullApiTest.java
index e449b3b..e2b1a2e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheConfigVariationsFullApiTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheConfigVariationsFullApiTest.java
@@ -4212,8 +4212,31 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar
* @throws Exception If failed.
*/
private void checkTtl(boolean inTx, boolean oldEntry) throws Exception {
- int ttl = 1000;
+ int ttlVals[] = {600, 1000, 3000};
+ int i = 0;
+ while (i < ttlVals.length) {
+ try {
+ checkTtl0(inTx, oldEntry, ttlVals[i]);
+ break;
+ }
+ catch (AssertionFailedError e) {
+ if (i < ttlVals.length - 1)
+ info("Ttl test failed, try execute with increased ttl");
+ else
+ throw e;
+ }
+ i++;
+ }
+ }
+
+ /**
+ * @param inTx In tx flag.
+ * @param oldEntry {@code True} to check TTL on old entry, {@code false} on new.
+ * @param ttl TTL value.
+ * @throws Exception If failed.
+ */
+ private void checkTtl0(boolean inTx, boolean oldEntry, int ttl) throws Exception {
final ExpiryPolicy expiry = new TouchedExpiryPolicy(new Duration(MILLISECONDS, ttl));
final IgniteCache<String, Integer> c = jcache();
@@ -4409,11 +4432,7 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar
// Ensure that old TTL and expire time are not longer "visible".
entryTtl = entryTtl(srvNodeCache, key);
-
- assertNotNull(entryTtl.get1());
- assertNotNull(entryTtl.get2());
- assertEquals(0, (long)entryTtl.get1());
- assertEquals(0, (long)entryTtl.get2());
+ assertNull(entryTtl);
// Ensure that next update will not pick old expire time.
@@ -4430,7 +4449,7 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar
tx.close();
}
- U.sleep(2000);
+ U.sleep(ttl + 500);
entryTtl = entryTtl(srvNodeCache, key);
@@ -6315,6 +6334,13 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar
entry.unswap();
+ if (!entry.hasValue()) {
+ assertEquals(0, entry.ttl());
+ assertEquals(0, entry.expireTime());
+
+ return null;
+ }
+
IgnitePair<Long> pair = new IgnitePair<>(entry.ttl(), entry.expireTime());
if (!entry.isNear())