-
Notifications
You must be signed in to change notification settings - Fork 69
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
[WIP] Use rails credentials instead of secrets #928
base: master
Are you sure you want to change the base?
[WIP] Use rails credentials instead of secrets #928
Conversation
spec/spec_helper.rb
Outdated
:vmware_cloud_defaults => {:host => "vmwarecloudhost", :userid => "VMWARE_CLOUD_USERID", :password => "VMWARE_CLOUD_PASSWORD"}, | ||
:vmware_infra_defaults => {:hostname => "HOSTNAME"}, | ||
:vmware_tanzu_defaults => {:hostname => "vmware-tanzu-hostname", :userid => "VMWARE_TANZU_USERID", :password => "VMWARE_TANZU_PASSWORD"} | ||
}.freeze |
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.
@agrare I'm thinking this constant ☝️ would live in each plugin...
The two methods below could live in core spec/shared:
👇
VCR.configure do |config| | ||
# config.default_cassette_options = { :record => :all } |
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.
placeholder to verify cassette recording uses the correct values from local rails credentials and falls back to the defaults.
spec/spec_helper.rb
Outdated
TEST_CREDENTIALS_DEFAULTS = { | ||
:vmware_cloud_defaults => {:host => "vmwarecloudhost", :userid => "VMWARE_CLOUD_USERID", :password => "VMWARE_CLOUD_PASSWORD"}, | ||
:vmware_infra_defaults => {:hostname => "HOSTNAME"}, | ||
:vmware_tanzu_defaults => {:hostname => "vmware-tanzu-hostname", :userid => "VMWARE_TANZU_USERID", :password => "VMWARE_TANZU_PASSWORD"} |
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.
I'm open to make the constant have the DEFAULTS
name an simplify the keys to no longer have defaults in the name to avoid redundancy. Let me know your thoughts.
I'm thinking of a slightly different way to organize this, but I'm not 100% sure it will work, because I really don't understand the new Rails credentials thing (nor why we wouldn't keep it the way it was to some extent). Let's discuss over voice, then I can more properly write my thoughts here. |
We don't need to use Rails secrets or credentials here as the secrets we have are defaults for sanitizing any of our real secrets with fake ones so our tests can run anywhere from cassettes.
@Fryguy @agrare please see this PR along with the core PR: ManageIQ/manageiq#23292... throw 🍅 |
:hostname: vmware-tanzu-hostname | ||
:userid: VMWARE_TANZU_USERID | ||
:password: VMWARE_TANZU_PASSWORD | ||
|
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.
Minor, but there's a bonus newline here.
end | ||
|
||
config.define_cassette_placeholder(default_vcr_secret_by_key_path(:vmware_tanzu, :hostname)) { vcr_secret_by_key_path(:vmware_tanzu, :hostname) } |
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.
Not for this PR, but I'm wondering if we consolidate this pattern into a helper method...something like
config.define_cassette_placeholder(default_vcr_secret_by_key_path(:vmware_tanzu, :hostname)) { vcr_secret_by_key_path(:vmware_tanzu, :hostname) } | |
vcr_define_cassette_placeholder(config, :vmware_tanzu, :hostname) |
Depends on:
This is a simplified version of the changes in
ManageIQ/manageiq#23266
ManageIQ/guides#553
ManageIQ/manageiq-providers-autosde#253