Skip to content

Commit c0cfe81

Browse files
authored
Fix possible test failure for bwc with earlier versions, e.g. 7.0 (#63053)
In earlier versions, e.g. 7.0, creation of API keys mandate the role_descriptors field. This PR ensure role_descriptors field is always specified. Also the watcher created with the API key has interval of 1s and throttle of 1s as well. In rare cases, the watcher state may happen to be throttled instead of executed during the assertion period. This PR reduces the throttle to 500ms.
1 parent 060f500 commit c0cfe81

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

x-pack/qa/full-cluster-restart/src/test/java/org/elasticsearch/xpack/restart/FullClusterRestartIT.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,8 @@ public void testWatcherWithApiKey() throws Exception {
216216

217217
if (isRunningAgainstOldCluster()) {
218218
final Request createApiKeyRequest = new Request("PUT", "/_security/api_key");
219-
createApiKeyRequest.setJsonEntity("{\"name\":\"key-1\"}");
219+
createApiKeyRequest.setJsonEntity("{\"name\":\"key-1\",\"role_descriptors\":" +
220+
"{\"r\":{\"cluster\":[\"all\"],\"indices\":[{\"names\":[\"*\"],\"privileges\":[\"all\"]}]}}}");
220221
final Response response = client().performRequest(createApiKeyRequest);
221222
final Map<String, Object> createApiKeyResponse = entityAsMap(response);
222223

x-pack/qa/full-cluster-restart/src/test/resources/org/elasticsearch/xpack/restart/logging-watch.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
}
1717
}
1818
},
19-
"throttle_period": "1s",
19+
"throttle_period_in_millis": 500,
2020
"actions" : {
2121
"log" : {
2222
"logging" : {

0 commit comments

Comments
 (0)