Skip to content
Permalink
Browse files
OAK-9757 : fixed issue where size limit would come wrong for version …
…less than 4.2.0
  • Loading branch information
Rishabh Kumar committed May 23, 2022
1 parent 596524f commit 73562d897f8353e80d2d7344a0b6a62c9949ee5f
Showing 2 changed files with 14 additions and 2 deletions.
@@ -203,6 +203,6 @@ static Type getDocumentStoreExceptionTypeFor(Throwable t) {
*/
static int getNodeNameLimit(final String version) {
final ServerVersion sv = new ServerVersion(Arrays.stream(version.split("\\.")).map(Integer::new).collect(Collectors.toList()));
return sv.compareTo(new ServerVersion(4,0)) > 0 ? Integer.MAX_VALUE : Utils.NODE_NAME_LIMIT;
return sv.compareTo(new ServerVersion(4,2)) >= 0 ? Integer.MAX_VALUE : Utils.NODE_NAME_LIMIT;
}
}
@@ -207,7 +207,13 @@ public void getSizeLimitForMongo4() {
}

@Test
public void getSizeLimitForMongo3() {
public void getSizeLimitForMongo4_1_27() {
int sizeLimit = MongoUtils.getNodeNameLimit("4.1.27");
assertEquals(150, sizeLimit);
}

@Test
public void getSizeLimitForMongo3_5() {
int sizeLimit = MongoUtils.getNodeNameLimit("3.5.0");
assertEquals(150, sizeLimit);
}
@@ -218,6 +224,12 @@ public void getSizeLimitForMongo4_2() {
assertEquals(Integer.MAX_VALUE, sizeLimit);
}

@Test
public void getSizeLimitForMongo4_2_1() {
int sizeLimit = MongoUtils.getNodeNameLimit("4.2.1");
assertEquals(Integer.MAX_VALUE, sizeLimit);
}

private static MongoCommandException newMongoCommandException(int code) {
return new MongoCommandException(response(code), new ServerAddress());
}

0 comments on commit 73562d8

Please sign in to comment.