aboutsummaryrefslogtreecommitdiffstats
path: root/tests/resilience/user_indexer.btm
diff options
context:
space:
mode:
Diffstat (limited to 'tests/resilience/user_indexer.btm')
-rw-r--r--tests/resilience/user_indexer.btm23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/resilience/user_indexer.btm b/tests/resilience/user_indexer.btm
new file mode 100644
index 00000000000..a80c2910d32
--- /dev/null
+++ b/tests/resilience/user_indexer.btm
@@ -0,0 +1,23 @@
+# sonar.web.javaAdditionalOpts=-javaagent:/path/to/byteman-3.0.10/lib/byteman.jar=script:/path/to/user_indexer.btm,boot:/path/to/byteman-3.0.10/lib/byteman.jar
+# sonar.search.recovery.delayInMs=10000
+# sonar.search.recovery.minAgeInMs=30000
+
+RULE make indexing of users silently fail
+CLASS org.sonar.server.user.index.UserIndexer
+METHOD postCommit
+COMPILE
+AT ENTRY
+BIND logins:Collection = $logins
+IF logins.contains("error")
+DO RETURN
+ENDRULE
+
+RULE make indexing of users fail
+CLASS org.sonar.server.user.index.UserIndexer
+METHOD postCommit
+COMPILE
+AT ENTRY
+BIND logins:Collection = $logins
+IF logins.contains("crash")
+DO THROW new RuntimeException("Fail to index users to Elasticsearch because a user 'crash' has been given")
+ENDRULE