hashicorp / vault-plugin-database-couchbase

Mozilla Public License 2.0
6 stars 5 forks source link

Migrate to Database v5 interface #10

Closed Valarissa closed 3 years ago

Valarissa commented 3 years ago

Overview

Converts plugin to use the Database v5 interface introduced in https://github.com/hashicorp/vault/pull/9641

Modified one test to fail with no statements provided, previously, defaults were set to allow a user creation with no explicit statements/roles.

Design of Change

Converted each of the functions over to their equivalent in the new interface. Init -> Initialize CreateUser -> NewUser RenewUser, SetCredentials, & RotateRootCredentials -> UpdateUser RevokeUser -> DeleteUser

Test Output

Test Output ``` /usr/local/go/bin/go tool test2json -t /private/var/folders/4v/k2rn39v578d238ttqpwdkkkh0000gp/T/___couchbase_test_go -test.v -test.run ^\QTestDriver\E$ === RUN TestDriver couchbase_test.go:98: Waiting for the database to start... couchbase_test.go:98: Waiting for the database to start... couchbase_test.go:98: Waiting for the database to start... couchbase_test.go:98: Waiting for the database to start... couchbase_test.go:98: Waiting for the database to start... couchbase_test.go:98: Waiting for the database to start... === CONT TestDriver couchbase_test.go:165: Waiting for the bucket to be installed. --- PASS: TestDriver (41.01s) === RUN TestDriver/Version couchbase_test.go:203: Couchbase pre 6.5.0 is false --- PASS: TestDriver/Version (0.01s) === RUN TestDriver/Init couchbase_test.go:230: Testing TLS Init() --- PASS: TestDriver/Init (0.01s) === RUN TestDriver/Init#01 couchbase_test.go:259: Testing plain text Init() --- PASS: TestDriver/Init#01 (0.00s) === RUN TestDriver/Init#02 couchbase_test.go:277: Testing TLS Pre 6.5 Init() --- PASS: TestDriver/Init#02 (5.58s) === RUN TestDriver/Init#03 couchbase_test.go:304: Testing Pre 6.5 Init() --- PASS: TestDriver/Init#03 (0.00s) === RUN TestDriver/Create/Revoke couchbase_test.go:322: Testing CreateUser() couchbase_test.go:381: Testing checkCredsExist() couchbase_test.go:417: Testing RevokeUser() --- PASS: TestDriver/Create/Revoke (3.07s) === RUN TestDriver/Create/Revoke#01 couchbase_test.go:457: Testing CreateUser_DefaultRole() --- PASS: TestDriver/Create/Revoke#01 (1.03s) === RUN TestDriver/Create/Revoke#02 couchbase_test.go:510: Testing CreateUser_plusRole() couchbase_test.go:381: Testing checkCredsExist() couchbase_test.go:417: Testing RevokeUser() --- PASS: TestDriver/Create/Revoke#02 (4.13s) === RUN TestDriver/Create/Revoke#03 couchbase_test.go:578: Testing CreateUser_groupOnly() couchbase_test.go:381: Testing checkCredsExist() couchbase_test.go:417: Testing RevokeUser() --- PASS: TestDriver/Create/Revoke#03 (4.14s) === RUN TestDriver/Create/Revoke#04 couchbase_test.go:644: Testing CreateUser_roleAndGroup() couchbase_test.go:381: Testing checkCredsExist() couchbase_test.go:417: Testing RevokeUser() --- PASS: TestDriver/Create/Revoke#04 (4.17s) === RUN TestDriver/Rotate couchbase_test.go:706: Testing RotateRootCredentials() couchbase_test.go:381: Testing checkCredsExist() couchbase_test.go:757: Testing SetCredentials() couchbase_test.go:381: Testing checkCredsExist() --- PASS: TestDriver/Rotate (6.69s) === RUN TestDriver/Creds couchbase_test.go:757: Testing SetCredentials() couchbase_test.go:381: Testing checkCredsExist() --- PASS: TestDriver/Creds (4.05s) === RUN TestDriver/Secret couchbase_test.go:827: Testing couchbaseDBConnectionProducer.secretValues() --- PASS: TestDriver/Secret (0.00s) === RUN TestDriver/TimeoutCalc couchbase_test.go:841: Testing computeTimeout --- PASS: TestDriver/TimeoutCalc (0.00s) PASS Process finished with exit code 0 ```

Contributor Checklist