diff options
author | Julien Lancelot <julien.lancelot@sonarsource.com> | 2016-12-06 12:44:56 +0100 |
---|---|---|
committer | Stas Vilchik <vilchiks@gmail.com> | 2016-12-07 14:36:18 +0100 |
commit | b117943f3efa541d6c8cd8e62ad157c4f8194211 (patch) | |
tree | 825fa577b1943d1188b0e4a7d0237b7690687951 /tests | |
parent | 160109946acd018e7c3b79dbe008c39d51235ddf (diff) | |
download | sonarqube-b117943f3efa541d6c8cd8e62ad157c4f8194211.tar.gz sonarqube-b117943f3efa541d6c8cd8e62ad157c4f8194211.zip |
SONAR-8498 Make WS api/l10n/index accessible without authentication or migration
Diffstat (limited to 'tests')
-rw-r--r-- | tests/upgrade/src/test/java/org/sonarsource/sonarqube/upgrade/UpgradeTest.java | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/tests/upgrade/src/test/java/org/sonarsource/sonarqube/upgrade/UpgradeTest.java b/tests/upgrade/src/test/java/org/sonarsource/sonarqube/upgrade/UpgradeTest.java index fb6e1b42436..84a2c58dee6 100644 --- a/tests/upgrade/src/test/java/org/sonarsource/sonarqube/upgrade/UpgradeTest.java +++ b/tests/upgrade/src/test/java/org/sonarsource/sonarqube/upgrade/UpgradeTest.java @@ -93,7 +93,7 @@ public class UpgradeTest { private void upgradeTo(String sqVersion, String javaVersion) { startNewServer(sqVersion, SQ_VERSION_DEV.equals(sqVersion) ? LATEST_JAVA_RELEASE : javaVersion); checkSystemStatus(ServerStatusResponse.Status.DB_MIGRATION_NEEDED); - checkUrlsBeforeUpgrade(); + checkUrlsBeforeUpgrade(sqVersion); upgrade(); checkSystemStatus(ServerStatusResponse.Status.UP); @@ -106,11 +106,12 @@ public class UpgradeTest { assertThat(serverStatusResponse.getStatus()).isEqualTo(serverStatus); } - private void checkUrlsBeforeUpgrade() { + private void checkUrlsBeforeUpgrade(String sqVersion) { // These urls should be available when system requires a migration checkUrlIsReturningOk("/api/system/status"); checkUrlIsReturningOk("/api/system/db_migration_status"); checkUrlIsReturningOk("/api/webservices/list"); + checkUrlIsReturningOkOnlyForDevVersion("/api/l10n/index", sqVersion); // These urls should not be available when system requires a migration checkUrlIsReturningNotFound("/api/issues/search?projectKeys=org.apache.struts%3Astruts-core"); @@ -132,6 +133,7 @@ public class UpgradeTest { checkUrlIsReturningOk("/api/system/status"); checkUrlIsReturningOk("/api/system/db_migration_status"); checkUrlIsReturningOk("/api/webservices/list"); + checkUrlIsReturningOk("/api/l10n/index"); checkUrlIsReturningOk("/api/issues/search?projectKeys=org.apache.struts%3Astruts-core"); checkUrlIsReturningOk("/api/components/tree?baseComponentKey=org.apache.struts%3Astruts-core"); @@ -229,6 +231,14 @@ public class UpgradeTest { newWsClient(orchestrator).wsConnector().call(new GetRequest(url)).failIfNotSuccessful(); } + // Some urls are available during migration only recently + private void checkUrlIsReturningOkOnlyForDevVersion(String url, String sqVersion) { + if (sqVersion.equals(SQ_VERSION_DEV)) { + WsResponse wsResponse = newWsClient(orchestrator).wsConnector().call(new GetRequest(url)); + assertThat(wsResponse.isSuccessful()).as("SQ version %s", sqVersion).isTrue(); + } + } + private void checkUrlIsReturningNotFound(String url) { WsResponse response = newWsClient(orchestrator).wsConnector().call(new GetRequest(url)); assertThat(response.code()).isEqualTo(HttpURLConnection.HTTP_NOT_FOUND); |