MinIO support for Admin UI (#2248)
Add support for MinIO creation form and list
This commit is contained in:
1 parent
98c16ad422
commit
0870a8f623
26 files changed
+1332
-597
No files matched your search
@@ -7,6 +7,7 @@ import { module, test } from 'qunit';
|
||||
import { setupTest } from 'ember-qunit';
|
||||
import {
|
||||
TYPE_STORAGE_BUCKET_PLUGIN_AWS_S3,
|
||||
TYPE_STORAGE_BUCKET_PLUGIN_MINIO,
|
||||
TYPE_STORAGE_BUCKET_PLUGIN,
|
||||
TYPE_CREDENTIAL_STATIC,
|
||||
TYPE_CREDENTIAL_DYNAMIC,
|
||||
@@ -15,15 +16,6 @@ import {
|
||||
module('Unit | Serializer | storage bucket', function (hooks) {
|
||||
setupTest(hooks);
|
||||
|
||||
test('it serializes records', function (assert) {
|
||||
let store = this.owner.lookup('service:store');
|
||||
let record = store.createRecord('storage-bucket', {});
|
||||
|
||||
let serializedRecord = record.serialize();
|
||||
|
||||
assert.ok(serializedRecord);
|
||||
});
|
||||
|
||||
test('it serializes a new static aws plugin as expected', async function (assert) {
|
||||
const store = this.owner.lookup('service:store');
|
||||
const record = store.createRecord('storage-bucket', {
|
||||
@@ -70,6 +62,47 @@ module('Unit | Serializer | storage bucket', function (hooks) {
|
||||
assert.deepEqual(record.serialize(), expectedResult);
|
||||
});
|
||||
|
||||
test('it serializes a new minio (static by default) plugin as expected', async function (assert) {
|
||||
const store = this.owner.lookup('service:store');
|
||||
const record = store.createRecord('storage-bucket', {
|
||||
compositeType: TYPE_STORAGE_BUCKET_PLUGIN_MINIO,
|
||||
credentialType: TYPE_CREDENTIAL_STATIC,
|
||||
name: 'minio',
|
||||
description: 'this has a minio plugin',
|
||||
bucket_name: 'bucketname',
|
||||
bucket_prefix: 'bucketprefix',
|
||||
worker_filter: 'workerfilter',
|
||||
endpoint_url: 'http://hashicorp.com',
|
||||
region: 'eu-west-1',
|
||||
access_key_id: 'foobars',
|
||||
secret_access_key: 'testing',
|
||||
disable_credential_rotation: true,
|
||||
});
|
||||
const expectedResult = {
|
||||
name: 'minio',
|
||||
description: 'this has a minio plugin',
|
||||
type: TYPE_STORAGE_BUCKET_PLUGIN,
|
||||
bucket_name: 'bucketname',
|
||||
bucket_prefix: 'bucketprefix',
|
||||
worker_filter: 'workerfilter',
|
||||
attributes: {
|
||||
region: 'eu-west-1',
|
||||
disable_credential_rotation: true,
|
||||
endpoint_url: 'http://hashicorp.com',
|
||||
role_arn: null,
|
||||
role_external_id: null,
|
||||
role_session_name: null,
|
||||
role_tags: null,
|
||||
secrets_hmac: null,
|
||||
},
|
||||
secrets: {
|
||||
access_key_id: 'foobars',
|
||||
secret_access_key: 'testing',
|
||||
},
|
||||
};
|
||||
assert.deepEqual(record.serialize(), expectedResult);
|
||||
});
|
||||
|
||||
test('it serializes a new aws plugin with dynamic credentials as expected', async function (assert) {
|
||||
const store = this.owner.lookup('service:store');
|
||||
const record = store.createRecord('storage-bucket', {
|
||||
@@ -126,6 +159,7 @@ module('Unit | Serializer | storage bucket', function (hooks) {
|
||||
bucket_name: 'bucketname',
|
||||
bucket_prefix: 'bucketprefix',
|
||||
worker_filter: 'workerfilter',
|
||||
plugin: { name: 'aws' },
|
||||
region: 'eu-west-1',
|
||||
access_key_id: 'foobars',
|
||||
secret_access_key: 'testing',
|
||||
@@ -183,6 +217,7 @@ module('Unit | Serializer | storage bucket', function (hooks) {
|
||||
bucket_name: 'bucketname',
|
||||
bucket_prefix: 'bucketprefix',
|
||||
worker_filter: 'workerfilter',
|
||||
plugin: { name: 'aws' },
|
||||
region: 'eu-west-1',
|
||||
disable_credential_rotation: true,
|
||||
access_key_id: 'test',
|
||||
@@ -222,6 +257,61 @@ module('Unit | Serializer | storage bucket', function (hooks) {
|
||||
assert.deepEqual(serializedRecord, expectedResult);
|
||||
});
|
||||
|
||||
test('it serializes when updating a MinIO (static credential by default) storage bucket correctly', async function (assert) {
|
||||
const store = this.owner.lookup('service:store');
|
||||
const serializer = store.serializerFor('storage-bucket');
|
||||
store.push({
|
||||
data: {
|
||||
id: '3',
|
||||
type: 'storage-bucket',
|
||||
attributes: {
|
||||
type: TYPE_STORAGE_BUCKET_PLUGIN,
|
||||
plugin: { name: 'minio' },
|
||||
name: 'minio',
|
||||
description: 'this has a minio plugin',
|
||||
bucket_name: 'bucketname',
|
||||
bucket_prefix: 'bucketprefix',
|
||||
worker_filter: 'workerfilter',
|
||||
endpoint_url: 'http://hashicorp.com',
|
||||
region: 'eu-west-1',
|
||||
disable_credential_rotation: true,
|
||||
access_key_id: 'test',
|
||||
secret_access_key: 'test',
|
||||
version: 1,
|
||||
},
|
||||
},
|
||||
});
|
||||
const record = store.peekRecord('storage-bucket', '3');
|
||||
record.description = 'This is new description';
|
||||
record.name = 'This is the new name';
|
||||
record.endpoint_url = 'http://developer.hashicorp.com';
|
||||
const snapshot = record._createSnapshot();
|
||||
const serializedRecord = serializer.serialize(snapshot);
|
||||
|
||||
const expectedResult = {
|
||||
name: 'This is the new name',
|
||||
description: 'This is new description',
|
||||
type: TYPE_STORAGE_BUCKET_PLUGIN,
|
||||
worker_filter: 'workerfilter',
|
||||
attributes: {
|
||||
region: 'eu-west-1',
|
||||
disable_credential_rotation: true,
|
||||
endpoint_url: 'http://developer.hashicorp.com',
|
||||
role_arn: null,
|
||||
role_external_id: null,
|
||||
role_session_name: null,
|
||||
role_tags: null,
|
||||
secrets_hmac: null,
|
||||
},
|
||||
secrets: {
|
||||
access_key_id: 'test',
|
||||
secret_access_key: 'test',
|
||||
},
|
||||
version: 1,
|
||||
};
|
||||
assert.deepEqual(serializedRecord, expectedResult);
|
||||
});
|
||||
|
||||
test('it normalizes correctly', function (assert) {
|
||||
const store = this.owner.lookup('service:store');
|
||||
const serializer = store.serializerFor('storage-bucket');
|
||||
|
||||
Reference in new issue
Block a user