-
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
UI: Decode database connection_url
#29114
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
3c34688
decode url in the serializer for oracle connection_url
hellobontempo 3c343a4
add serializer test
hellobontempo 3a5d97e
add test for oracle
hellobontempo aa7bade
add test back, remove decode-url helper
hellobontempo ed7df85
update comment and test
hellobontempo c5f9f58
link jiras VAULT-32830 VAULT-29785
hellobontempo 2746ea2
add changelog
hellobontempo e73ed65
add test
hellobontempo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
```release-note:bug | ||
ui: Decode database url to fix editing failures for an oracle connection | ||
``` |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
import { module, test } from 'qunit'; | ||
import { setupApplicationTest } from 'ember-qunit'; | ||
import { currentURL, settled, click, visit, fillIn, typeIn, waitFor } from '@ember/test-helpers'; | ||
import { setupMirage } from 'ember-cli-mirage/test-support'; | ||
import { create } from 'ember-cli-page-object'; | ||
import { selectChoose } from 'ember-power-select/test-support'; | ||
import { clickTrigger } from 'ember-power-select/test-support/helpers'; | ||
|
@@ -226,6 +227,7 @@ const connectionTests = [ | |
|
||
module('Acceptance | secrets/database/*', function (hooks) { | ||
setupApplicationTest(hooks); | ||
setupMirage(hooks); | ||
|
||
hooks.beforeEach(async function () { | ||
this.backend = `database-testing`; | ||
|
@@ -337,9 +339,11 @@ module('Acceptance | secrets/database/*', function (hooks) { | |
await visit('/vault/secrets'); | ||
}); | ||
} | ||
test('database connection create and edit: vault-plugin-database-oracle', async function (assert) { | ||
|
||
// keep oracle as separate test because it relies on an external plugin that isn't rolled into the vault binary | ||
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. great comment |
||
// https://github.com/hashicorp/vault-plugin-database-oracle | ||
test('database connection create: vault-plugin-database-oracle', async function (assert) { | ||
assert.expect(11); | ||
// keep oracle as separate test because it behaves differently than the others | ||
const testCase = { | ||
name: 'oracle-connection', | ||
plugin: 'vault-plugin-database-oracle', | ||
|
@@ -380,7 +384,52 @@ module('Acceptance | secrets/database/*', function (hooks) { | |
await connectionPage.connectionUrl(testCase.url); | ||
testCase.requiredFields(assert, testCase.plugin); | ||
// Cannot save without plugin mounted | ||
// TODO: add fake server response for fuller test coverage | ||
// Edit tested separately with mocked server response | ||
}); | ||
|
||
test('database connection edit: vault-plugin-database-oracle', async function (assert) { | ||
assert.expect(2); | ||
const connectionName = 'oracle-connection'; | ||
// mock API so we can test edit (without mounting external oracle plugin) | ||
this.server.get(`/${this.backend}/config/${connectionName}`, () => { | ||
return { | ||
request_id: 'f869f23e-15c0-389b-82ac-84035a2b6079', | ||
lease_id: '', | ||
renewable: false, | ||
lease_duration: 0, | ||
data: { | ||
allowed_roles: ['*'], | ||
connection_details: { | ||
backend: 'database', | ||
connection_url: '%7B%7Busername%7D%7D/%7B%7Bpassword%7D%7D@//localhost:1521/ORCLPDB1', | ||
max_connection_lifetime: '0s', | ||
max_idle_connections: 0, | ||
max_open_connections: 3, | ||
username: 'VAULTADMIN', | ||
}, | ||
password_policy: '', | ||
plugin_name: 'vault-plugin-database-oracle', | ||
plugin_version: '', | ||
root_credentials_rotate_statements: [], | ||
verify_connection: true, | ||
}, | ||
wrap_info: null, | ||
warnings: null, | ||
auth: null, | ||
mount_type: 'database', | ||
}; | ||
}); | ||
|
||
await visit(`/vault/secrets/${this.backend}/show/${connectionName}`); | ||
const decoded = '{{username}}/{{password}}@//localhost:1521/ORCLPDB1'; | ||
assert | ||
.dom('[data-test-row-value="Connection URL"]') | ||
.hasText(decoded, 'connection_url is decoded in display'); | ||
|
||
await connectionPage.edit(); | ||
assert | ||
.dom('[data-test-input="connection_url"]') | ||
.hasValue(decoded, 'connection_url is decoded when editing'); | ||
}); | ||
|
||
test('Can create and delete a connection', async function (assert) { | ||
|
@@ -504,17 +553,17 @@ module('Acceptance | secrets/database/*', function (hooks) { | |
await visit('/vault/secrets'); | ||
}); | ||
|
||
test('connection_url must be decoded', async function (assert) { | ||
test('connection_url is decoded', async function (assert) { | ||
const backend = this.backend; | ||
const connection = await newConnection( | ||
backend, | ||
'mongodb-database-plugin', | ||
'{{username}}/{{password}}@oracle-xe:1521/XEPDB1' | ||
'{{username}}/{{password}}@mongo:1521/XEPDB1' | ||
); | ||
await navToConnection(backend, connection); | ||
assert | ||
.dom('[data-test-row-value="Connection URL"]') | ||
.hasText('{{username}}/{{password}}@oracle-xe:1521/XEPDB1'); | ||
.hasText('{{username}}/{{password}}@mongo:1521/XEPDB1'); | ||
}); | ||
|
||
test('Role create form', async function (assert) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This was some cleanup, but i can remove if folks are worried about regressions. I searched globally for any use of
connection_details
orconnectionDetails
related to databases and didn't come across anything.