Skip to content

Acceptance: add Identity V3 Trusts CRUD test#1645

Closed
ozerovandrei wants to merge 4 commits intogophercloud:masterfrom
ozerovandrei:trust-basic-acc-test
Closed

Acceptance: add Identity V3 Trusts CRUD test#1645
ozerovandrei wants to merge 4 commits intogophercloud:masterfrom
ozerovandrei:trust-basic-acc-test

Conversation

@ozerovandrei
Copy link
Copy Markdown
Contributor

Add TestTrustCRUD acceptance test with some helpers to create and delete
trusts.

For #1642

Links to the line numbers/files in the OpenStack source code that support the
code in this PR:

https://github.com/openstack/keystone/blob/stable/stein/keystone/api/trusts.py
https://github.com/openstack/keystone/blob/stable/stein/keystone/trust/core.py

Implement Create and Extract functions for v3/extenstions/trusts package
with unit tests and docs.

This commit also adds Role struct to this package.
Implement Delete function for the v3/extensions/trusts package with
tests and docs.
Add TestTrustCRUD acceptance test with some helpers to create and delete
trusts.
@coveralls
Copy link
Copy Markdown

coveralls commented Jul 15, 2019

Coverage Status

Coverage increased (+0.02%) to 76.907% when pulling a78fc5c on ozerovandrei:trust-basic-acc-test into 17584a2 on gophercloud:master.

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.02%) to 76.907% when pulling 163bc42 on ozerovandrei:trust-basic-acc-test into 17584a2 on gophercloud:master.

@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci bot commented Jul 15, 2019

Build failed.

Remove required tag from the "impersonation" argument since it's boolean
so we can just don't set "omitempty" tag to always send it in the Create
request.
@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci bot commented Jul 15, 2019

Build failed.

@ozerovandrei
Copy link
Copy Markdown
Contributor Author

ozerovandrei commented Jul 16, 2019

There is following error:

2019-07-15 18:38:47.304606 | ubuntu-xenial |     convenience.go:35: �[1;31mFailure in trusts_test.go, line 52: unexpected error �[0m�[1;33m"Request forbidden: [POST http://192.168.0.9/identity/v3/OS-TRUST/trusts], error message: {\"error\":{\"code\":403,\"message\":\"You are not authorized to perform the requested action: identity:create_trust.\",\"title\":\"Forbidden\"}}\n"�[0m�[1;31m�[0m

But I required admin privilegies 🤔:

func TestTrustCRUD(t *testing.T) {
	clients.RequireAdmin(t)

@jtopjian
Copy link
Copy Markdown
Contributor

@ozerovandrei It's possible that Identity trusts are not enabled in the OpenLab configuration.

@kiwik @huangtianhua Can you confirm if the Keystone/Identity OS-TRUST extension is enabled?

@huangtianhua
Copy link
Copy Markdown
Contributor

@jtopjian @ozerovandrei I looked the code of keystone, the api 'create_trust' required the rule: RULE_TRUST_OWNER(RULE_TRUST_OWNER = 'user_id:%(trust.trustor_user_id)s')
https://github.com/openstack/keystone/blob/master/keystone/common/policies/trust.py#L20
https://github.com/openstack/keystone/blob/master/keystone/common/policies/base.py#L32

Seems the test you added doesn't follow this rule, could you check this?

@jtopjian jtopjian mentioned this pull request Jan 13, 2020
@ozerovandrei
Copy link
Copy Markdown
Contributor Author

Implemented in #1818

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants