Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to Database v5 interface #10

Merged
merged 5 commits into from
Oct 5, 2020

Conversation

Valarissa
Copy link
Contributor

@Valarissa Valarissa commented Sep 30, 2020

Overview

Converts plugin to use the Database v5 interface introduced in hashicorp/vault#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

Copy link
Contributor

@pcman312 pcman312 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall. Just a couple of nits, a question, and one update since hashicorp/vault#10050 was merged

@Valarissa Valarissa requested a review from pcman312 October 3, 2020 00:03
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.

2 participants