MinIO support for Admin UI (#2248)

Add support for MinIO creation form and list
This commit is contained in:
Carlos Alcaide Corvo authored and GitHub committed 2024-04-16 14:17:23 -07:00
1 parent 98c16ad422
commit 0870a8f623
26 files changed
+1332 -597

No files matched your search

@@ -32,6 +32,10 @@ module('Acceptance | storage-buckets | create', function (hooks) {
const ACCESS_KEY_SELECTOR = '[name="access_key_id"]';
const SECRET_KEY_SELECTOR = '[name="secret_access_key"]';
const SCOPE_SELECTOR = '[name=scope]';
const CREDENTIAL_TYPE_GROUP_SELECTOR = '[name=credential_type]';
const MINIO_PLUGIN_TYPE_SELECTOR = '[value=minio]';
const ENDPOINT_URL_SELECTOR = '[name=endpoint_url]';
const ENDPOINT_URL_TEXT = 'http://www.hashicorp.com';
const instances = {
scopes: {
@@ -63,13 +67,13 @@ module('Acceptance | storage-buckets | create', function (hooks) {
authenticateSession({});
});
test('users can create a new storage bucket with global scope', async function (assert) {
test('users can create a new storage bucket aws plugin type with global scope', async function (assert) {
const storageBucketCount = getStorageBucketCount();
await visit(urls.storageBuckets);
await click(`[href="${urls.newStorageBucket}"]`);
await fillIn(NAME_FIELD_SELECTOR, NAME_FIELD_TEXT);
await click('[value="global"]');
await select(SCOPE_SELECTOR, 'global');
assert.dom(BUCKET_NAME_FIELD_SELECTOR).isNotDisabled();
assert.dom(BUCKET_PREFIX_FIELD_SELECTOR).isNotDisabled();
@@ -86,7 +90,7 @@ module('Acceptance | storage-buckets | create', function (hooks) {
assert.strictEqual(getStorageBucketCount(), storageBucketCount + 1);
});
test('users can create a new storage bucket with org scope', async function (assert) {
test('users can create a new storage bucket aws plugin type with org scope', async function (assert) {
const storageBucketCount = getStorageBucketCount();
await visit(urls.storageBuckets);
@@ -110,13 +114,17 @@ module('Acceptance | storage-buckets | create', function (hooks) {
assert.strictEqual(getStorageBucketCount(), storageBucketCount + 1);
});
test('users can create a new storage bucket with dynamic credentials', async function (assert) {
test('users can create a new storage bucket aws plugin type with dynamic credentials', async function (assert) {
const storageBucketCount = getStorageBucketCount();
await visit(urls.storageBuckets);
await click(`[href="${urls.newStorageBucket}"]`);
await fillIn(NAME_FIELD_SELECTOR, NAME_FIELD_TEXT);
assert.dom('.hds-form-radio-card').exists({ count: 2 });
// There are 2 credential types
assert
.dom(`${CREDENTIAL_TYPE_GROUP_SELECTOR} .hds-form-radio-card`)
.exists({ count: 2 });
await click(DYNAMIC_CREDENTIAL_SELECTOR);
await fillIn(ROLE_ARN_SELECTOR, 'test-arn-id');
@@ -132,13 +140,15 @@ module('Acceptance | storage-buckets | create', function (hooks) {
assert.strictEqual(getStorageBucketCount(), storageBucketCount + 1);
});
test('users can create a new storage bucket with static credentials', async function (assert) {
test('users can create a new storage bucket aws plugin type with static credentials', async function (assert) {
const storageBucketCount = getStorageBucketCount();
await visit(urls.storageBuckets);
await click(`[href="${urls.newStorageBucket}"]`);
await fillIn(NAME_FIELD_SELECTOR, NAME_FIELD_TEXT);
assert.dom('.hds-form-radio-card').exists({ count: 2 });
assert
.dom(`${CREDENTIAL_TYPE_GROUP_SELECTOR} .hds-form-radio-card`)
.exists({ count: 2 });
await click(STATIC_CREDENTIAL_SELECTOR);
await fillIn(ACCESS_KEY_SELECTOR, 'access_key_id');
@@ -156,6 +166,40 @@ module('Acceptance | storage-buckets | create', function (hooks) {
assert.strictEqual(getStorageBucketCount(), storageBucketCount + 1);
});
test('users can create a new storage bucket minio plugin type', async function (assert) {
const storageBucketCount = getStorageBucketCount();
// Navigate to new storage bucket
await visit(urls.storageBuckets);
await click(`[href="${urls.newStorageBucket}"]`);
// Fill the form
await fillIn(NAME_FIELD_SELECTOR, NAME_FIELD_TEXT);
await click(MINIO_PLUGIN_TYPE_SELECTOR);
await fillIn(ENDPOINT_URL_SELECTOR, ENDPOINT_URL_TEXT);
await fillIn(BUCKET_NAME_FIELD_SELECTOR, 'Test SB');
await fillIn(ACCESS_KEY_SELECTOR, 'access_key_id');
await fillIn(SECRET_KEY_SELECTOR, 'secret_access_key');
await click(SAVE_BTN_SELECTOR);
// Retrieve recently created SB
const storageBucket = await this.server.schema.storageBuckets.findBy({
name: NAME_FIELD_TEXT,
});
// Assertions
assert.strictEqual(storageBucket.name, NAME_FIELD_TEXT);
assert.strictEqual(
storageBucket.attributes.endpoint_url,
ENDPOINT_URL_TEXT,
);
assert.strictEqual(storageBucket.attributes.role_arn, null);
assert.strictEqual(storageBucket.plugin.name, 'minio');
assert.strictEqual(storageBucket.type, 'plugin');
assert.strictEqual(getStorageBucketCount(), storageBucketCount + 1);
});
test('user can cancel new storage bucket creation', async function (assert) {
const storageBucketCount = getStorageBucketCount();
await visit(urls.storageBuckets);
@@ -0,0 +1,17 @@
import { module, test } from 'qunit';
import { setupTest } from 'admin/tests/helpers';
module(
'Unit | Controller | scopes/scope/storage-buckets/index',
function (hooks) {
setupTest(hooks);
// TODO: Replace this with your real tests.
test('it exists', function (assert) {
let controller = this.owner.lookup(
'controller:scopes/scope/storage-buckets/index',
);
assert.ok(controller);
});
},
);
@@ -0,0 +1,17 @@
import { module, test } from 'qunit';
import { setupTest } from 'admin/tests/helpers';
module(
'Unit | Controller | scopes/scope/storage-buckets/new',
function (hooks) {
setupTest(hooks);
// TODO: Replace this with your real tests.
test('it exists', function (assert) {
let controller = this.owner.lookup(
'controller:scopes/scope/storage-buckets/new',
);
assert.ok(controller);
});
},
);
@@ -0,0 +1,17 @@
import { module, test } from 'qunit';
import { setupTest } from 'admin/tests/helpers';
module(
'Unit | Controller | scopes/scope/storage-buckets/storage-bucket/index',
function (hooks) {
setupTest(hooks);
// TODO: Replace this with your real tests.
test('it exists', function (assert) {
let controller = this.owner.lookup(
'controller:scopes/scope/storage-buckets/storage-bucket/index',
);
assert.ok(controller);
});
},
);
@@ -0,0 +1,17 @@
import { module, test } from 'qunit';
import { setupTest } from 'admin/tests/helpers';
module(
'Unit | Controller | scopes/scope/targets/target/enable-session-recording/create-storage-bucket',
function (hooks) {
setupTest(hooks);
// TODO: Replace this with your real tests.
test('it exists', function (assert) {
let controller = this.owner.lookup(
'controller:scopes/scope/targets/target/enable-session-recording/create-storage-bucket',
);
assert.ok(controller);
});
},
);