Revert "Raised the default version of Mongo to 3.6.5 when using Embedded Mongo."

This reverts commit 1a4ad96dd0. Reverting
to see if this fixes CI timeouts.
pull/14499/head
Madhura Bhave 6 years ago
parent b2dd162572
commit 9201e23f67

@ -35,7 +35,6 @@ import de.flapdoodle.embed.mongo.config.RuntimeConfigBuilder;
import de.flapdoodle.embed.mongo.config.Storage; import de.flapdoodle.embed.mongo.config.Storage;
import de.flapdoodle.embed.mongo.distribution.Feature; import de.flapdoodle.embed.mongo.distribution.Feature;
import de.flapdoodle.embed.mongo.distribution.IFeatureAwareVersion; import de.flapdoodle.embed.mongo.distribution.IFeatureAwareVersion;
import de.flapdoodle.embed.mongo.distribution.Version;
import de.flapdoodle.embed.mongo.distribution.Versions; import de.flapdoodle.embed.mongo.distribution.Versions;
import de.flapdoodle.embed.process.config.IRuntimeConfig; import de.flapdoodle.embed.process.config.IRuntimeConfig;
import de.flapdoodle.embed.process.config.io.ProcessOutput; import de.flapdoodle.embed.process.config.io.ProcessOutput;
@ -126,8 +125,11 @@ public class EmbeddedMongoAutoConfiguration {
@Bean @Bean
@ConditionalOnMissingBean @ConditionalOnMissingBean
public IMongodConfig embeddedMongoConfiguration() throws IOException { public IMongodConfig embeddedMongoConfiguration() throws IOException {
IFeatureAwareVersion featureAwareVersion = Versions.withFeatures(
new GenericVersion(this.embeddedProperties.getVersion()),
this.embeddedProperties.getFeatures().toArray(new Feature[0]));
MongodConfigBuilder builder = new MongodConfigBuilder() MongodConfigBuilder builder = new MongodConfigBuilder()
.version(determineVersion()); .version(featureAwareVersion);
EmbeddedMongoProperties.Storage storage = this.embeddedProperties.getStorage(); EmbeddedMongoProperties.Storage storage = this.embeddedProperties.getStorage();
if (storage != null) { if (storage != null) {
String databaseDir = storage.getDatabaseDir(); String databaseDir = storage.getDatabaseDir();
@ -147,20 +149,6 @@ public class EmbeddedMongoAutoConfiguration {
return builder.build(); return builder.build();
} }
private IFeatureAwareVersion determineVersion() {
if (this.embeddedProperties.getFeatures() == null) {
for (Version version : Version.values()) {
if (version.asInDownloadPath()
.equals(this.embeddedProperties.getVersion())) {
return version;
}
}
}
return Versions.withFeatures(
new GenericVersion(this.embeddedProperties.getVersion()),
this.embeddedProperties.getFeatures().toArray(new Feature[0]));
}
private InetAddress getHost() throws UnknownHostException { private InetAddress getHost() throws UnknownHostException {
if (this.properties.getHost() == null) { if (this.properties.getHost() == null) {
return InetAddress.getByAddress(Network.localhostIsIPv6() return InetAddress.getByAddress(Network.localhostIsIPv6()

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2018 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -16,6 +16,8 @@
package org.springframework.boot.autoconfigure.mongo.embedded; package org.springframework.boot.autoconfigure.mongo.embedded;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set; import java.util.Set;
import de.flapdoodle.embed.mongo.distribution.Feature; import de.flapdoodle.embed.mongo.distribution.Feature;
@ -35,15 +37,15 @@ public class EmbeddedMongoProperties {
/** /**
* Version of Mongo to use. * Version of Mongo to use.
*/ */
private String version = "3.6.5"; private String version = "3.2.2";
private final Storage storage = new Storage(); private final Storage storage = new Storage();
/** /**
* Comma-separated list of features to enable. Uses the defaults of the configured * Comma-separated list of features to enable.
* version by default.
*/ */
private Set<Feature> features = null; private Set<Feature> features = new HashSet<>(
Collections.singletonList(Feature.SYNC_DELAY));
public String getVersion() { public String getVersion() {
return this.version; return this.version;

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2018 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -60,20 +60,19 @@ public class EmbeddedMongoAutoConfigurationTests {
@Test @Test
public void defaultVersion() { public void defaultVersion() {
assertVersionConfiguration(null, "3.6.5"); assertVersionConfiguration(null, "3.2.2");
} }
@Test @Test
public void customVersion() { public void customVersion() {
assertVersionConfiguration("3.6.3", "3.6.3"); assertVersionConfiguration("2.7.1", "2.7.1");
} }
@Test @Test
public void customFeatures() { public void customFeatures() {
load("spring.mongodb.embedded.features=TEXT_SEARCH, SYNC_DELAY, ONLY_WITH_SSL, NO_HTTP_INTERFACE_ARG"); load("spring.mongodb.embedded.features=TEXT_SEARCH, SYNC_DELAY");
assertThat(this.context.getBean(EmbeddedMongoProperties.class).getFeatures()) assertThat(this.context.getBean(EmbeddedMongoProperties.class).getFeatures())
.containsExactly(Feature.TEXT_SEARCH, Feature.SYNC_DELAY, .contains(Feature.TEXT_SEARCH, Feature.SYNC_DELAY);
Feature.ONLY_WITH_SSL, Feature.NO_HTTP_INTERFACE_ARG);
} }
@Test @Test

Loading…
Cancel
Save