opentelekomcloud / vault-plugin-secrets-openstack

Create OpenStack tokens using HashiCorp Vault
Apache License 2.0
23 stars 6 forks source link

Implement ``static-roles`` #98

Closed artem-lifshits closed 2 years ago

artem-lifshits commented 2 years ago

This PR implements static-roles functionality.

Acceptance tests:

Running acceptance tests... === RUN TestPlugin === RUN TestPlugin/TestCloudLifecycle === RUN TestPlugin/TestCloudLifecycle/WriteCloud === RUN TestPlugin/TestCloudLifecycle/ReadCloud === RUN TestPlugin/TestCloudLifecycle/ListClouds === RUN TestPlugin/TestCloudLifecycle/ListClouds/method-LIST === PAUSE TestPlugin/TestCloudLifecycle/ListClouds/method-LIST === RUN TestPlugin/TestCloudLifecycle/ListClouds/method-GET === PAUSE TestPlugin/TestCloudLifecycle/ListClouds/method-GET === CONT TestPlugin/TestCloudLifecycle/ListClouds/method-LIST === CONT TestPlugin/TestCloudLifecycle/ListClouds/method-GET === RUN TestPlugin/TestCloudLifecycle/DeleteCloud === RUN TestPlugin/TestCredsLifecycle === RUN TestPlugin/TestCredsLifecycle/root_token === RUN TestPlugin/TestCredsLifecycle/user_token === RUN TestPlugin/TestCredsLifecycle/user_password === RUN TestPlugin/TestInfo info_test.go:42: Error Trace: info_test.go:42 Error: Should NOT be empty, but was &{ } Test: TestPlugin/TestInfo === RUN TestPlugin/TestRoleLifecycle roles_test.go:53: Cloud with name jbpd2cco5j was created === RUN TestPlugin/TestRoleLifecycle/WriteRole === RUN TestPlugin/TestRoleLifecycle/ReadRole === RUN TestPlugin/TestRoleLifecycle/ListRoles === RUN TestPlugin/TestRoleLifecycle/ListRoles/method-LIST === PAUSE TestPlugin/TestRoleLifecycle/ListRoles/method-LIST === RUN TestPlugin/TestRoleLifecycle/ListRoles/method-GET === PAUSE TestPlugin/TestRoleLifecycle/ListRoles/method-GET === CONT TestPlugin/TestRoleLifecycle/ListRoles/method-LIST === CONT TestPlugin/TestRoleLifecycle/ListRoles/method-GET === RUN TestPlugin/TestRoleLifecycle/DeleteRole === CONT TestPlugin/TestRoleLifecycle plugin_test.go:337: Cloud with name jbpd2cco5j has been removed === RUN TestPlugin/TestRootRotate rotate_test.go:65: Cloud with name default1 was created rotate_test.go:68: Cloud with name nn2r was created plugin_test.go:337: Cloud with name nn2r has been removed plugin_test.go:337: Cloud with name default1 has been removed === RUN TestPlugin/TestStaticRoleLifecycle static_roles_test.go:53: Cloud with name xeougqh97e was created === RUN TestPlugin/TestStaticRoleLifecycle/WriteRole === RUN TestPlugin/TestStaticRoleLifecycle/ReadRole === RUN TestPlugin/TestStaticRoleLifecycle/ListRoles === RUN TestPlugin/TestStaticRoleLifecycle/ListRoles/method-LIST === PAUSE TestPlugin/TestStaticRoleLifecycle/ListRoles/method-LIST === RUN TestPlugin/TestStaticRoleLifecycle/ListRoles/method-GET === PAUSE TestPlugin/TestStaticRoleLifecycle/ListRoles/method-GET === CONT TestPlugin/TestStaticRoleLifecycle/ListRoles/method-LIST === CONT TestPlugin/TestStaticRoleLifecycle/ListRoles/method-GET === RUN TestPlugin/TestStaticRoleLifecycle/DeleteRole === CONT TestPlugin/TestStaticRoleLifecycle plugin_test.go:337: Cloud with name xeougqh97e has been removed --- FAIL: TestPlugin (12.09s) --- PASS: TestPlugin/TestCloudLifecycle (0.09s) --- PASS: TestPlugin/TestCloudLifecycle/WriteCloud (0.08s) --- PASS: TestPlugin/TestCloudLifecycle/ReadCloud (0.00s) --- PASS: TestPlugin/TestCloudLifecycle/ListClouds (0.00s) --- PASS: TestPlugin/TestCloudLifecycle/ListClouds/method-GET (0.00s) --- PASS: TestPlugin/TestCloudLifecycle/ListClouds/method-LIST (0.00s) --- PASS: TestPlugin/TestCloudLifecycle/DeleteCloud (0.00s) --- PASS: TestPlugin/TestCredsLifecycle (6.48s) --- PASS: TestPlugin/TestCredsLifecycle/root_token (2.02s) --- PASS: TestPlugin/TestCredsLifecycle/user_token (2.21s) --- PASS: TestPlugin/TestCredsLifecycle/user_password (1.21s) --- FAIL: TestPlugin/TestInfo (0.00s) --- PASS: TestPlugin/TestRoleLifecycle (0.02s) --- PASS: TestPlugin/TestRoleLifecycle/WriteRole (0.00s) --- PASS: TestPlugin/TestRoleLifecycle/ReadRole (0.00s) --- PASS: TestPlugin/TestRoleLifecycle/ListRoles (0.00s) --- PASS: TestPlugin/TestRoleLifecycle/ListRoles/method-GET (0.01s) --- PASS: TestPlugin/TestRoleLifecycle/ListRoles/method-LIST (0.01s) --- PASS: TestPlugin/TestRoleLifecycle/DeleteRole (0.00s) --- PASS: TestPlugin/TestRootRotate (5.35s) --- PASS: TestPlugin/TestStaticRoleLifecycle (0.01s) --- PASS: TestPlugin/TestStaticRoleLifecycle/WriteRole (0.00s) --- PASS: TestPlugin/TestStaticRoleLifecycle/ReadRole (0.00s) --- PASS: TestPlugin/TestStaticRoleLifecycle/ListRoles (0.00s) --- PASS: TestPlugin/TestStaticRoleLifecycle/ListRoles/method-LIST (0.00s) --- PASS: TestPlugin/TestStaticRoleLifecycle/ListRoles/method-GET (0.00s) --- PASS: TestPlugin/TestStaticRoleLifecycle/DeleteRole (0.00s) FAIL FAIL github.com/opentelekomcloud/vault-plugin-secrets-openstack/acceptance 12.646s FAIL make: *** [functional] Error 1

Unit tests:

/Users/artem/go/go1.18.2/bin/go test -json ./... === RUN TestBackend_sharedCloud === RUN TestBackend_sharedCloud/existing === RUN TestBackend_sharedCloud/non-existing --- PASS: TestBackend_sharedCloud (0.00s) --- PASS: TestBackend_sharedCloud/existing (0.00s) --- PASS: TestBackend_sharedCloud/non-existing (0.00s) === RUN TestSharedCloud_client === RUN TestSharedCloud_client/existing-client === RUN TestSharedCloud_client/new-client --- PASS: TestSharedCloud_client (0.00s) --- PASS: TestSharedCloud_client/existing-client (0.00s) --- PASS: TestSharedCloud_client/new-client (0.00s) === RUN TestCloudCreate === RUN TestCloudCreate/EmptyConfig === RUN TestCloudCreate/Create === RUN TestCloudCreate/Update === RUN TestCloudCreate/Read === RUN TestCloudCreate/Delete === RUN TestCloudCreate/List --- PASS: TestCloudCreate (0.00s) --- PASS: TestCloudCreate/EmptyConfig (0.00s) --- PASS: TestCloudCreate/Create (0.00s) --- PASS: TestCloudCreate/Update (0.00s) --- PASS: TestCloudCreate/Read (0.00s) --- PASS: TestCloudCreate/Delete (0.00s) --- PASS: TestCloudCreate/List (0.00s) === RUN TestCredentialsRead_ok === RUN TestCredentialsRead_ok/root_token === RUN TestCredentialsRead_ok/user_token === RUN TestCredentialsRead_ok/user_password === RUN TestCredentialsRead_ok/token_revoke === RUN TestCredentialsRead_ok/user_password_revoke --- PASS: TestCredentialsRead_ok (0.01s) --- PASS: TestCredentialsRead_ok/root_token (0.00s) --- PASS: TestCredentialsRead_ok/user_token (0.00s) --- PASS: TestCredentialsRead_ok/user_password (0.00s) --- PASS: TestCredentialsRead_ok/token_revoke (0.00s) --- PASS: TestCredentialsRead_ok/user_password_revoke (0.00s) === RUN TestCredentialsRead_error === RUN TestCredentialsRead_error/read-fail === RUN TestCredentialsRead_error/no-user-post === RUN TestCredentialsRead_error/no-users-token-post --- PASS: TestCredentialsRead_error (0.00s) --- PASS: TestCredentialsRead_error/read-fail (0.00s) --- PASS: TestCredentialsRead_error/no-user-post (0.00s) --- PASS: TestCredentialsRead_error/no-users-token-post (0.00s) === RUN TestCredentialsRevoke_error === RUN TestCredentialsRevoke_error/no-token-delete === RUN TestCredentialsRevoke_error/no-user-delete --- PASS: TestCredentialsRevoke_error (0.00s) --- PASS: TestCredentialsRevoke_error/no-token-delete (0.00s) --- PASS: TestCredentialsRevoke_error/no-user-delete (0.00s) === RUN TestInfoRead === PAUSE TestInfoRead === RUN TestRoleStoragePath --- PASS: TestRoleStoragePath (0.00s) === RUN TestRoleGet === PAUSE TestRoleGet === RUN TestRoleExistence === PAUSE TestRoleExistence === RUN TestRoleList === PAUSE TestRoleList === RUN TestRoleDelete === PAUSE TestRoleDelete === RUN TestRoleCreate === PAUSE TestRoleCreate === RUN TestRoleUpdate === PAUSE TestRoleUpdate === RUN TestRotateRootCredentials_ok --- PASS: TestRotateRootCredentials_ok (0.00s) === RUN TestRotateRootCredentials_error === PAUSE TestRotateRootCredentials_error === RUN TestStaticRoleStoragePath --- PASS: TestStaticRoleStoragePath (0.00s) === RUN TestStaticRoleGet === PAUSE TestStaticRoleGet === RUN TestStaticRoleExistence === PAUSE TestStaticRoleExistence === RUN TestStaticRoleList === PAUSE TestStaticRoleList === RUN TestStaticRoleDelete === PAUSE TestStaticRoleDelete === RUN TestStaticRoleCreate === PAUSE TestStaticRoleCreate === RUN TestStaticRoleUpdate === PAUSE TestStaticRoleUpdate === CONT TestInfoRead === CONT TestRotateRootCredentials_error === CONT TestRoleDelete === RUN TestRotateRootCredentials_error/read-fail === CONT TestRoleUpdate === RUN TestRoleDelete/existing === CONT TestRoleList === PAUSE TestRoleDelete/existing === CONT TestRoleExistence === CONT TestStaticRoleDelete === RUN TestRoleList/ok === RUN TestStaticRoleDelete/existing === CONT TestStaticRoleUpdate === PAUSE TestStaticRoleDelete/existing === RUN TestRoleDelete/not-existing === PAUSE TestRoleDelete/not-existing === RUN TestRoleExistence/existing === RUN TestStaticRoleUpdate/ok === CONT TestStaticRoleCreate === RUN TestRoleDelete/error === PAUSE TestRoleDelete/error === RUN TestRoleDelete/error-get === PAUSE TestRoleDelete/error-get === RUN TestStaticRoleDelete/not-existing === PAUSE TestRoleExistence/existing === RUN TestRoleUpdate/ok === RUN TestRoleExistence/not-existing --- PASS: TestInfoRead (0.00s) === PAUSE TestRoleExistence/not-existing === RUN TestRoleExistence/get-err === PAUSE TestRoleExistence/get-err === CONT TestStaticRoleExistence === RUN TestStaticRoleExistence/existing === PAUSE TestStaticRoleExistence/existing === CONT TestStaticRoleGet === RUN TestStaticRoleExistence/not-existing === PAUSE TestStaticRoleExistence/not-existing === RUN TestRotateRootCredentials_error/no-change === RUN TestStaticRoleGet/existing === PAUSE TestStaticRoleGet/existing === RUN TestStaticRoleGet/not-existing === RUN TestStaticRoleCreate/ok === PAUSE TestStaticRoleGet/not-existing === RUN TestStaticRoleGet/get-err === PAUSE TestStaticRoleGet/get-err === CONT TestRoleCreate === RUN TestRoleCreate/ok === PAUSE TestStaticRoleDelete/not-existing === RUN TestStaticRoleCreate/ok/admin === PAUSE TestStaticRoleCreate/ok/admin === RUN TestStaticRoleCreate/ok/token === PAUSE TestStaticRoleCreate/ok/token === RUN TestStaticRoleCreate/ok/password === PAUSE TestStaticRoleCreate/ok/password === RUN TestStaticRoleCreate/ok/rotation_duration === RUN TestStaticRoleExistence/get-err === PAUSE TestStaticRoleCreate/ok/rotation_duration === RUN TestStaticRoleCreate/ok/endpoint-override === PAUSE TestStaticRoleCreate/ok/endpoint-override === CONT TestRoleDelete/existing === PAUSE TestStaticRoleExistence/get-err === CONT TestStaticRoleList === CONT TestRoleDelete/error-get === CONT TestRoleGet === RUN TestStaticRoleList/ok === CONT TestRoleDelete/error === RUN TestRoleGet/existing === PAUSE TestRoleGet/existing === RUN TestRoleGet/not-existing === PAUSE TestRoleGet/not-existing === RUN TestRoleGet/get-err === PAUSE TestRoleGet/get-err === CONT TestRoleDelete/not-existing === RUN TestStaticRoleList/error === PAUSE TestStaticRoleList/error === RUN TestStaticRoleDelete/error === RUN TestStaticRoleList/filter === PAUSE TestStaticRoleDelete/error === PAUSE TestStaticRoleList/filter === RUN TestStaticRoleDelete/error-get === CONT TestRoleExistence/get-err === PAUSE TestStaticRoleDelete/error-get === CONT TestStaticRoleGet/existing === RUN TestStaticRoleUpdate/not-existing === CONT TestRoleExistence/existing === RUN TestStaticRoleList/filter-get-err === PAUSE TestStaticRoleList/filter-get-err === CONT TestRoleExistence/not-existing === CONT TestStaticRoleCreate/ok/endpoint-override === CONT TestStaticRoleGet/not-existing --- PASS: TestRoleDelete (0.00s) --- PASS: TestRoleDelete/error-get (0.00s) --- PASS: TestRoleDelete/existing (0.00s) --- PASS: TestRoleDelete/error (0.00s) --- PASS: TestRoleDelete/not-existing (0.00s) --- PASS: TestStaticRoleUpdate (0.00s) --- PASS: TestStaticRoleUpdate/ok (0.00s) --- PASS: TestStaticRoleUpdate/not-existing (0.00s) === CONT TestStaticRoleCreate/ok/token === CONT TestStaticRoleCreate/ok/password === RUN TestRoleList/error === CONT TestStaticRoleGet/get-err === PAUSE TestRoleList/error === RUN TestRoleList/filter === PAUSE TestRoleList/filter === RUN TestRoleList/filter-get-err === PAUSE TestRoleList/filter-get-err === CONT TestStaticRoleCreate/ok/rotation_duration === CONT TestStaticRoleExistence/existing === CONT TestStaticRoleExistence/not-existing === CONT TestStaticRoleExistence/get-err --- PASS: TestRoleExistence (0.00s) --- PASS: TestRoleExistence/get-err (0.00s) --- PASS: TestRoleExistence/not-existing (0.00s) --- PASS: TestRoleExistence/existing (0.00s) === RUN TestRoleCreate/ok/password === RUN TestRoleUpdate/not-existing === CONT TestRoleGet/get-err --- PASS: TestStaticRoleGet (0.00s) --- PASS: TestStaticRoleGet/existing (0.00s) --- PASS: TestStaticRoleGet/not-existing (0.00s) --- PASS: TestStaticRoleGet/get-err (0.00s) === CONT TestRoleGet/not-existing === CONT TestStaticRoleDelete/existing --- PASS: TestStaticRoleExistence (0.00s) --- PASS: TestStaticRoleExistence/existing (0.00s) --- PASS: TestStaticRoleExistence/not-existing (0.00s) --- PASS: TestStaticRoleExistence/get-err (0.00s) === CONT TestStaticRoleList/error === CONT TestStaticRoleDelete/error-get === CONT TestRoleGet/existing === PAUSE TestRoleCreate/ok/password === RUN TestRoleCreate/ok/ttl === CONT TestRoleList/error === CONT TestStaticRoleCreate/ok/admin === PAUSE TestRoleCreate/ok/ttl === RUN TestRoleCreate/ok/endpoint-override === PAUSE TestRoleCreate/ok/endpoint-override === RUN TestRoleCreate/ok/admin === PAUSE TestRoleCreate/ok/admin === RUN TestRoleCreate/ok/token === PAUSE TestRoleCreate/ok/token === CONT TestStaticRoleList/filter --- PASS: TestRoleGet (0.00s) --- PASS: TestRoleGet/get-err (0.00s) --- PASS: TestRoleGet/not-existing (0.00s) --- PASS: TestRoleGet/existing (0.00s) === CONT TestRoleCreate/ok/password === CONT TestRoleList/filter-get-err === RUN TestStaticRoleCreate/error --- PASS: TestRoleUpdate (0.00s) --- PASS: TestRoleUpdate/ok (0.00s) --- PASS: TestRoleUpdate/not-existing (0.00s) === CONT TestRoleCreate/ok/admin === RUN TestStaticRoleCreate/error/root-ttl === PAUSE TestStaticRoleCreate/error/root-ttl === RUN TestStaticRoleCreate/error/root-password === PAUSE TestStaticRoleCreate/error/root-password === CONT TestRoleCreate/ok/endpoint-override === CONT TestRoleList/filter === RUN TestStaticRoleCreate/error/without-cloud === CONT TestStaticRoleList/filter-get-err === PAUSE TestStaticRoleCreate/error/without-cloud === CONT TestStaticRoleCreate/error/root-ttl === CONT TestRoleCreate/ok/token === CONT TestStaticRoleCreate/error/root-password === CONT TestStaticRoleCreate/error/without-cloud === CONT TestStaticRoleDelete/not-existing --- PASS: TestRoleList (0.00s) --- PASS: TestRoleList/ok (0.00s) --- PASS: TestRoleList/error (0.00s) --- PASS: TestRoleList/filter-get-err (0.00s) --- PASS: TestRoleList/filter (0.00s) === CONT TestRoleCreate/ok/ttl --- PASS: TestStaticRoleList (0.00s) --- PASS: TestStaticRoleList/ok (0.00s) --- PASS: TestStaticRoleList/error (0.00s) --- PASS: TestStaticRoleList/filter (0.00s) --- PASS: TestStaticRoleList/filter-get-err (0.00s) === CONT TestStaticRoleDelete/error === RUN TestStaticRoleCreate/not-existing-cloud === RUN TestRoleCreate/error === PAUSE TestStaticRoleCreate/not-existing-cloud === RUN TestStaticRoleCreate/save-store-err === PAUSE TestStaticRoleCreate/save-store-err === CONT TestStaticRoleCreate/not-existing-cloud --- PASS: TestStaticRoleDelete (0.00s) --- PASS: TestStaticRoleDelete/error-get (0.00s) --- PASS: TestStaticRoleDelete/existing (0.00s) --- PASS: TestStaticRoleDelete/not-existing (0.00s) --- PASS: TestStaticRoleDelete/error (0.00s) === CONT TestStaticRoleCreate/save-store-err === RUN TestRoleCreate/error/root-password === PAUSE TestRoleCreate/error/root-password === RUN TestRoleCreate/error/root-user-groups === PAUSE TestRoleCreate/error/root-user-groups === RUN TestRoleCreate/error/root-user-roles === PAUSE TestRoleCreate/error/root-user-roles === RUN TestRoleCreate/error/without-cloud === PAUSE TestRoleCreate/error/without-cloud === RUN TestRoleCreate/error/root-ttl === PAUSE TestRoleCreate/error/root-ttl === CONT TestRoleCreate/error/root-password === CONT TestRoleCreate/error/without-cloud === CONT TestRoleCreate/error/root-ttl === CONT TestRoleCreate/error/root-user-roles === CONT TestRoleCreate/error/root-user-groups --- PASS: TestStaticRoleCreate (0.00s) --- PASS: TestStaticRoleCreate/ok (0.00s) --- PASS: TestStaticRoleCreate/ok/endpoint-override (0.00s) --- PASS: TestStaticRoleCreate/ok/token (0.00s) --- PASS: TestStaticRoleCreate/ok/password (0.00s) --- PASS: TestStaticRoleCreate/ok/rotation_duration (0.00s) --- PASS: TestStaticRoleCreate/ok/admin (0.00s) --- PASS: TestStaticRoleCreate/error (0.00s) --- PASS: TestStaticRoleCreate/error/root-ttl (0.00s) --- PASS: TestStaticRoleCreate/error/without-cloud (0.00s) --- PASS: TestStaticRoleCreate/error/root-password (0.00s) --- PASS: TestStaticRoleCreate/save-store-err (0.00s) --- PASS: TestStaticRoleCreate/not-existing-cloud (0.00s) === RUN TestRotateRootCredentials_error/no-post === RUN TestRoleCreate/not-existing-cloud === PAUSE TestRoleCreate/not-existing-cloud === RUN TestRoleCreate/save-store-err === PAUSE TestRoleCreate/save-store-err === CONT TestRoleCreate/not-existing-cloud === CONT TestRoleCreate/save-store-err --- PASS: TestRoleCreate (0.00s) --- PASS: TestRoleCreate/ok (0.00s) --- PASS: TestRoleCreate/ok/admin (0.00s) --- PASS: TestRoleCreate/ok/password (0.00s) --- PASS: TestRoleCreate/ok/endpoint-override (0.00s) --- PASS: TestRoleCreate/ok/token (0.00s) --- PASS: TestRoleCreate/ok/ttl (0.00s) --- PASS: TestRoleCreate/error (0.00s) --- PASS: TestRoleCreate/error/root-password (0.00s) --- PASS: TestRoleCreate/error/without-cloud (0.00s) --- PASS: TestRoleCreate/error/root-ttl (0.00s) --- PASS: TestRoleCreate/error/root-user-roles (0.00s) --- PASS: TestRoleCreate/error/root-user-groups (0.00s) --- PASS: TestRoleCreate/save-store-err (0.00s) --- PASS: TestRoleCreate/not-existing-cloud (0.00s) === RUN TestRotateRootCredentials_error/no-get --- PASS: TestRotateRootCredentials_error (0.01s) --- PASS: TestRotateRootCredentials_error/read-fail (0.00s) --- PASS: TestRotateRootCredentials_error/no-change (0.00s) --- PASS: TestRotateRootCredentials_error/no-post (0.00s) --- PASS: TestRotateRootCredentials_error/no-get (0.00s) PASS ok github.com/opentelekomcloud/vault-plugin-secrets-openstack/openstack (cached) ? github.com/opentelekomcloud/vault-plugin-secrets-openstack/openstack/fixtures [no test files]

Process finished with the exit code 0

outcatcher commented 2 years ago

Are acceptance tests still failing?

artem-lifshits commented 2 years ago

Are acceptance tests still failing?

Just a single info test - TestInfoRead. But it was failing for me even before I touched the vault :)

otc-zuul[bot] commented 2 years ago

Build succeeded. https://zuul.otc-service.com/t/eco/buildset/5835bd79044c4024a6808c1e7de4796c

:heavy_check_mark: build-sphinx-docs SUCCESS in 4m 26s :heavy_check_mark: otc-golangci-lint SUCCESS in 1m 54s :heavy_check_mark: golang-make-vet SUCCESS in 1m 42s :heavy_check_mark: golang-make-test SUCCESS in 1m 59s :heavy_check_mark: goreleaser-build SUCCESS in 4m 20s