aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSébastien Lesaint <sebastien.lesaint@sonarsource.com>2018-02-05 15:16:00 +0100
committerSébastien Lesaint <sebastien.lesaint@sonarsource.com>2018-02-08 13:41:00 +0100
commite6dbc80a0d82fb12c9bd19cfdb68767484521d87 (patch)
tree23c50941766d5ed6e784321870d754ef808625f2
parent3d33e6cd499423d6f19e7ffdea9a14ff8a50ee6b (diff)
downloadsonarqube-e6dbc80a0d82fb12c9bd19cfdb68767484521d87.tar.gz
sonarqube-e6dbc80a0d82fb12c9bd19cfdb68767484521d87.zip
SONAR-10311 add IT for QP notification in case of plugin downgrade
-rw-r--r--tests/src/test/java/org/sonarqube/tests/qualityProfile/BuiltInQualityProfilesNotificationTest.java29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/src/test/java/org/sonarqube/tests/qualityProfile/BuiltInQualityProfilesNotificationTest.java b/tests/src/test/java/org/sonarqube/tests/qualityProfile/BuiltInQualityProfilesNotificationTest.java
index 042430e63b2..2eb34952fa4 100644
--- a/tests/src/test/java/org/sonarqube/tests/qualityProfile/BuiltInQualityProfilesNotificationTest.java
+++ b/tests/src/test/java/org/sonarqube/tests/qualityProfile/BuiltInQualityProfilesNotificationTest.java
@@ -141,6 +141,35 @@ public class BuiltInQualityProfilesNotificationTest {
" 1 rule removed",
"This is a good time to review your quality profiles and update them to benefit from the latest evolutions: " + url + "/profiles")
.isEqualTo(messages.get(1).getMimeMessage().getContent().toString());
+
+
+ // uninstall plugin V2
+ wsClient.wsConnector().call(new PostRequest("api/plugins/uninstall").setParam("key", "foo")).failIfNotSuccessful();
+ // install plugin V1
+ orchestrator.getConfiguration().fileSystem().copyToDirectory(pluginArtifact("foo-plugin-v1"), pluginsDir);
+
+ orchestrator.restartServer();
+
+ waitUntilAllNotificationsAreDelivered(2, 10, 1_000);
+ messages = smtpServer.getMessages();
+ assertThat(messages)
+ .extracting(this::getMimeMessage)
+ .extracting(this::getAllRecipients)
+ .containsOnly("<" + profileAdmin1.getEmail() + ">", "<" + profileAdmin2.getEmail() + ">");
+ assertThat(messages)
+ .extracting(this::getMimeMessage)
+ .extracting(this::getSubject)
+ .containsOnly("[SONARQUBE] Built-in quality profiles have been updated");
+ assertThat(messages.get(0).getMimeMessage().getContent().toString())
+ .containsSubsequence(
+ "The following built-in profiles have been updated:",
+ "\"Basic\" - Foo: " + url + "/profiles/changelog?language=foo&name=Basic&since=", "&to=",
+ " 1 new rule",
+ " 3 rules have been updated",
+ " 1 rule removed",
+ "This is a good time to review your quality profiles and update them to benefit from the latest evolutions: " + url + "/profiles")
+ .isEqualTo(messages.get(1).getMimeMessage().getContent().toString());
+
}
@Test