[SECURITY] Added a `teardown` section to the integration test for roles
Currently, the REST tests for security (and possibly others) don't clean up the environment after they have run, eg. they don't delete the users and roles they create. This leads to test failures, because in a subsequent run, a user or role already exists, so eg. a test like `match: { role: { created: true } }` fails. This patch adds a `teardown` section to the test, with `do` actions which are to be executed _after_ the test runs. This patch assumes that REST tests runners for all languages support the `teardown` directive in a xUnimt nomenclature -- similarly to the `setup` directive, which they already support. Original commit: elastic/x-pack-elasticsearch@70d0ff4ee9
This commit is contained in:
parent
30dd9ab09c
commit
6d535043f8
|
@ -3,9 +3,28 @@
|
|||
- skip:
|
||||
features: headers
|
||||
|
||||
- do:
|
||||
cluster.health:
|
||||
wait_for_status: yellow
|
||||
- setup:
|
||||
- do:
|
||||
cluster.health:
|
||||
wait_for_status: yellow
|
||||
|
||||
- teardown:
|
||||
- do:
|
||||
xpack.security.delete_role:
|
||||
name: "admin_role2"
|
||||
ignore: 404
|
||||
|
||||
- do:
|
||||
xpack.security.delete_user:
|
||||
username: "joe"
|
||||
ignore: 404
|
||||
|
||||
- do:
|
||||
delete:
|
||||
index: foo
|
||||
type: doc
|
||||
id: 1
|
||||
ignore: 404
|
||||
|
||||
- do:
|
||||
xpack.security.put_role:
|
||||
|
@ -50,7 +69,6 @@
|
|||
- match: { _index: foo }
|
||||
- match: { _type: doc }
|
||||
- match: { _id: "1"}
|
||||
- match: { _version: 1}
|
||||
- match: { _source: { foo: bar }}
|
||||
|
||||
# test that the role works on the cluster level
|
||||
|
|
Loading…
Reference in New Issue