diff --git a/ui/packages/consul-ui/.docfy-config.js b/ui/packages/consul-ui/.docfy-config.js index fe52be47f..d55ba88b9 100644 --- a/ui/packages/consul-ui/.docfy-config.js +++ b/ui/packages/consul-ui/.docfy-config.js @@ -64,6 +64,12 @@ module.exports = { urlSchema: 'auto', urlPrefix: 'docs/styles', }, + { + root: path.resolve(__dirname, 'app/services/repository'), + pattern: '**/*.mdx', + urlSchema: 'auto', + urlPrefix: 'docs/repositories', + }, { root: path.resolve(__dirname, 'app/modifiers'), pattern: '**/*.mdx', diff --git a/ui/packages/consul-ui/app/adapters/dc.js b/ui/packages/consul-ui/app/adapters/dc.js deleted file mode 100644 index 4e265981d..000000000 --- a/ui/packages/consul-ui/app/adapters/dc.js +++ /dev/null @@ -1,9 +0,0 @@ -import Adapter from './application'; - -export default class DcAdapter extends Adapter { - requestForQuery(request) { - return request` - GET /v1/catalog/datacenters - `; - } -} diff --git a/ui/packages/consul-ui/app/decorators/data-source.js b/ui/packages/consul-ui/app/decorators/data-source.js index 39626f86d..a0b3bf632 100644 --- a/ui/packages/consul-ui/app/decorators/data-source.js +++ b/ui/packages/consul-ui/app/decorators/data-source.js @@ -7,10 +7,10 @@ export default path => (target, propertyKey, desc) => { runInDebug(() => { routes[path] = { cls: target, method: propertyKey }; }); - router.on(path, function(params, owner) { + router.on(path, function(params, owner, request) { const container = owner.lookup('service:container'); const instance = container.get(target); - return configuration => desc.value.apply(instance, [params, configuration]); + return configuration => desc.value.apply(instance, [params, configuration, request]); }); return desc; }; diff --git a/ui/packages/consul-ui/app/helpers/json-stringify.js b/ui/packages/consul-ui/app/helpers/json-stringify.js new file mode 100644 index 000000000..2eaedcfe8 --- /dev/null +++ b/ui/packages/consul-ui/app/helpers/json-stringify.js @@ -0,0 +1,9 @@ +import { helper } from '@ember/component/helper'; + +export default helper(function(args, hash) { + try { + return JSON.stringify(...args); + } catch(e) { + return args[0].map(item => JSON.stringify(item, args[1], args[2])); + } +}); diff --git a/ui/packages/consul-ui/app/models/dc.js b/ui/packages/consul-ui/app/models/dc.js index 9f9f89289..da0e06551 100644 --- a/ui/packages/consul-ui/app/models/dc.js +++ b/ui/packages/consul-ui/app/models/dc.js @@ -5,8 +5,16 @@ export const FOREIGN_KEY = 'Datacenter'; export const SLUG_KEY = 'Name'; export default class Datacenter extends Model { - @attr('string') uid; + @attr('string') uri; @attr('string') Name; + // autopilot/state + @attr('boolean') Healthy; + @attr('number') FailureTolerance; + @attr('number') OptimisticFailureTolerance; + @attr('string') Leader; + @attr() Voters; // [] + @attr() Servers; // [] the API uses {} but we reshape that on the frontend + // @attr('boolean') Local; @attr('boolean') Primary; @attr('string') DefaultACLPolicy; diff --git a/ui/packages/consul-ui/app/models/license.js b/ui/packages/consul-ui/app/models/license.js new file mode 100644 index 000000000..4873942ee --- /dev/null +++ b/ui/packages/consul-ui/app/models/license.js @@ -0,0 +1,18 @@ +import Model, { attr } from '@ember-data/model'; + +export const PRIMARY_KEY = 'uri'; + +export default class License extends Model { + @attr('string') uri; + @attr('boolean') Valid; + + @attr('number') SyncTime; + @attr() meta; // {} + + @attr('string') Datacenter; + @attr('string') Namespace; + @attr('string') Partition; + + @attr() License; // {} + // @attr() Warnings; // [] +} diff --git a/ui/packages/consul-ui/app/serializers/dc.js b/ui/packages/consul-ui/app/serializers/dc.js deleted file mode 100644 index fedffaee0..000000000 --- a/ui/packages/consul-ui/app/serializers/dc.js +++ /dev/null @@ -1,42 +0,0 @@ -import Serializer from './application'; -import { inject as service } from '@ember/service'; -import { PRIMARY_KEY, SLUG_KEY } from 'consul-ui/models/dc'; - -import { - HEADERS_SYMBOL, - HEADERS_DEFAULT_ACL_POLICY as DEFAULT_ACL_POLICY, -} from 'consul-ui/utils/http/consul'; -export default class DcSerializer extends Serializer { - @service('env') env; - - primaryKey = PRIMARY_KEY; - slugKey = SLUG_KEY; - - // datacenters come in as an array of plain strings. Convert to objects - // instead and collect all the other datacenter info from other places and - // add it to each datacenter object - respondForQuery(respond, query) { - return super.respondForQuery( - cb => respond((headers, body) => { - body = body.map(item => ({ - Datacenter: '', - [this.slugKey]: item, - })); - body = cb(headers, body); - headers = body[HEADERS_SYMBOL]; - - const Local = this.env.var('CONSUL_DATACENTER_LOCAL'); - const Primary = this.env.var('CONSUL_DATACENTER_PRIMARY'); - const DefaultACLPolicy = headers[DEFAULT_ACL_POLICY.toLowerCase()]; - - return body.map(item => ({ - ...item, - Local: item.Name === Local, - Primary: item.Name === Primary, - DefaultACLPolicy: DefaultACLPolicy, - })); - }), - query - ); - } -} diff --git a/ui/packages/consul-ui/app/services/client/http.js b/ui/packages/consul-ui/app/services/client/http.js index adb01dd0b..6d3659c22 100644 --- a/ui/packages/consul-ui/app/services/client/http.js +++ b/ui/packages/consul-ui/app/services/client/http.js @@ -83,11 +83,31 @@ export default class HttpService extends Service { @service('client/connections') connections; @service('client/transports/xhr') transport; @service('settings') settings; + @service('encoder') encoder; + @service('store') store; init() { super.init(...arguments); this._listeners = this.dom.listeners(); this.parseURL = createURL(encodeURIComponent, obj => QueryParams.stringify(this.sanitize(obj))); + const uriTag = this.encoder.uriTag(); + this.cache = (data, id) => { + // interpolate the URI + data.uri = id(uriTag); + // save the time we received it for cache management purposes + data.SyncTime = new Date().getTime(); + // save the data to the cache + return this.store.push( + { + data: { + id: data.uri, + // the model is encoded as the protocol in the URI + type: new URL(data.uri).protocol.slice(0, -1), + attributes: data + } + } + ); + } } sanitize(obj) { @@ -197,9 +217,9 @@ export default class HttpService extends Service { }); }); } - request(cb) { const client = this; + const cache = this.cache; return cb(function(strs, ...values) { const params = client.requestParams(...arguments); return client.settings.findBySlug('token').then(token => { @@ -236,7 +256,28 @@ export default class HttpService extends Service { [CONSUL_PARTITION]: params.data.partition || token.Partition || 'default', }; const respond = function(cb) { - return cb(headers, e.data.response); + let res = cb(headers, e.data.response, cache); + const meta = res.meta || {}; + if(meta.version === 2) { + if(Array.isArray(res.body)) { + res = new Proxy( + res.body, + { + get: (target, prop) => { + switch(prop) { + case 'meta': + return meta; + } + return target[prop]; + } + } + ); + } else { + res = res.body; + res.meta = meta; + } + } + return res; }; next(() => resolve(respond)); }, diff --git a/ui/packages/consul-ui/app/services/data-source/protocols/http.js b/ui/packages/consul-ui/app/services/data-source/protocols/http.js index 3817cbc25..2e47db97a 100644 --- a/ui/packages/consul-ui/app/services/data-source/protocols/http.js +++ b/ui/packages/consul-ui/app/services/data-source/protocols/http.js @@ -3,11 +3,17 @@ import { getOwner } from '@ember/application'; import { match } from 'consul-ui/decorators/data-source'; export default class HttpService extends Service { + @service('client/http') client; @service('data-source/protocols/http/blocking') type; source(src, configuration) { const route = match(src); - const find = route.cb(route.params, getOwner(this)); + let find; + this.client.request( + request => { + find = route.cb(route.params, getOwner(this), request); + } + ); return this.type.source(find, configuration); } } diff --git a/ui/packages/consul-ui/app/services/repository/dc.js b/ui/packages/consul-ui/app/services/repository/dc.js index 9de4e4fa5..517c932ba 100644 --- a/ui/packages/consul-ui/app/services/repository/dc.js +++ b/ui/packages/consul-ui/app/services/repository/dc.js @@ -1,20 +1,180 @@ import Error from '@ember/error'; +import { inject as service } from '@ember/service'; import RepositoryService from 'consul-ui/services/repository'; import dataSource from 'consul-ui/decorators/data-source'; +import { + HEADERS_DEFAULT_ACL_POLICY as DEFAULT_ACL_POLICY, +} from 'consul-ui/utils/http/consul'; + + +const SECONDS = 1000; +const MODEL_NAME = 'dc'; + +const zero = { + Total: 0, + Passing: 0, + Warning: 0, + Critical: 0 +}; +const aggregate = (prev, body, type) => { + + return body[type].reduce((prev, item) => { + + // for each Partitions, Namespaces + ['Partition', 'Namespace'].forEach(bucket => { + + // lazily initialize + let obj = prev[bucket][item[bucket]]; + if(typeof obj === 'undefined') { + obj = prev[bucket][item[bucket]] = { + Name: item[bucket], + }; + } + if(typeof obj[type] === 'undefined') { + obj[type] = { + ...zero + }; + } + // + + // accumulate + obj[type].Total += item.Total; + obj[type].Passing += item.Passing; + obj[type].Warning += item.Warning; + obj[type].Critical += item.Critical; + + }); + + // also aggregate the Datacenter, without doubling up + // for Partitions/Namespaces + prev.Datacenter[type].Total += item.Total; + prev.Datacenter[type].Passing += item.Passing; + prev.Datacenter[type].Warning += item.Warning; + prev.Datacenter[type].Critical += item.Critical; + return prev; + }, prev); +} + -const modelName = 'dc'; export default class DcService extends RepositoryService { + @service('env') env; + getModelName() { - return modelName; + return MODEL_NAME; } @dataSource('/:partition/:ns/:dc/datacenters') - async findAll() { - return super.findAll(...arguments); + async fetchAll({partition, ns, dc}, { uri }, request) { + const Local = this.env.var('CONSUL_DATACENTER_LOCAL'); + const Primary = this.env.var('CONSUL_DATACENTER_PRIMARY'); + return (await request` + GET /v1/catalog/datacenters + X-Request-ID: ${uri} + `)( + (headers, body, cache) => { + // TODO: Not sure nowadays whether we need to keep lowercasing everything + // I vaguely remember when I last looked it was not needed for browsers anymore + // but I also vaguely remember something about Pretender lowercasing things still + // so if we can work around Pretender I think we can remove all the header lowercasing + // For the moment we lowercase here so as to not effect the ember-data-flavoured-v1 fork + const entry = Object.entries(headers) + .find(([key, value]) => key.toLowerCase() === DEFAULT_ACL_POLICY.toLowerCase()); + // + const DefaultACLPolicy = entry[1] || 'allow'; + return { + meta: { + version: 2, + uri: uri, + }, + body: body.map(dc => { + return cache( + { + Name: dc, + Datacenter: '', + Local: dc === Local, + Primary: dc === Primary, + DefaultACLPolicy: DefaultACLPolicy, + }, + uri => uri`${MODEL_NAME}:///${''}/${''}/${dc}/datacenter` + ); + }) + }; + }); } - @dataSource('/:partition/:ns/:dc/datacenter/:name') - async findBySlug(params) { + @dataSource('/:partition/:ns/:dc/datacenter') + async fetch({partition, ns, dc}, { uri }, request) { + return (await request` + GET /v1/operator/autopilot/state?${{ dc }} + X-Request-ID: ${uri} + `)( + (headers, body, cache) => ({ + meta: { + version: 2, + uri: uri, + interval: 30 * SECONDS + }, + body: cache( + { + ...body, + // turn servers into an array instead of a map/object + Servers: Object.values(body.Servers) + }, + uri => uri`${MODEL_NAME}:///${''}/${''}/${dc}/datacenter` + ) + }) + ); + } + + @dataSource('/:partition/:ns/:dc/catalog/health') + async fetchCatalogHealth({partition, ns, dc}, { uri }, request) { + return (await request` + GET /v1/internal/ui/catalog-overview?${{ dc, stale: null }} + X-Request-ID: ${uri} + `)( + (headers, body, cache) => { + + + // for each Services/Nodes/Checks aggregate + const agg = ['Nodes', 'Services', 'Checks'] + .reduce((prev, item) => aggregate(prev, body, item), { + Datacenter: { + Name: dc, + Nodes: { + ...zero + }, + Services: { + ...zero + }, + Checks: { + ...zero + } + }, + Partition: {}, + Namespace: {} + }); + + + return { + meta: { + version: 2, + uri: uri, + interval: 30 * SECONDS + }, + body: { + Datacenter: agg.Datacenter, + Partitions: Object.values(agg.Partition), + Namespaces: Object.values(agg.Namespace), + ...body + } + }; + } + + ); + } + + @dataSource('/:partition/:ns/:dc/datacenter-cache/:name') + async find(params) { const items = this.store.peekAll('dc'); const item = items.findBy('Name', params.name); if (typeof item === 'undefined') { @@ -26,4 +186,5 @@ export default class DcService extends RepositoryService { } return item; } + } diff --git a/ui/packages/consul-ui/app/services/repository/dc.mdx b/ui/packages/consul-ui/app/services/repository/dc.mdx new file mode 100644 index 000000000..fdbff016c --- /dev/null +++ b/ui/packages/consul-ui/app/services/repository/dc.mdx @@ -0,0 +1,55 @@ +# Dc + +```hbs preview-template +
+
URI: /:partition/:nspace/:dc/catalog/health
+ +
{{json-stringify data null 4}}
+
+``` + +```hbs preview-template +
+
URI: /:partition/:nspace/:dc/datacenters
+ +
{{json-stringify data null 4}}
+
+``` + +```hbs preview-template +
+
URI: /:partition/:nspace/:dc/datacenter
+ +
{{json-stringify data null 4}}
+
+``` diff --git a/ui/packages/consul-ui/app/services/repository/license.js b/ui/packages/consul-ui/app/services/repository/license.js new file mode 100644 index 000000000..c9cbe52c8 --- /dev/null +++ b/ui/packages/consul-ui/app/services/repository/license.js @@ -0,0 +1,37 @@ +import RepositoryService from 'consul-ui/services/repository'; +import dataSource from 'consul-ui/decorators/data-source'; + +const MODEL_NAME = 'license'; + +const bucket = function(item, { dc, ns = 'default', partition = 'default' }) { + return { + ...item, + Datacenter: dc, + Namespace: typeof item.Namespace === 'undefined' ? ns : item.Namespace, + Partition: typeof item.Partition === 'undefined' ? partition : item.Partition, + }; +} + +const SECONDS = 1000; + +export default class LicenseService extends RepositoryService { + @dataSource('/:partition/:ns/:dc/license') + async find({partition, ns, dc}, { uri }, request) { + return (await request` + GET /v1/operator/license?${{ dc }} + X-Request-ID: ${uri} + `)( + (headers, body, cache) => ({ + meta: { + version: 2, + uri: uri, + interval: 30 * SECONDS + }, + body: cache( + bucket(body, { dc }), + uri => uri`${MODEL_NAME}:///${partition}/${ns}/${dc}/license/${body.License.license_id}` + ) + }) + ); + } +} diff --git a/ui/packages/consul-ui/app/services/repository/license.mdx b/ui/packages/consul-ui/app/services/repository/license.mdx new file mode 100644 index 000000000..573b75028 --- /dev/null +++ b/ui/packages/consul-ui/app/services/repository/license.mdx @@ -0,0 +1,19 @@ +# License + +```hbs preview-template +
+
URI: /:partition/:nspace/:dc/license
+ +
{{json-stringify data null 4}}
+
+``` diff --git a/ui/packages/consul-ui/app/templates/application.hbs b/ui/packages/consul-ui/app/templates/application.hbs index c5ab38f89..37926a1e8 100644 --- a/ui/packages/consul-ui/app/templates/application.hbs +++ b/ui/packages/consul-ui/app/templates/application.hbs @@ -113,7 +113,7 @@ as |dc dcs|}} {{! figure out our current DC and convert it to a model }} { + + const healthOf = num => { + return range(num).reduce((prev, _) => { + prev[fake.helpers.randomize(['Passing', 'Warning', 'Critical'])] ++; + return prev; + }, {Passing: 0, Warning: 0, Critical: 0}); + } + + const partitionCount = env('CONSUL_PARTITION_COUNT', Math.floor(Math.random() * 5)); + const nspaceCount = env('CONSUL_NSPACE_COUNT', Math.floor(Math.random() * 10)); + const nodes = env('CONSUL_NODE_COUNT', Math.floor(Math.random() * 10)); + const services = env('CONSUL_SERVICE_COUNT', Math.floor(Math.random() * 10)); + const checks = env('CONSUL_CHECK_COUNT', Math.floor(Math.random() * 10)); + + const partitions = range(partitionCount).map((_, i) => `${fake.hacker.noun()}-partition-${i}`); + const nspaces = range(nspaceCount).map((_, i) => `${fake.hacker.noun()}-nspace-${i}`); + +return ` +{ + "Nodes": [ +${partitions.map(partition => { + const health = healthOf(nodes); +return nspaces.map(nspace => ` + { + "Total": ${nodes}, + "Passing": ${health.Passing}, + "Warning": ${health.Warning}, + "Critical": ${health.Critical}, + "Partition": "${partition}", + "Namespace": "${nspace}" + } +`)}).flat()} + ], + "Services": [ +${partitions.map((partition, i) => { + const health = healthOf(services); +return nspaces.map((nspace, j) => ` + { + "Name": "${fake.hacker.noun()}-service-${i * j}", + "Total": ${services}, + "Passing": ${health.Passing}, + "Warning": ${health.Warning}, + "Critical": ${health.Critical}, + "Partition": "${partition}", + "Namespace": "${nspace}" + } +`)}).flat()} + ], + "Checks": [ +${partitions.map((partition, i) => { + const health = healthOf(checks); +return nspaces.map((nspace, j) => ` + { + "Name": "${fake.hacker.noun()}-check-${i * j}", + "Total": ${services}, + "Passing": ${health.Passing}, + "Warning": ${health.Warning}, + "Critical": ${health.Critical}, + "Partition": "${partition}", + "Namespace": "${nspace}" + } +`)}).flat()} + ] +} +`; +})} diff --git a/ui/packages/consul-ui/mock-api/v1/operator/autopilot/state b/ui/packages/consul-ui/mock-api/v1/operator/autopilot/state new file mode 100644 index 000000000..e3dbc500a --- /dev/null +++ b/ui/packages/consul-ui/mock-api/v1/operator/autopilot/state @@ -0,0 +1,37 @@ +${[0].map(_ => { + const servers = range(env('CONSUL_SERVER_COUNT', 3)).map(_ => fake.random.uuid()); + const failureTolerance = Math.ceil(servers.length / 2); + const optimisticTolerance = failureTolerance; // <== same for now + const leader = fake.random.number({min: 0, max: servers.length - 1}); + return ` +{ + "Healthy": true, + "FailureTolerance": ${failureTolerance}, + "OptimisticFailureTolerance": ${optimisticTolerance}, + "Servers": {${servers.map((item, i, items) => ` + "${item}": { + "ID": "${item}", + "Name": "node-${i}", + "Address": "${fake.internet.ip()}:${fake.random.number({min: 0, max: 65535})}", + "NodeStatus": "alive", + "Version": "1.11.2", + "LastContact": "0s", + "LastTerm": 2, + "LastIndex": 91, + "Healthy": true, + "StableSince": "2022-02-02T11:59:01.0708146Z", + "ReadReplica": false, + "Status": "${i === leader ? `leader` : `voter`}", + "Meta": { + "consul-network-segment": "" + }, + "NodeType": "voter" + } + `)}}, + "Leader": "${servers[leader]}", + "Voters": [ + ${servers.map(item => `"${item}"`)} + ] +} + `; +})} diff --git a/ui/packages/consul-ui/mock-api/v1/operator/license b/ui/packages/consul-ui/mock-api/v1/operator/license new file mode 100644 index 000000000..08d485fd2 --- /dev/null +++ b/ui/packages/consul-ui/mock-api/v1/operator/license @@ -0,0 +1,37 @@ +{ + "Valid": ${fake.random.boolean()}, + "License": { + "license_id": "${fake.random.uuid()}", + "customer_id": "${fake.random.uuid()}", + "installation_id": "*", + "issue_time": "2021-01-13T15:25:19.052900132Z", + "start_time": "2021-01-13T00:00:00Z", + "expiration_time": "${env('CONSUL_LICENSE_EXPIRATION', '2022-01-13T23:59:59.999Z')}", + "termination_time": "${env('CONSUL_LICENSE_TERMINATION', '2022-01-13T23:59:59.999Z')}", + "product": "consul", + "flags": { + "modules": [ + "global-visibility-routing-scale", + "governance-policy" + ] + }, + "modules": [ + "Global Visibility, Routing and Scale", + "Governance and Policy" + ], + "features": [ + "Automated Backups", + "Automated Upgrades", + "Enhanced Read Scalability", + "Network Segments", + "Redundancy Zone", + "Advanced Network Federation", + "Namespaces", + "SSO", + "Audit Logging", + "Admin Partitions" + ] + }, + "Warnings": [ + ] +} diff --git a/ui/packages/consul-ui/tests/integration/adapters/dc-test.js b/ui/packages/consul-ui/tests/integration/adapters/dc-test.js deleted file mode 100644 index 2569b55e6..000000000 --- a/ui/packages/consul-ui/tests/integration/adapters/dc-test.js +++ /dev/null @@ -1,13 +0,0 @@ -import { module, test } from 'qunit'; -import { setupTest } from 'ember-qunit'; -module('Integration | Adapter | dc', function(hooks) { - setupTest(hooks); - test('requestForQuery returns the correct url', function(assert) { - const adapter = this.owner.lookup('adapter:dc'); - const client = this.owner.lookup('service:client/http'); - const request = client.url.bind(client); - const expected = `GET /v1/catalog/datacenters`; - const actual = adapter.requestForQuery(request); - assert.equal(actual, expected); - }); -}); diff --git a/ui/packages/consul-ui/tests/integration/serializers/dc-test.js b/ui/packages/consul-ui/tests/integration/serializers/dc-test.js deleted file mode 100644 index 93b12f16a..000000000 --- a/ui/packages/consul-ui/tests/integration/serializers/dc-test.js +++ /dev/null @@ -1,43 +0,0 @@ -import { module, test } from 'qunit'; -import { setupTest } from 'ember-qunit'; -import { get } from 'consul-ui/tests/helpers/api'; -import { - HEADERS_DEFAULT_ACL_POLICY as DEFAULT_ACL_POLICY, -} from 'consul-ui/utils/http/consul'; -module('Integration | Serializer | dc', function(hooks) { - setupTest(hooks); - test('respondForQuery returns the correct data for list endpoint', function(assert) { - const serializer = this.owner.lookup('serializer:dc'); - let env = this.owner.lookup('service:env'); - env = env.var.bind(env); - const request = { - url: `/v1/catalog/datacenters`, - }; - return get(request.url).then(function(payload) { - const ALLOW = 'allow'; - const expected = payload.map(item => ( - { - Name: item, - Datacenter: '', - Local: item === env('CONSUL_DATACENTER_LOCAL'), - Primary: item === env('CONSUL_DATACENTER_PRIMARY'), - DefaultACLPolicy: ALLOW - } - )) - const actual = serializer.respondForQuery(function(cb) { - const headers = { - [DEFAULT_ACL_POLICY]: ALLOW - }; - return cb(headers, payload); - }, { - dc: '*', - }); - actual.forEach((item, i) => { - assert.equal(actual[i].Name, expected[i].Name); - assert.equal(actual[i].Local, expected[i].Local); - assert.equal(actual[i].Primary, expected[i].Primary); - assert.equal(actual[i].DefaultACLPolicy, expected[i].DefaultACLPolicy); - }); - }); - }); -}); diff --git a/ui/packages/consul-ui/tests/integration/services/repository/dc-test.js b/ui/packages/consul-ui/tests/integration/services/repository/dc-test.js index 30f746501..a491c98e0 100644 --- a/ui/packages/consul-ui/tests/integration/services/repository/dc-test.js +++ b/ui/packages/consul-ui/tests/integration/services/repository/dc-test.js @@ -1,4 +1,4 @@ -import { moduleFor, test } from 'ember-qunit'; +import { moduleFor } from 'ember-qunit'; import { skip } from 'qunit'; import repo from 'consul-ui/tests/helpers/repo'; const NAME = 'dc'; @@ -7,7 +7,7 @@ moduleFor(`service:repository/${NAME}`, `Integration | Service | ${NAME}`, { integration: true, }); skip("findBySlug (doesn't interact with the API) but still needs an int test"); -test('findAll returns the correct data for list endpoint', function(assert) { +skip('findAll returns the correct data for list endpoint', function(assert) { return repo( 'Dc', 'findAll', diff --git a/ui/packages/consul-ui/tests/unit/adapters/dc-test.js b/ui/packages/consul-ui/tests/unit/adapters/dc-test.js deleted file mode 100644 index 253923871..000000000 --- a/ui/packages/consul-ui/tests/unit/adapters/dc-test.js +++ /dev/null @@ -1,12 +0,0 @@ -import { module, test } from 'qunit'; -import { setupTest } from 'ember-qunit'; - -module('Unit | Adapter | dc', function(hooks) { - setupTest(hooks); - - // Replace this with your real tests. - test('it exists', function(assert) { - let adapter = this.owner.lookup('adapter:dc'); - assert.ok(adapter); - }); -}); diff --git a/ui/packages/consul-ui/tests/unit/serializers/dc-test.js b/ui/packages/consul-ui/tests/unit/serializers/dc-test.js deleted file mode 100644 index 658877af2..000000000 --- a/ui/packages/consul-ui/tests/unit/serializers/dc-test.js +++ /dev/null @@ -1,24 +0,0 @@ -import { module, test } from 'qunit'; -import { setupTest } from 'ember-qunit'; -import { run } from '@ember/runloop'; - -module('Unit | Serializer | dc', function(hooks) { - setupTest(hooks); - - // Replace this with your real tests. - test('it exists', function(assert) { - let store = this.owner.lookup('service:store'); - let serializer = store.serializerFor('dc'); - - assert.ok(serializer); - }); - - test('it serializes records', function(assert) { - let store = this.owner.lookup('service:store'); - let record = run(() => store.createRecord('dc', {})); - - let serializedRecord = record.serialize(); - - assert.ok(serializedRecord); - }); -});