mirror of
https://github.com/status-im/consul.git
synced 2025-02-02 08:56:43 +00:00
Merge pull request #4326 from hashicorp/feature/embedded-test-api
Move testing doubles to use data embedded in the HTML vs HTTP/fetch
This commit is contained in:
commit
caf3bf17f0
@ -5,5 +5,6 @@
|
|||||||
|
|
||||||
Setting `disableAnalytics` to true will prevent any data from being sent.
|
Setting `disableAnalytics` to true will prevent any data from being sent.
|
||||||
*/
|
*/
|
||||||
"disableAnalytics": false
|
"disableAnalytics": false,
|
||||||
|
"proxy": "http://localhost:3000"
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,9 @@ build: deps
|
|||||||
start: deps
|
start: deps
|
||||||
yarn run start
|
yarn run start
|
||||||
|
|
||||||
|
start-api: deps
|
||||||
|
yarn run start:api
|
||||||
|
|
||||||
test: deps
|
test: deps
|
||||||
yarn run test
|
yarn run test
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ module.exports = function(environment) {
|
|||||||
ENV = Object.assign({}, ENV, {
|
ENV = Object.assign({}, ENV, {
|
||||||
CONSUL_GIT_SHA: (function() {
|
CONSUL_GIT_SHA: (function() {
|
||||||
if (process.env.CONSUL_GIT_SHA) {
|
if (process.env.CONSUL_GIT_SHA) {
|
||||||
return process.env.CONSUL_GIT_SHA
|
return process.env.CONSUL_GIT_SHA;
|
||||||
}
|
}
|
||||||
|
|
||||||
return require('child_process')
|
return require('child_process')
|
||||||
@ -40,7 +40,7 @@ module.exports = function(environment) {
|
|||||||
})(),
|
})(),
|
||||||
CONSUL_VERSION: (function() {
|
CONSUL_VERSION: (function() {
|
||||||
if (process.env.CONSUL_VERSION) {
|
if (process.env.CONSUL_VERSION) {
|
||||||
return process.env.CONSUL_VERSION
|
return process.env.CONSUL_VERSION;
|
||||||
}
|
}
|
||||||
// see /scripts/dist.sh:8
|
// see /scripts/dist.sh:8
|
||||||
const version_go = `${path.dirname(path.dirname(__dirname))}/version/version.go`;
|
const version_go = `${path.dirname(path.dirname(__dirname))}/version/version.go`;
|
||||||
@ -53,13 +53,13 @@ module.exports = function(environment) {
|
|||||||
.trim()
|
.trim()
|
||||||
.split('"')[1];
|
.split('"')[1];
|
||||||
})(),
|
})(),
|
||||||
CONSUL_BINARY_TYPE: (function() {
|
CONSUL_BINARY_TYPE: function() {
|
||||||
if (process.env.CONSUL_BINARY_TYPE) {
|
if (process.env.CONSUL_BINARY_TYPE) {
|
||||||
return process.env.CONSUL_BINARY_TYPE
|
return process.env.CONSUL_BINARY_TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return "oss"
|
return 'oss';
|
||||||
}),
|
},
|
||||||
CONSUL_DOCUMENTATION_URL: 'https://www.consul.io/docs',
|
CONSUL_DOCUMENTATION_URL: 'https://www.consul.io/docs',
|
||||||
CONSUL_COPYRIGHT_URL: 'https://www.hashicorp.com',
|
CONSUL_COPYRIGHT_URL: 'https://www.hashicorp.com',
|
||||||
CONSUL_COPYRIGHT_YEAR: '2018',
|
CONSUL_COPYRIGHT_YEAR: '2018',
|
||||||
@ -86,6 +86,10 @@ module.exports = function(environment) {
|
|||||||
|
|
||||||
ENV.APP.rootElement = '#ember-testing';
|
ENV.APP.rootElement = '#ember-testing';
|
||||||
ENV.APP.autoboot = false;
|
ENV.APP.autoboot = false;
|
||||||
|
ENV['ember-cli-api-double'] = {
|
||||||
|
reader: 'html',
|
||||||
|
endpoints: ['/node_modules/@hashicorp/consul-api-double/v1'],
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (environment === 'production') {
|
if (environment === 'production') {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "consul-ui",
|
"name": "consul-ui",
|
||||||
"version": "2.0.0",
|
"version": "2.2.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"description": "The web ui for Consul, by HashiCorp.",
|
"description": "The web ui for Consul, by HashiCorp.",
|
||||||
"directories": {
|
"directories": {
|
||||||
@ -14,9 +14,9 @@
|
|||||||
"lint:js": "eslint -c .eslintrc.js --fix ./*.js ./.*.js app config lib server tests",
|
"lint:js": "eslint -c .eslintrc.js --fix ./*.js ./.*.js app config lib server tests",
|
||||||
"format:js": "prettier --write \"{app,config,lib,server,tests}/**/*.js\" ./*.js ./.*.js",
|
"format:js": "prettier --write \"{app,config,lib,server,tests}/**/*.js\" ./*.js ./.*.js",
|
||||||
"start": "ember serve",
|
"start": "ember serve",
|
||||||
"test:sync": "rsync -aq ./node_modules/@hashicorp/consul-api-double/ ./public/consul-api-double/",
|
"start:api": "api-double --dir ./node_modules/@hashicorp/consul-api-double",
|
||||||
"test": "yarn run test:sync;ember test",
|
"test": "ember test",
|
||||||
"test:view": "yarn run test:sync;ember test --server",
|
"test:view": "ember test --server",
|
||||||
"precommit": "lint-staged"
|
"precommit": "lint-staged"
|
||||||
},
|
},
|
||||||
"lint-staged": {
|
"lint-staged": {
|
||||||
@ -29,10 +29,9 @@
|
|||||||
"git add"
|
"git add"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"dependencies": {},
|
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@hashicorp/consul-api-double": "^1.0.0",
|
"@hashicorp/consul-api-double": "^1.2.0",
|
||||||
"@hashicorp/ember-cli-api-double": "^1.0.2",
|
"@hashicorp/ember-cli-api-double": "^1.3.0",
|
||||||
"babel-plugin-transform-object-rest-spread": "^6.26.0",
|
"babel-plugin-transform-object-rest-spread": "^6.26.0",
|
||||||
"base64-js": "^1.3.0",
|
"base64-js": "^1.3.0",
|
||||||
"broccoli-asset-rev": "^2.4.5",
|
"broccoli-asset-rev": "^2.4.5",
|
||||||
|
@ -1,4 +1,14 @@
|
|||||||
import getAPI from '@hashicorp/ember-cli-api-double';
|
import getAPI from '@hashicorp/ember-cli-api-double';
|
||||||
import setCookies from 'consul-ui/tests/helpers/set-cookies';
|
import setCookies from 'consul-ui/tests/helpers/set-cookies';
|
||||||
import typeToURL from 'consul-ui/tests/helpers/type-to-url';
|
import typeToURL from 'consul-ui/tests/helpers/type-to-url';
|
||||||
export default getAPI('/consul-api-double', setCookies, typeToURL);
|
import config from 'consul-ui/config/environment';
|
||||||
|
const apiConfig = config['ember-cli-api-double'];
|
||||||
|
let path = '/consul-api-double';
|
||||||
|
let reader;
|
||||||
|
if (apiConfig) {
|
||||||
|
const temp = apiConfig.endpoints[0].split('/');
|
||||||
|
reader = apiConfig.reader;
|
||||||
|
temp.pop();
|
||||||
|
path = temp.join('/');
|
||||||
|
}
|
||||||
|
export default getAPI(path, setCookies, typeToURL, reader);
|
||||||
|
@ -69,9 +69,9 @@
|
|||||||
dependencies:
|
dependencies:
|
||||||
"@glimmer/di" "^0.2.0"
|
"@glimmer/di" "^0.2.0"
|
||||||
|
|
||||||
"@hashicorp/api-double@^1.1.0":
|
"@hashicorp/api-double@^1.3.0":
|
||||||
version "1.2.0"
|
version "1.3.1"
|
||||||
resolved "https://registry.yarnpkg.com/@hashicorp/api-double/-/api-double-1.2.0.tgz#d2846f79d086ac009673ae755da15301e0f2f7c3"
|
resolved "https://registry.yarnpkg.com/@hashicorp/api-double/-/api-double-1.3.1.tgz#fd9d706674b934857a638459c2bb52d2f2809455"
|
||||||
dependencies:
|
dependencies:
|
||||||
"@gardenhq/o" "^8.0.1"
|
"@gardenhq/o" "^8.0.1"
|
||||||
"@gardenhq/tick-control" "^2.0.0"
|
"@gardenhq/tick-control" "^2.0.0"
|
||||||
@ -81,20 +81,21 @@
|
|||||||
faker "^4.1.0"
|
faker "^4.1.0"
|
||||||
js-yaml "^3.10.0"
|
js-yaml "^3.10.0"
|
||||||
|
|
||||||
"@hashicorp/consul-api-double@^1.0.0":
|
"@hashicorp/consul-api-double@^1.2.0":
|
||||||
version "1.1.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/@hashicorp/consul-api-double/-/consul-api-double-1.1.0.tgz#658f9e89208fa23f251ca66c66aeb7241a13f23f"
|
|
||||||
|
|
||||||
"@hashicorp/ember-cli-api-double@^1.0.2":
|
|
||||||
version "1.2.0"
|
version "1.2.0"
|
||||||
resolved "https://registry.yarnpkg.com/@hashicorp/ember-cli-api-double/-/ember-cli-api-double-1.2.0.tgz#aed3a9659abb3f3c56d77e400abc7fcbdcf2b78b"
|
resolved "https://registry.yarnpkg.com/@hashicorp/consul-api-double/-/consul-api-double-1.2.0.tgz#2cd2a991818e13e7b97803af3d62ec6c9cb83b28"
|
||||||
|
|
||||||
|
"@hashicorp/ember-cli-api-double@^1.3.0":
|
||||||
|
version "1.3.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/@hashicorp/ember-cli-api-double/-/ember-cli-api-double-1.3.0.tgz#d07b5b11701cd55d6b01cb8a47ce17c4bac21fed"
|
||||||
dependencies:
|
dependencies:
|
||||||
"@hashicorp/api-double" "^1.1.0"
|
"@hashicorp/api-double" "^1.3.0"
|
||||||
array-range "^1.0.1"
|
array-range "^1.0.1"
|
||||||
ember-cli-babel "^6.6.0"
|
ember-cli-babel "^6.6.0"
|
||||||
js-yaml "^3.11.0"
|
js-yaml "^3.11.0"
|
||||||
merge-options "^1.0.1"
|
merge-options "^1.0.1"
|
||||||
pretender "^2.0.0"
|
pretender "^2.0.0"
|
||||||
|
recursive-readdir-sync "^1.0.6"
|
||||||
|
|
||||||
"@sinonjs/formatio@^2.0.0":
|
"@sinonjs/formatio@^2.0.0":
|
||||||
version "2.0.0"
|
version "2.0.0"
|
||||||
@ -7735,6 +7736,10 @@ recast@^0.11.17, recast@^0.11.3:
|
|||||||
private "~0.1.5"
|
private "~0.1.5"
|
||||||
source-map "~0.5.0"
|
source-map "~0.5.0"
|
||||||
|
|
||||||
|
recursive-readdir-sync@^1.0.6:
|
||||||
|
version "1.0.6"
|
||||||
|
resolved "https://registry.yarnpkg.com/recursive-readdir-sync/-/recursive-readdir-sync-1.0.6.tgz#1dbf6d32f3c5bb8d3cde97a6c588d547a9e13d56"
|
||||||
|
|
||||||
redent@^1.0.0:
|
redent@^1.0.0:
|
||||||
version "1.0.0"
|
version "1.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/redent/-/redent-1.0.0.tgz#cf916ab1fd5f1f16dfb20822dd6ec7f730c2afde"
|
resolved "https://registry.yarnpkg.com/redent/-/redent-1.0.0.tgz#cf916ab1fd5f1f16dfb20822dd6ec7f730c2afde"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user