-
Notifications
You must be signed in to change notification settings - Fork 7
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
Improve Terraform Provider integration testing #1329
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,7 +44,7 @@ func (d *cacheDialer) Dial(ctx context.Context, ctl *dbmodel.Controller, mt name | |
return d.dialer.Dial(ctx, ctl, mt, requiredPermissions) | ||
} | ||
rc := d.sfg.DoChan(ctl.Name, func() (interface{}, error) { | ||
return d.dial(ctx, ctl) | ||
return d.dial(ctx, ctl, requiredPermissions) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How did this work before without the permissions? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are default permissions set in the dialer so that probably resolves most issues because we don't add extra permissions in many places, and I believe the cache dialer is not used unless actually running JIMM? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think I need to look over the default permissions, never really fully understood the permission map and what goes where... But oki thank you! |
||
}) | ||
select { | ||
case r := <-rc: | ||
|
@@ -57,7 +57,7 @@ func (d *cacheDialer) Dial(ctx context.Context, ctl *dbmodel.Controller, mt name | |
} | ||
} | ||
|
||
func (d *cacheDialer) dial(ctx context.Context, ctl *dbmodel.Controller) (interface{}, error) { | ||
func (d *cacheDialer) dial(ctx context.Context, ctl *dbmodel.Controller, requiredPermissions map[string]string) (interface{}, error) { | ||
d.mu.Lock() | ||
capi, ok := d.conns[ctl.Name] | ||
if ok { | ||
|
@@ -73,7 +73,7 @@ func (d *cacheDialer) dial(ctx context.Context, ctl *dbmodel.Controller) (interf | |
d.mu.Unlock() | ||
|
||
// We don't have a working connection to the controller, so dial one. | ||
api, err := d.dialer.Dial(ctx, ctl, names.ModelTag{}, nil) | ||
api, err := d.dialer.Dial(ctx, ctl, names.ModelTag{}, requiredPermissions) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/bash | ||
|
||
# This script is used to setup a service account by adding a set of cloud-credentials. | ||
# Default values below assume a lxd controller is added to JIMM. | ||
|
||
set -eux | ||
|
||
SERVICE_ACCOUNT_ID="${SERVICE_ACCOUNT_ID:-test-client-id}" | ||
CLOUD="${CLOUD:-localhost}" | ||
CREDENTIAL_NAME="${CREDENTIAL_NAME:-localhost}" | ||
|
||
juju add-service-account "$SERVICE_ACCOUNT_ID" | ||
juju update-service-account-credential "$SERVICE_ACCOUNT_ID" "$CLOUD" "$CREDENTIAL_NAME" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To make local dev less tedious, you don't need to repeatedly login.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah oki I'm with you