Browse Source

Test tweaks for compatible security tests (#106464)

Test tweaks for serverless:

* Valid application name in API key tests
* Move from `cluster.health` to `info` call in roles test (the call is just used to check that a user with a cluster privilege is indeed able to execute the test)

Closes: ES-7987
Nikolaj Volgushev 1 year ago
parent
commit
430758dd92

+ 8 - 8
x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/api_key/10_basic.yml

@@ -21,7 +21,7 @@ setup:
               ],
               "applications": [
                 {
-                  "application": "myapp",
+                  "application": "kibana-.kibana",
                   "privileges": ["*"],
                   "resources": ["*"]
                 }
@@ -43,14 +43,14 @@ setup:
       security.put_privileges:
         body: >
           {
-            "myapp": {
+            "kibana-.kibana": {
               "read": {
-                "application": "myapp",
+                "application": "kibana-.kibana",
                 "name": "read",
                 "actions": [ "data:read/*" ]
               },
               "write": {
-                "application": "myapp",
+                "application": "kibana-.kibana",
                 "name": "write",
                 "actions": [ "data:write/*" ]
               }
@@ -71,7 +71,7 @@ teardown:
 
   - do:
       security.delete_privileges:
-        application: myapp
+        application: "kibana-.kibana"
         name: "read,write"
         ignore: 404
 
@@ -301,7 +301,7 @@ teardown:
                   ],
                   "applications": [
                     {
-                      "application": "myapp",
+                      "application": "kibana-.kibana",
                       "privileges": ["read"],
                       "resources": ["*"]
                     }
@@ -344,7 +344,7 @@ teardown:
             ],
             "application": [
               {
-                "application" : "myapp",
+                "application" : "kibana-.kibana",
                 "resources" : [ "*", "some-other-res" ],
                 "privileges" : [ "data:read/me", "data:write/me" ]
               }
@@ -369,7 +369,7 @@ teardown:
       }
     } }
   - match: { "application" : {
-      "myapp" : {
+      "kibana-.kibana" : {
         "*" : {
           "data:read/me" : true,
           "data:write/me" : false

+ 5 - 2
x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/roles/10_basic.yml

@@ -52,6 +52,8 @@ teardown:
   - match: { role: { created: true } }
 
   - do:
+      headers:
+        Authorization: "Basic am9lOnMza3JpdC1wYXNzd29yZA=="
       security.put_role:
         name: "backwards_role"
         body:  >
@@ -69,10 +71,11 @@ teardown:
   - do:
       headers:
         Authorization: "Basic am9lOnMza3JpdC1wYXNzd29yZA=="
-      cluster.health: {}
-  - match: { timed_out: false }
+      info: {}
 
   - do:
+      headers:
+        Authorization: "Basic am9lOnMza3JpdC1wYXNzd29yZA=="
       security.get_role:
         name: "admin_role"
   - match: { admin_role.cluster.0:  "all" }

+ 1 - 2
x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/roles/11_idx_arrays.yml

@@ -72,8 +72,7 @@ teardown:
   - do:
       headers:
         Authorization: "Basic am9lOnMza3JpdC1wYXNzd29yZA=="
-      cluster.health: {}
-  - match: { timed_out: false }
+      info: {}
 
   - do:
       security.get_role: