Skip to content

Commit a88cbcf

Browse files
committed
adds a utility method to skip tests if expected server version is not satisfied
1 parent 992df42 commit a88cbcf

File tree

5 files changed

+21
-3
lines changed

5 files changed

+21
-3
lines changed

scripts/dev-test-rc.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/sh
2-
HZ_VERSION="3.9"
2+
HZ_VERSION="3.9.1"
33
HAZELCAST_TEST_VERSION="3.10-SNAPSHOT"
44
HAZELCAST_VERSION=${HZ_VERSION}
55
HAZELCAST_ENTERPRISE_VERSION=${HZ_VERSION}
@@ -51,7 +51,7 @@ if [ -n "${HAZELCAST_ENTERPRISE_KEY}" ]; then
5151
exit 1
5252
fi
5353
fi
54-
CLASSPATH="hazelcast-remote-controller-${HAZELCAST_RC_VERSION}.jar:hazelcast-enterprise-${HAZELCAST_VERSION}.jar:hazelcast-${HAZELCAST_VERSION}.jar:hazelcast-tests-${HAZELCAST_VERSION}.jar:test/javaclasses"
54+
CLASSPATH="hazelcast-remote-controller-${HAZELCAST_RC_VERSION}.jar:hazelcast-enterprise-${HAZELCAST_VERSION}.jar:hazelcast-${HAZELCAST_VERSION}.jar:hazelcast-${HAZELCAST_TEST_VERSION}-tests.jar:test/javaclasses"
5555
echo "Starting Remote Controller ... enterprise ..."
5656
else
5757
if [ -f "hazelcast-${HAZELCAST_VERSION}.jar" ]; then
@@ -64,7 +64,7 @@ else
6464
exit 1
6565
fi
6666
fi
67-
CLASSPATH="hazelcast-remote-controller-${HAZELCAST_RC_VERSION}.jar:hazelcast-${HAZELCAST_VERSION}.jar:test/javaclasses"
67+
CLASSPATH="hazelcast-remote-controller-${HAZELCAST_RC_VERSION}.jar:hazelcast-${HAZELCAST_VERSION}.jar:hazelcast-${HAZELCAST_TEST_VERSION}-tests.jar"
6868
echo "Starting Remote Controller ... oss ..."
6969
fi
7070

test/Util.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
*/
1616

1717
var expect = require('chai').expect;
18+
var BuildMetadata = require('../lib/BuildMetadata').BuildMetadata;
1819
var promiseLater = function (time, func) {
1920
if (func === undefined) {
2021
func = function(){};
@@ -72,6 +73,14 @@ exports.markEnterprise = function (_this) {
7273
}
7374
};
7475

76+
exports.markServerVersionAtLeast = function (_this, client, expectedVersion) {
77+
var actNumber = client.getClusterService().getOwnerConnection().getConnectedServerVersion();
78+
var expNumber = BuildMetadata.calculateVersion(expectedVersion);
79+
if (actNumber < expNumber) {
80+
_this.skip();
81+
}
82+
};
83+
7584
exports.promiseWaitMilliseconds = function (milliseconds) {
7685
return new Promise(function(resolve, reject) {
7786
setTimeout(function() {

test/nearcache/InvalidationMetadataDistortionTest.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ var IdentifiedFactory = require('../javaclasses/IdentifiedFactory');
2222
var DistortInvalidationMetadataEntryProcessor = require('../javaclasses/DistortInvalidationMetadataEntryProcessor');
2323
var Promise = require('bluebird');
2424
var expect = require('chai').expect;
25+
var Util = require('../Util');
2526

2627
describe('Invalidation metadata distortion', function () {
2728

@@ -73,6 +74,8 @@ describe('Invalidation metadata distortion', function () {
7374

7475

7576
it('lost invalidation', function (done) {
77+
Util.markServerVersionAtLeast(this, client, '3.8');
78+
7679
this.timeout(13000);
7780
var stopTest = false;
7881

test/nearcache/LostInvalidationsTest.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ describe('LostInvalidation', function() {
7373
});
7474

7575
it('client eventually receives an update for which the invalidation event was dropped', function() {
76+
Util.markServerVersionAtLeast(this, client, '3.8');
77+
7678
var map = client.getMap(mapName);
7779
var key = 'key';
7880
var value = 'val';
@@ -98,6 +100,8 @@ describe('LostInvalidation', function() {
98100
});
99101

100102
it('lost invalidation stress test', function() {
103+
Util.markServerVersionAtLeast(this, client, '3.8');
104+
101105
var map = client.getMap(mapName);
102106
var invalidationHandlerStub;
103107
return Util.promiseWaitMilliseconds(100).then(function(resp) {

test/nearcache/MigratedDataTest.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ describe('MigratedData', function() {
7171
});
7272

7373
it('killing a server migrates data to the other node, migrated data has new uuid, near cache discards data with old uuid', function() {
74+
Util.markServerVersionAtLeast(this, client, '3.8');
75+
7476
var map = client.getMap(mapName);
7577
var survivingMember;
7678
var key = 1;

0 commit comments

Comments
 (0)