Skip to content

Commit 587b016

Browse files
committed
Running tests as minimal user
Resolves #75 . Realized in the process that we don't need to read the API declaration from the modules database, so going to submit a PR for that next.
1 parent 41192a3 commit 587b016

File tree

4 files changed

+46
-3
lines changed

4 files changed

+46
-3
lines changed

gradle.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,4 @@ mlAppName=kafka-test
2222
mlUsername=admin
2323
mlPassword=changeme-in-gradle-local.properties
2424
mlContentForestsPerHost=1
25+
mlModulePermissions=rest-extension-user,read,rest-extension-user,execute,rest-admin,update

src/test/java/com/marklogic/kafka/connect/sink/AbstractIntegrationTest.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,14 @@ public class AbstractIntegrationTest extends AbstractSpringMarkLogicTest {
2424
/**
2525
* @return a config map containing connection values based on the test application configuration
2626
*/
27-
protected Map<String, String> newSinkConfig() {
27+
private Map<String, String> newSinkConfig() {
2828
Map<String, String> config = new HashMap<>();
2929
config.put("ml.connection.host", testConfig.getHost());
3030
config.put("ml.connection.port", testConfig.getRestPort() + "");
3131
config.put("ml.connection.securityContextType", "DIGEST");
32-
config.put("ml.connection.username", testConfig.getUsername());
33-
config.put("ml.connection.password", testConfig.getPassword());
32+
config.put("ml.connection.username", "kafka-test-user");
33+
config.put("ml.connection.password", "kafkatest");
34+
config.put("ml.document.permissions", "rest-reader,read,rest-writer,update");
3435
return config;
3536
}
3637

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"role-name": "kafka-test-minimal-user",
3+
"description": "rest-reader/rest-writer privileges are needed to read forest info and write documents; rest-extension-user, any-uri, unprotected-collections, and xdmp-eval-in is needed for Bulk DS to read the API declaration",
4+
"role": [
5+
"rest-extension-user"
6+
],
7+
"privilege": [
8+
{
9+
"privilege-name": "rest-reader",
10+
"action": "http://marklogic.com/xdmp/privileges/rest-reader",
11+
"kind": "execute"
12+
},
13+
{
14+
"privilege-name": "rest-writer",
15+
"action": "http://marklogic.com/xdmp/privileges/rest-writer",
16+
"kind": "execute"
17+
},
18+
{
19+
"privilege-name": "any-uri",
20+
"action": "http://marklogic.com/xdmp/privileges/any-uri",
21+
"kind": "execute"
22+
},
23+
{
24+
"privilege-name": "unprotected-collections",
25+
"action": "http://marklogic.com/xdmp/privileges/unprotected-collections",
26+
"kind": "execute"
27+
},
28+
{
29+
"privilege-name": "xdmp:eval-in",
30+
"action": "http://marklogic.com/xdmp/privileges/xdmp-eval-in",
31+
"kind": "execute"
32+
}
33+
]
34+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"user-name": "kafka-test-user",
3+
"password": "kafkatest",
4+
"role": [
5+
"kafka-test-minimal-user"
6+
]
7+
}

0 commit comments

Comments
 (0)