aboutsummaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorJacek <jacek.poreda@sonarsource.com>2021-06-14 12:25:54 +0200
committersonartech <sonartech@sonarsource.com>2021-06-16 20:03:04 +0000
commit0d0918a8f5ff5e94f012ebf6dd345a12614ad888 (patch)
treef37b2bbc43f0cd43958eb75662923aabc4b01f9c /server
parent905642ccc24e3f2b68c0549cad07328a71ed48e0 (diff)
downloadsonarqube-0d0918a8f5ff5e94f012ebf6dd345a12614ad888.tar.gz
sonarqube-0d0918a8f5ff5e94f012ebf6dd345a12614ad888.zip
SONAR-14792 Bump min upgrade version to current LTS
Diffstat (limited to 'server')
-rw-r--r--server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/DatabaseVersion.java2
-rw-r--r--server/sonar-webserver-core/src/test/java/org/sonar/server/platform/DatabaseServerCompatibilityTest.java27
2 files changed, 15 insertions, 14 deletions
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/DatabaseVersion.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/DatabaseVersion.java
index 4949182e958..529b9a378b9 100644
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/DatabaseVersion.java
+++ b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/DatabaseVersion.java
@@ -30,7 +30,7 @@ public class DatabaseVersion {
* versions must be previously upgraded to LTS version.
* Note that the value can't be less than current LTS version.
*/
- public static final long MIN_UPGRADE_VERSION = 2_800;
+ public static final long MIN_UPGRADE_VERSION = 4_400;
private final MigrationSteps migrationSteps;
private final MigrationHistory migrationHistory;
diff --git a/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/DatabaseServerCompatibilityTest.java b/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/DatabaseServerCompatibilityTest.java
index c806766d108..acf32f945f8 100644
--- a/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/DatabaseServerCompatibilityTest.java
+++ b/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/DatabaseServerCompatibilityTest.java
@@ -30,14 +30,13 @@ import org.sonar.api.utils.log.LoggerLevel;
import org.sonar.server.platform.db.migration.version.DatabaseVersion;
import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
public class DatabaseServerCompatibilityTest {
@Rule
- public ExpectedException thrown = ExpectedException.none();
- @Rule
public LogTester logTester = new LogTester();
@Rule
public ExpectedException expectedException = ExpectedException.none();
@@ -45,24 +44,26 @@ public class DatabaseServerCompatibilityTest {
@Test
public void fail_if_requires_downgrade() {
- thrown.expect(MessageException.class);
- thrown.expectMessage("Database was upgraded to a more recent version of SonarQube. "
- + "A backup must probably be restored or the DB settings are incorrect.");
-
DatabaseVersion version = mock(DatabaseVersion.class);
when(version.getStatus()).thenReturn(DatabaseVersion.Status.REQUIRES_DOWNGRADE);
- new DatabaseServerCompatibility(version, settings.asConfig()).start();
+ var config = settings.asConfig();
+ var compatibility = new DatabaseServerCompatibility(version, config);
+ assertThatThrownBy(compatibility::start)
+ .isInstanceOf(MessageException.class)
+ .hasMessage("Database was upgraded to a more recent version of SonarQube. "
+ + "A backup must probably be restored or the DB settings are incorrect.");
}
@Test
public void fail_if_requires_firstly_to_upgrade_to_lts() {
- thrown.expect(MessageException.class);
- thrown.expectMessage("Current version is too old. Please upgrade to Long Term Support version firstly.");
-
DatabaseVersion version = mock(DatabaseVersion.class);
when(version.getStatus()).thenReturn(DatabaseVersion.Status.REQUIRES_UPGRADE);
when(version.getVersion()).thenReturn(Optional.of(12L));
- new DatabaseServerCompatibility(version, settings.asConfig()).start();
+ var config = settings.asConfig();
+ var compatibility = new DatabaseServerCompatibility(version, config);
+ assertThatThrownBy(compatibility::start)
+ .isInstanceOf(MessageException.class)
+ .hasMessage("Current version is too old. Please upgrade to Long Term Support version firstly.");
}
@Test
@@ -77,9 +78,9 @@ public class DatabaseServerCompatibilityTest {
"The database must be manually upgraded. Please backup the database and browse /setup. "
+ "For more information: https://docs.sonarqube.org/latest/setup/upgrading",
"################################################################################",
- "The database must be manually upgraded. Please backup the database and browse /setup. "
+ "The database must be manually upgraded. Please backup the database and browse /setup. "
+ "For more information: https://docs.sonarqube.org/latest/setup/upgrading",
- "################################################################################");
+ "################################################################################");
}
@Test