-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Prep work for creating one WIF configuration component #29345
Conversation
CI Results: |
@@ -45,23 +45,33 @@ export default class AwsRootConfig extends Model { | |||
iamEndpoint; | |||
@attr('string', { label: 'STS endpoint' }) stsEndpoint; | |||
@attr('number', { | |||
label: 'Maximum retries', |
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.
The api name for this is "Max retries". I'm going to opt out of overriding this because it makes it complicated for testing.
@@ -45,23 +45,33 @@ export default class AwsRootConfig extends Model { | |||
iamEndpoint; | |||
@attr('string', { label: 'STS endpoint' }) stsEndpoint; | |||
@attr('number', { | |||
label: 'Maximum retries', | |||
subText: 'Number of max retries the client should use for recoverable errors. Default is -1.', | |||
}) | |||
maxRetries; | |||
|
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.
no functional changes, just restructuring to match azure and gcp models—see here.
@@ -38,16 +38,15 @@ export default class SshCaConfig extends Model { | |||
@attr('string') backend; // dynamic path of secret -- set on response from value passed to queryRecord | |||
@attr('string', { sensitive: true }) privateKey; // obfuscated, never returned by API | |||
@attr('string') publicKey; |
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.
no functional changes, just restructuring to match azure and gcp models—see here.
@@ -219,7 +219,6 @@ module('Acceptance | aws | configuration', function (hooks) { | |||
}); | |||
|
|||
test('it shows AWS mount configuration details', async function (assert) { | |||
assert.expect(12); |
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.
assert.expect unnecessary because we'll get hit if one of the keys fails.
@@ -231,6 +230,7 @@ module('Acceptance | aws | configuration', function (hooks) { | |||
createConfig(this.store, path, type); // create the aws root config in the store | |||
await click(SES.configTab); | |||
for (const key of expectedConfigKeys(type)) { |
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.
You'll see a couple of these exceptions added to these loops. This is because of a clean up work done on the secret-engine-helper.
In that helper, I changed the method expectedConfigKeys
to create generic arrays of expected values. Before I had two arrays for each engine, one for details and one for create—I opted to remove the two arrays and just make one for each engine to clarify within the tests, as I do here, what key we should not see in this iteration because the value is not returned from the API.
@@ -368,7 +368,7 @@ module('Acceptance | aws | configuration', function (hooks) { | |||
.doesNotExist('Access type section does not render for a community user'); | |||
// check all the form fields are present | |||
await click(GENERAL.toggleGroup('Root config options')); | |||
for (const key of expectedConfigKeys('aws-root-create')) { |
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.
the value passed into expectedConfigKeys
is changed here because of the above mentioned changed: I cleaned up this method to create generic arrays of keys that could come in camelized or not camelized.
true
as a second param indicates "camelized"
@@ -68,6 +68,8 @@ module('Acceptance | GCP | configuration', function (hooks) { | |||
service_account_email: 'service-email', | |||
identity_token_audience: 'audience', | |||
identity_token_ttl: 720000, |
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 did not originally tests these values on edit, but I am now.
await fillIn(GENERAL.ttl.input('Identity token TTL'), '7200'); | ||
} | ||
}; | ||
|
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.
Everything above this line is just re-organization, no changes. Below is the clean up of the expectedConfigKeys
using my new helper method and making the arrays more generic.
@@ -32,8 +32,15 @@ export default class AwsLeaseConfig extends Model { | |||
}) | |||
lease; | |||
|
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.
no functional changes, just restructuring to match azure and gcp models—see here.
@@ -20,6 +21,32 @@ export const createSecretsEngine = (store, type, path) => { | |||
}); | |||
return store.peekRecord('secret-engine', path); | |||
}; |
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.
All changes until the next comment are just moving methods around to make it easier to read
Build Results: |
@@ -231,6 +230,7 @@ module('Acceptance | aws | configuration', function (hooks) { | |||
createConfig(this.store, path, type); // create the aws root config in the store | |||
await click(SES.configTab); | |||
for (const key of expectedConfigKeys(type)) { | |||
if (key === 'Secret key') return; // secret-key is not returned by the API |
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 think return
will stop overall execution of the function.
Maybe continue
?
if (key === 'Secret key') return; // secret-key is not returned by the API | |
if (key === 'Secret key') continue; // secret-key is not returned by the API |
@@ -94,6 +94,7 @@ module('Acceptance | Azure | configuration', function (hooks) { | |||
}); | |||
await enablePage.enable(this.type, path); | |||
for (const key of expectedConfigKeys('azure')) { | |||
if (key === 'Client secret') return; // client-secret is not returned by the API |
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.
if (key === 'Client secret') return; // client-secret is not returned by the API | |
if (key === 'Client secret') continue; // client-secret is not returned by the API |
@@ -102,6 +104,7 @@ module('Acceptance | GCP | configuration', function (hooks) { | |||
}); | |||
await enablePage.enable(this.type, path); | |||
for (const key of expectedConfigKeys(this.type)) { | |||
if (key === 'Credentials') return; // not returned by the API |
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.
if (key === 'Credentials') return; // not returned by the API | |
if (key === 'Credentials') continue; // not returned by the API |
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.
Looks good to me!
* initial things without helper changes * adjust test for clean up of secret-engine-helper * remove added line thats better in next pr * remove extra check * 🧹 * replace return with continue within loops
Description
Pulling out some changes from a larger PR #29323. These changes are more clean up 🧹 related and distract a little from the core changes to that pr.
Specifically:
string-array-to-camel
I was able to greatly simplify the methodexpectedConfigKeys
which I use heavily in testing WIF engines. Before, this method was handling all sorts of options ex:expectedConfigKeys("aws-root-create")
or ``expectedConfigKeys("aws-root-create-wif"). To simplify this method and clarify the potential keys, I pulled all the key options out. Now each engine has three options: generic, account or wif. And these key selectors change depending on if I'm viewing details or create views, so I use my
stringArrayToCamel()` helper to help here.No user facing changes.