test(cp-gql-mock-server): unit tests

This commit is contained in:
Sérgio Ramos 2017-07-21 15:08:15 +01:00 committed by Sérgio Ramos
parent 1416f5821b
commit de68427a0c
40 changed files with 20035 additions and 1438 deletions

View File

@ -8,10 +8,10 @@
"scripts": {
"lint": "eslint . --fix",
"lint-ci": "eslint . --format junit --output-file $CIRCLE_TEST_REPORTS/lint/cp-gql-mock-server.xml",
"test": "echo 0",
"test-ci": "echo 0",
"test": "nyc --reporter=lcov --reporter=text ava --verbose",
"test-ci": "nyc --report-dir=$CIRCLE_ARTIFACTS/cp-gql-mock-server --reporter=lcov --reporter=text ava --tap | tap-xunit > $CIRCLE_TEST_REPORTS/test/cp-gql-mock-server.xml",
"start": "node src/index.js",
"dev": "nodemon src/index.js"
"dev": "PORT=3000 nodemon src/index.js"
},
"dependencies": {
"build-array": "^1.0.0",
@ -21,6 +21,7 @@
"good-squeeze": "^5.0.2",
"graphi": "^2.2.1",
"hapi": "^16.4.3",
"hasha": "^3.0.0",
"joi": "^10.6.0",
"joyent-cp-gql-schema": "^1.0.4",
"js-yaml": "^3.8.4",
@ -33,8 +34,24 @@
"uuid": "^3.1.0"
},
"devDependencies": {
"apollo-client": "^1.9.0-1",
"ava": "^0.21.0",
"delay": "^2.0.0",
"eslint": "^3.19.0",
"eslint-config-joyent-portal": "2.0.0",
"nodemon": "^1.11.0"
"execa": "^0.7.0",
"mz": "^2.6.0",
"nodemon": "^1.11.0",
"nyc": "^11.0.3",
"tap-xunit": "^1.7.0"
},
"ava": {
"files": [
"test/*.js"
],
"source": [
"src/*.js"
],
"failFast": true
}
}

File diff suppressed because it is too large Load Diff

View File

@ -4,51 +4,40 @@
"name": "cpexample",
"slug": "cpexample",
"imported": true,
"status": "ACTIVE",
"__typename": "DeploymentGroup"
"status": "ACTIVE"
},
"services": [
{
"id": "af6a5cd2-291f-490b-bf3b-141b010635db",
"name": "frontend",
"slug": "frontend",
"status": null,
"__typename": "Service",
"status": "ACTIVE",
"branches": [],
"connections": [
"aea06a05-830a-46d3-bdc1-9dcba97303de"
],
"connections": ["aea06a05-830a-46d3-bdc1-9dcba97303de"],
"deploymentGroupId": "24b16df5-7553-45d9-ab7f-62d541764b67"
},
{
"id": "2c872d69-25d1-46e9-84d8-dcc89ea0d5a1",
"name": "mysql",
"slug": "mysql",
"status": null,
"__typename": "Service",
"status": "ACTIVE",
"branches": [
{
"name": "mysql-primary",
"slug": "mysql-primary",
"instances": [
"1188dfa0-efac-4142-8a6d-615841dc04e7"
],
"__typename": "Service",
"deploymentGroupId": "24b16df5-7553-45d9-ab7f-62d541764b67",
"id": "mysql-primary-mysql-primary"
"instances": ["1188dfa0-efac-4142-8a6d-615841dc04e7"],
"deploymentGroupId": "24b16df5-7553-45d9-ab7f-62d541764b67"
},
{
"name": "mysql",
"slug": "mysql",
"instances": [
"0d757833-7912-4777-81ce-f302c653cfda",
"ec13cf3f-dcb4-47d4-9b87-38477a02ac9b",
"3ec9132f-9093-4644-a2fd-a9749d0011ca",
"6e460ff1-7bc3-4c9b-b093-f37b1134f37b",
"991cbab5-b773-4651-b5b9-b95c299cf50f"
],
"__typename": "Service",
"deploymentGroupId": "24b16df5-7553-45d9-ab7f-62d541764b67",
"id": "mysql-mysql"
"deploymentGroupId": "24b16df5-7553-45d9-ab7f-62d541764b67"
}
],
"connections": [],
@ -58,8 +47,7 @@
"id": "908b64d9-070b-4c9a-b7d8-757ec3c9c7f4",
"name": "producer",
"slug": "producer",
"status": null,
"__typename": "Service",
"status": "ACTIVE",
"branches": [],
"connections": [
"2c872d69-25d1-46e9-84d8-dcc89ea0d5a1",
@ -71,8 +59,7 @@
"id": "aea06a05-830a-46d3-bdc1-9dcba97303de",
"name": "api",
"slug": "api",
"status": null,
"__typename": "Service",
"status": "ACTIVE",
"branches": [],
"connections": [
"2c872d69-25d1-46e9-84d8-dcc89ea0d5a1",
@ -85,8 +72,7 @@
"id": "e30c9c43-5af6-4adb-b3cd-8c383d911a0a",
"name": "consul",
"slug": "consul",
"status": null,
"__typename": "Service",
"status": "ACTIVE",
"branches": [],
"connections": [],
"deploymentGroupId": "24b16df5-7553-45d9-ab7f-62d541764b67"
@ -100,132 +86,88 @@
"__typename": "Instance",
"deploymentGroupId": "24b16df5-7553-45d9-ab7f-62d541764b67",
"serviceId": "af6a5cd2-291f-490b-bf3b-141b010635db",
"machineId": "c5da7ba6-c544-4f78-9dcc-4ae418a08ed2",
"name": "frontend-0"
},
{
"id": "c5c7ae33-cfe1-43cc-9e9b-6f453de3888d",
"status": "FAILED",
"healthy": "UNAVAILABLE",
"__typename": "Instance",
"deploymentGroupId": "24b16df5-7553-45d9-ab7f-62d541764b67",
"serviceId": "af6a5cd2-291f-490b-bf3b-141b010635db",
"machineId": "4be909bb-1ee1-4503-a5d0-62e3d460bb93",
"name": "frontend-1"
},
{
"id": "1188dfa0-efac-4142-8a6d-615841dc04e7",
"id": "ec13cf3f-dcb4-47d4-9b87-38477a02ac9b",
"status": "RUNNING",
"healthy": "UNKNOWN",
"__typename": "Instance",
"deploymentGroupId": "24b16df5-7553-45d9-ab7f-62d541764b67",
"serviceId": "2c872d69-25d1-46e9-84d8-dcc89ea0d5a1",
"name": "mysql-primary-0"
},
{
"id": "0d757833-7912-4777-81ce-f302c653cfda",
"status": "RUNNING",
"healthy": "UNKNOWN",
"__typename": "Instance",
"deploymentGroupId": "24b16df5-7553-45d9-ab7f-62d541764b67",
"serviceId": "2c872d69-25d1-46e9-84d8-dcc89ea0d5a1",
"name": "mysql-0"
},
{
"id": "3ec9132f-9093-4644-a2fd-a9749d0011ca",
"status": "RUNNING",
"healthy": "UNKNOWN",
"__typename": "Instance",
"deploymentGroupId": "24b16df5-7553-45d9-ab7f-62d541764b67",
"serviceId": "2c872d69-25d1-46e9-84d8-dcc89ea0d5a1",
"machineId": "45d1ce78-900b-402d-9553-858e4ec55b87",
"name": "mysql-1"
},
{
"id": "6e460ff1-7bc3-4c9b-b093-f37b1134f37b",
"status": "RUNNING",
"healthy": "UNKNOWN",
"__typename": "Instance",
"deploymentGroupId": "24b16df5-7553-45d9-ab7f-62d541764b67",
"serviceId": "2c872d69-25d1-46e9-84d8-dcc89ea0d5a1",
"name": "mysql-2"
},
{
"id": "991cbab5-b773-4651-b5b9-b95c299cf50f",
"status": "RUNNING",
"healthy": "UNKNOWN",
"__typename": "Instance",
"deploymentGroupId": "24b16df5-7553-45d9-ab7f-62d541764b67",
"serviceId": "2c872d69-25d1-46e9-84d8-dcc89ea0d5a1",
"name": "mysql-3"
},
{
"id": "0d757833-7912-4777-81ce-f302c653cfda",
"status": "RUNNING",
"healthy": "UNKNOWN",
"__typename": "Instance",
"deploymentGroupId": "24b16df5-7553-45d9-ab7f-62d541764b67",
"serviceId": "2c872d69-25d1-46e9-84d8-dcc89ea0d5a1",
"name": "mysql-0"
},
{
"id": "1188dfa0-efac-4142-8a6d-615841dc04e7",
"status": "RUNNING",
"healthy": "UNKNOWN",
"__typename": "Instance",
"deploymentGroupId": "24b16df5-7553-45d9-ab7f-62d541764b67",
"serviceId": "2c872d69-25d1-46e9-84d8-dcc89ea0d5a1",
"name": "mysql-1"
},
{
"id": "6e460ff1-7bc3-4c9b-b093-f37b1134f37b",
"status": "RUNNING",
"healthy": "UNKNOWN",
"__typename": "Instance",
"deploymentGroupId": "24b16df5-7553-45d9-ab7f-62d541764b67",
"serviceId": "2c872d69-25d1-46e9-84d8-dcc89ea0d5a1",
"machineId": "11d2c82a-6092-4cac-a97a-bec81bbaffdf",
"name": "mysql-2"
},
{
"id": "3ec9132f-9093-4644-a2fd-a9749d0011ca",
"status": "RUNNING",
"healthy": "UNKNOWN",
"__typename": "Instance",
"deploymentGroupId": "24b16df5-7553-45d9-ab7f-62d541764b67",
"serviceId": "2c872d69-25d1-46e9-84d8-dcc89ea0d5a1",
"machineId": "4a58eab4-3bb6-49c6-aaeb-45a7a9310af0",
"name": "mysql-3"
},
{
"id": "991cbab5-b773-4651-b5b9-b95c299cf50f",
"status": "RUNNING",
"healthy": "UNKNOWN",
"__typename": "Instance",
"deploymentGroupId": "24b16df5-7553-45d9-ab7f-62d541764b67",
"serviceId": "2c872d69-25d1-46e9-84d8-dcc89ea0d5a1",
"machineId": "9f6c637f-0ef5-464c-b278-55c3cf2a76f5",
"name": "mysql-4"
},
{
"id": "1188dfa0-efac-4142-8a6d-615841dc04e7",
"status": "RUNNING",
"healthy": "UNKNOWN",
"deploymentGroupId": "24b16df5-7553-45d9-ab7f-62d541764b67",
"serviceId": "2c872d69-25d1-46e9-84d8-dcc89ea0d5a1",
"machineId": "7dd8b110-dbea-43a4-9643-316ed2a053bd",
"name": "mysql-5"
},
{
"id": "1e3dc868-8738-41b3-a70f-ea332823429c",
"status": "RUNNING",
"healthy": "UNKNOWN",
"__typename": "Instance",
"deploymentGroupId": "24b16df5-7553-45d9-ab7f-62d541764b67",
"serviceId": "908b64d9-070b-4c9a-b7d8-757ec3c9c7f4",
"machineId": "76d03576-787b-4ac9-85e7-3e6e5ea5b60c",
"name": "producer-0"
},
{
"id": "2ddf4ce0-0cc6-4df9-ac0e-7518e9fff19e",
"status": "RUNNING",
"healthy": "UNKNOWN",
"__typename": "Instance",
"deploymentGroupId": "24b16df5-7553-45d9-ab7f-62d541764b67",
"serviceId": "aea06a05-830a-46d3-bdc1-9dcba97303de",
"machineId": "949c82eb-b6bf-47e0-a7e5-d3edbc7299be",
"name": "api-0"
},
{
"id": "c9698959-eaa2-4b32-9333-fc2591702cf7",
"status": "RUNNING",
"healthy": "UNAVAILABLE",
"__typename": "Instance",
"deploymentGroupId": "24b16df5-7553-45d9-ab7f-62d541764b67",
"serviceId": "e30c9c43-5af6-4adb-b3cd-8c383d911a0a",
"machineId": "65b286a1-66f6-4c42-bdd5-0fdb986bfbf3",
"name": "consul-0"
}
]

View File

@ -1,11 +1,13 @@
{
"datacenter": {
"id": "datacenter-uuid",
"region": "us-east-1"
"id": "e84d14cc-5b49-4b4e-83ce-ae82e3994c44",
"region": "us-east-1",
"name": "US East 1"
},
"portal": {
"id": "296a92bf-65cd-4787-b5a7-444489a31e04",
"user": {
"id": "id",
"id": "daf18f20-60c3-4a17-a61e-b5aa60f9e43e",
"login": "juditgreskovits",
"firstName": "Judit",
"lastName": "Greskovits",

View File

@ -20,7 +20,7 @@ const handlerError = err => {
};
server.connection({
port: 3000,
port: process.env.PORT,
routes: {
cors: true
}

View File

@ -8,19 +8,27 @@ const flatten = require('lodash.flatten');
const random = require('lodash.random');
const uniq = require('lodash.uniq');
const yaml = require('js-yaml');
const hasha = require('hasha');
const wpData = require('./wp-data.json');
const cpData = require('./cp-data.json');
const complexData = require('./complex-data.json');
const {
datacenter,
portal
} = require('./data.json');
const { datacenter, portal } = require('./data.json');
const deploymentGroups = [wpData.deploymentGroup, cpData.deploymentGroup, complexData.deploymentGroup];
const services = wpData.services.concat(cpData.services).concat(complexData.services);
const instances = wpData.instances.concat(cpData.instances).concat(complexData.instances);
const deploymentGroups = [
wpData.deploymentGroup,
cpData.deploymentGroup,
complexData.deploymentGroup
];
const services = wpData.services
.concat(cpData.services)
.concat(complexData.services);
const instances = wpData.instances
.concat(cpData.instances)
.concat(complexData.instances);
const find = (query = {}) => item =>
Object.keys(query).every(key => item[key] === query[key]);
@ -44,12 +52,15 @@ const getUnfilteredServices = query => {
instances: instancesResolver(service),
branches: (service.branches || []).map(service =>
Object.assign({}, service, {
instances: () => {
return Promise.resolve(
id: hasha(JSON.stringify(service)),
instances: query =>
Promise.resolve(
flatten(
service.instances.map(id => instances.filter(find({ id })))
service.instances.map(id =>
instances.filter(find(Object.assign({}, query, { id })))
)
)
)
)}
})
)
});
@ -115,12 +126,15 @@ const getPortal = () =>
);
const createDeploymentGroup = ({ name }) => {
const dg = {
id: uuid(),
const _dg = {
slug: paramCase(name),
name
};
const dg = Object.assign({}, _dg, {
id: hasha(JSON.stringify(_dg))
});
deploymentGroups.push(dg);
return Promise.resolve(dg);
@ -166,20 +180,26 @@ const createServicesFromManifest = ({ deploymentGroupId, raw }) => {
const manifest = yaml.safeLoad(raw);
Object.keys(manifest).forEach(name => {
const service = {
id: uuid(),
deploymentGroup: deploymentGroupId,
const _service = {
deploymentGroupId,
slug: paramCase(name),
name
};
const instance = {
id: uuid(),
const service = Object.assign({}, _service, {
id: hasha(JSON.stringify(_service))
});
const _instance = {
name: camelCase(`${service.slug}_01`),
service: service.id,
deploymentGroup: deploymentGroupId
serviceId: service.id,
deploymentGroupId
};
const instance = Object.assign({}, _instance, {
id: hasha(JSON.stringify(_instance))
});
services.push(service);
instances.push(instance);
});
@ -207,14 +227,19 @@ const scale = ({ serviceId, replicas }) => {
const up = n => {
buildArray(n).forEach((_, i) => {
instances.push({
id: uuid(),
const instance = {
name: `${services[serviceIndex].slug}_${currentScale + i}`,
serviceId,
deploymentGroupId: services[serviceIndex].deploymentGroupId,
status: 'ACTIVE',
healthy: 'UNKNOWN'
});
};
instances.push(
Object.assign({}, instance, {
id: hasha(JSON.stringify(instance))
})
);
});
};
@ -385,7 +410,7 @@ module.exports = {
createDeploymentGroup,
provisionManifest: options =>
createServicesFromManifest(options).then(() => ({
id: uuid(),
id: hasha(JSON.stringify(options)),
type: options.type,
format: options.format
})),

View File

@ -1,6 +1,5 @@
{
"deploymentGroup":
{
"deploymentGroup": {
"id": "e0ea0c02-55cc-45fe-8064-3e5176a59401",
"slug": "wordpress-blog-example",
"name": "Wordpress Blog Example"
@ -11,9 +10,7 @@
"slug": "nginx",
"name": "Nginx",
"deploymentGroupId": "e0ea0c02-55cc-45fe-8064-3e5176a59401",
"connections": [
"be227788-74f1-4e5b-a85f-b5c71cbae8d8"
]
"connections": ["be227788-74f1-4e5b-a85f-b5c71cbae8d8"]
},
{
"id": "be227788-74f1-4e5b-a85f-b5c71cbae8d8",
@ -43,17 +40,20 @@
"slug": "percona",
"name": "Percona",
"deploymentGroupId": "e0ea0c02-55cc-45fe-8064-3e5176a59401",
"branches": [{
"branches": [
{
"id": "dmklaskdls",
"slug": "percona",
"name": "Percona",
"instances": ["c3ec7633-a02b-4615-86a0-9e6faeaae94b"]
}, {
},
{
"id": "dmklaskdls",
"slug": "percona-primary",
"name": "percona-primary",
"instances": ["c2b5fec2-31e2-41a7-b7fc-cd0bb1822e76"]
}]
}
]
},
{
"id": "97c68055-db88-45c9-ad49-f26da4264777",
@ -86,6 +86,7 @@
"name": "wordpress_01",
"serviceId": "be227788-74f1-4e5b-a85f-b5c71cbae8d8",
"deploymentGroupId": "e0ea0c02-55cc-45fe-8064-3e5176a59401",
"machineId": "011f7479-2d45-442d-99bf-7f6216954cc8",
"status": "RUNNING",
"healthy": "HEALTHY"
},
@ -94,6 +95,7 @@
"name": "nfs_01",
"serviceId": "6a0eee76-c019-413b-9d5f-44712b55b993",
"deploymentGroupId": "e0ea0c02-55cc-45fe-8064-3e5176a59401",
"machineId": "991c0d29-5c99-4a45-a05f-78c213e77d4f",
"status": "RUNNING",
"healthy": "HEALTHY"
},
@ -102,6 +104,7 @@
"name": "consul",
"serviceId": "97c68055-db88-45c9-ad49-f26da4264777",
"deploymentGroupId": "e0ea0c02-55cc-45fe-8064-3e5176a59401",
"machineId": "ff5dd3a0-7c12-4ea9-8a41-58b759b2c76d",
"status": "RUNNING",
"healthy": "UNHEALTHY"
},
@ -110,6 +113,7 @@
"name": "memcache_01",
"serviceId": "6d31aff4-de1e-4042-a983-fbd23d5c530c",
"deploymentGroupId": "e0ea0c02-55cc-45fe-8064-3e5176a59401",
"machineId": "8d8a2238-d981-4849-b523-a37456fbe20b",
"status": "RUNNING",
"healthy": "HEALTHY"
},
@ -118,6 +122,7 @@
"name": "memcache_02",
"serviceId": "6d31aff4-de1e-4042-a983-fbd23d5c530c",
"deploymentGroupId": "e0ea0c02-55cc-45fe-8064-3e5176a59401",
"machineId": "f95ad0b9-996f-4f49-8826-e08dd319d5a8",
"status": "RUNNING",
"healthy": "HEALTHY"
},
@ -126,6 +131,7 @@
"name": "memcache_03",
"serviceId": "6d31aff4-de1e-4042-a983-fbd23d5c530c",
"deploymentGroupId": "e0ea0c02-55cc-45fe-8064-3e5176a59401",
"machineId": "d6871ac4-6433-40c3-89e8-8853ce7f8571",
"status": "RUNNING",
"healthy": "HEALTHY"
},
@ -134,6 +140,7 @@
"name": "memcache_04",
"serviceId": "6d31aff4-de1e-4042-a983-fbd23d5c530c",
"deploymentGroupId": "e0ea0c02-55cc-45fe-8064-3e5176a59401",
"machineId": "d89612c8-0578-474a-b45d-98a1dcf6dd18",
"status": "RUNNING",
"healthy": "HEALTHY"
},
@ -142,6 +149,7 @@
"name": "memcache_05",
"serviceId": "6d31aff4-de1e-4042-a983-fbd23d5c530c",
"deploymentGroupId": "e0ea0c02-55cc-45fe-8064-3e5176a59401",
"machineId": "3a9fbaf8-722b-463a-86bd-8d3afe0dd759",
"status": "RUNNING",
"healthy": "HEALTHY"
},
@ -150,6 +158,7 @@
"name": "nginx",
"serviceId": "081a792c-47e0-4439-924b-2efa9788ae9e",
"deploymentGroupId": "e0ea0c02-55cc-45fe-8064-3e5176a59401",
"machineId": "76fe79b8-356b-408d-9089-93c87abdbe93",
"status": "RUNNING",
"healthy": "HEALTHY"
},
@ -158,6 +167,7 @@
"name": "percona-primary",
"serviceId": "4ee4103e-1a52-4099-a48e-01588f597c70",
"deploymentGroupId": "e0ea0c02-55cc-45fe-8064-3e5176a59401",
"machineId": "bd57fbf6-f80a-4d59-a6cd-ab3e41813796",
"status": "RUNNING",
"healthy": "UNHEALTHY"
},
@ -166,6 +176,7 @@
"name": "percona-secondary",
"serviceId": "4ee4103e-1a52-4099-a48e-01588f597c70",
"deploymentGroupId": "e0ea0c02-55cc-45fe-8064-3e5176a59401",
"machineId": "54f56455-3b0c-4e79-882c-ff28b517d2b9",
"status": "RUNNING",
"healthy": "HEALTHY"
}

View File

@ -0,0 +1,840 @@
const test = require('ava');
const gql = require('graphql-tag');
const { readFile } = require('mz/fs');
const path = require('path');
const execa = require('execa');
const wait = require('delay');
const {
default: ApolloClient,
createNetworkInterface
} = require('apollo-client');
let port = 3000;
const fetchTag = file =>
readFile(path.join(__dirname, `tags/${file}.gql`), 'utf-8');
const getClient = () =>
new Promise((resolve, reject) => {
const server = execa('node', ['.'], {
stdio: 'pipe',
cwd: path.join(__dirname, '..'),
env: {
PORT: (port += 1)
}
});
const client = new ApolloClient({
networkInterface: createNetworkInterface({
uri: `http://localhost:${port}/api/graphql`
})
});
const close = () => {
client.resetStore();
};
server.stdout.on('data', d => {
if (/server started at /.test(d)) {
resolve(client);
}
});
server.stdout.pipe(process.stdout);
server.stderr.pipe(process.stderr);
});
test('should return everything', async t => {
const client = await getClient();
const res = await client.query({
fetchPolicy: 'network-only',
query: gql(await fetchTag('all'))
});
t.snapshot(JSON.stringify(res.data, null, 2));
});
test('should return only Portal', async t => {
const client = await getClient();
const res = await client.query({
fetchPolicy: 'network-only',
query: gql(await fetchTag('portal-only'))
});
t.snapshot(JSON.stringify(res.data, null, 2));
});
test("should return DeploymentGroup's", async t => {
const client = await getClient();
const dgs = await client.query({
fetchPolicy: 'network-only',
query: gql(await fetchTag('deployment-groups'))
});
const dgsDirect = await client.query({
fetchPolicy: 'network-only',
query: gql(await fetchTag('deployment-groups-direct'))
});
t.snapshot(JSON.stringify(dgs.data, null, 2));
t.snapshot(JSON.stringify(dgsDirect.data, null, 2));
});
test("should return filtered DeploymentGroup's", async t => {
const client = await getClient();
const dgs = await client.query({
fetchPolicy: 'network-only',
query: gql(await fetchTag('deployment-groups-filtered')),
variables: {
slug: 'wordpress-blog-example'
}
});
const dgsDirect = await client.query({
fetchPolicy: 'network-only',
query: gql(await fetchTag('deployment-groups-direct-filtered')),
variables: {
slug: 'wordpress-blog-example'
}
});
t.snapshot(JSON.stringify(dgs.data, null, 2));
t.snapshot(JSON.stringify(dgsDirect.data, null, 2));
});
test('should return services', async t => {
const client = await getClient();
const services = await client.query({
fetchPolicy: 'network-only',
query: gql(await fetchTag('services'))
});
const servicesDirect = await client.query({
fetchPolicy: 'network-only',
query: gql(await fetchTag('services-direct'))
});
t.snapshot(JSON.stringify(services.data, null, 2));
t.snapshot(JSON.stringify(servicesDirect.data, null, 2));
});
test('should return filtered services', async t => {
const client = await getClient();
const services = await client.query({
fetchPolicy: 'network-only',
query: gql(await fetchTag('services-filtered')),
variables: {
dgSlug: 'wordpress-blog-example',
sSlug: 'nginx'
}
});
const servicesDirect = await client.query({
fetchPolicy: 'network-only',
query: gql(await fetchTag('services-direct-filtered')),
variables: {
sSlug: 'nginx'
}
});
t.snapshot(JSON.stringify(services.data, null, 2));
t.snapshot(JSON.stringify(servicesDirect.data, null, 2));
});
test('should return instances', async t => {
const client = await getClient();
const instances = await client.query({
fetchPolicy: 'network-only',
query: gql(await fetchTag('instances'))
});
const instancesDirect = await client.query({
fetchPolicy: 'network-only',
query: gql(await fetchTag('instances-direct'))
});
t.snapshot(JSON.stringify(instances.data, null, 2));
t.snapshot(JSON.stringify(instancesDirect.data, null, 2));
});
test('should return filtered instances', async t => {
const client = await getClient();
const instances = await client.query({
fetchPolicy: 'network-only',
query: gql(await fetchTag('instances-filtered')),
variables: {
dgSlug: 'cpexample',
sSlug: 'mysql',
iName: 'mysql-2',
biName: 'mysql-1'
}
});
const instancesDirect = await client.query({
fetchPolicy: 'network-only',
query: gql(await fetchTag('instances-direct-filtered')),
variables: {
dgSlug: 'cpexample',
sSlug: 'mysql',
iName: 'mysql-2',
biName: 'mysql-1'
}
});
t.snapshot(JSON.stringify(instances.data, null, 2));
t.snapshot(JSON.stringify(instancesDirect.data, null, 2));
});
test('should create DeploymentGroup', async t => {
const client = await getClient();
const created = await client.mutate({
fetchPolicy: 'network-only',
mutation: gql(await fetchTag('create-deployment-group')),
variables: {
name: 'test'
}
});
const dgs = await client.query({
fetchPolicy: 'network-only',
query: gql(await fetchTag('deployment-groups'))
});
const dgsDirect = await client.query({
fetchPolicy: 'network-only',
query: gql(await fetchTag('deployment-groups-direct'))
});
const fDgs = await client.query({
fetchPolicy: 'network-only',
query: gql(await fetchTag('deployment-groups-filtered')),
variables: {
slug: 'test'
}
});
const fDgsDirect = await client.query({
fetchPolicy: 'network-only',
query: gql(await fetchTag('deployment-groups-direct-filtered')),
variables: {
slug: 'test'
}
});
t.snapshot(JSON.stringify(created.data, null, 2));
t.snapshot(JSON.stringify(dgs.data, null, 2));
t.snapshot(JSON.stringify(dgsDirect.data, null, 2));
t.snapshot(JSON.stringify(fDgs.data, null, 2));
t.snapshot(JSON.stringify(fDgsDirect.data, null, 2));
});
test('should delete DeploymentGroup', async t => {
const client = await getClient();
const created = await client.mutate({
fetchPolicy: 'network-only',
mutation: gql(await fetchTag('create-deployment-group')),
variables: {
name: 'test1'
}
});
const dgsBefore = await client.query({
fetchPolicy: 'network-only',
query: gql(await fetchTag('deployment-groups'))
});
const dgsDirectBefore = await client.query({
fetchPolicy: 'network-only',
query: gql(await fetchTag('deployment-groups-direct'))
});
const fDgsBefore = await client.query({
fetchPolicy: 'network-only',
query: gql(await fetchTag('deployment-groups-filtered')),
variables: {
slug: 'test1'
}
});
const fDgsDirectBefore = await client.query({
fetchPolicy: 'network-only',
query: gql(await fetchTag('deployment-groups-direct-filtered')),
variables: {
slug: 'test1'
}
});
t.snapshot(JSON.stringify(created.data, null, 2));
t.snapshot(JSON.stringify(dgsBefore.data, null, 2));
t.snapshot(JSON.stringify(dgsDirectBefore.data, null, 2));
t.snapshot(JSON.stringify(fDgsBefore.data, null, 2));
t.snapshot(JSON.stringify(fDgsDirectBefore.data, null, 2));
const deleted = await client.mutate({
fetchPolicy: 'network-only',
mutation: gql(await fetchTag('delete-deployment-group')),
variables: {
id: created.data.createDeploymentGroup.id
}
});
const dgsAfter = await client.query({
fetchPolicy: 'network-only',
query: gql(await fetchTag('deployment-groups'))
});
const dgsDirectAfter = await client.query({
fetchPolicy: 'network-only',
query: gql(await fetchTag('deployment-groups-direct'))
});
const fDgsAfter = await client.query({
fetchPolicy: 'network-only',
query: gql(await fetchTag('deployment-groups-filtered')),
variables: {
slug: 'test1'
}
});
const fDgsDirectAfter = await client.query({
fetchPolicy: 'network-only',
query: gql(await fetchTag('deployment-groups-direct-filtered')),
variables: {
slug: 'test1'
}
});
t.snapshot(JSON.stringify(dgsAfter.data, null, 2));
t.snapshot(JSON.stringify(dgsDirectAfter.data, null, 2));
t.snapshot(JSON.stringify(fDgsAfter.data, null, 2));
t.snapshot(JSON.stringify(fDgsDirectAfter.data, null, 2));
});
test('should provisionManifest', async t => {
const client = await getClient();
const dg = await client.mutate({
fetchPolicy: 'network-only',
mutation: gql(await fetchTag('create-deployment-group')),
variables: {
name: 'test2'
}
});
const provision = await client.mutate({
fetchPolicy: 'network-only',
mutation: gql(await fetchTag('provision-manifest')),
variables: {
deploymentGroupId: dg.data.createDeploymentGroup.id,
type: 'COMPOSE',
format: 'YAML',
environment: {},
files: [],
raw: `
redis:
image: redis:latest
`
}
});
const dgs = await client.query({
fetchPolicy: 'network-only',
query: gql(await fetchTag('deployment-groups-filtered')),
variables: {
slug: 'test2'
}
});
t.snapshot(JSON.stringify(dg.data, null, 2));
t.snapshot(JSON.stringify(provision.data, null, 2));
t.snapshot(JSON.stringify(dgs.data, null, 2));
});
test('should scale up', async t => {
const client = await getClient();
const dg = await client.mutate({
fetchPolicy: 'network-only',
mutation: gql(await fetchTag('create-deployment-group')),
variables: {
name: 'test3'
}
});
const provision = await client.mutate({
fetchPolicy: 'network-only',
mutation: gql(await fetchTag('provision-manifest')),
variables: {
deploymentGroupId: dg.data.createDeploymentGroup.id,
type: 'COMPOSE',
format: 'YAML',
environment: {},
files: [],
raw: `
redis:
image: redis:latest
`
}
});
const dgsBefore = await client.query({
fetchPolicy: 'network-only',
query: gql(await fetchTag('deployment-groups-filtered')),
variables: {
slug: 'test3'
}
});
const scale = await client.mutate({
fetchPolicy: 'network-only',
mutation: gql(await fetchTag('scale')),
variables: {
serviceId: dgsBefore.data.portal.deploymentGroups[0].services[0].id,
replicas: 10
}
});
await wait(3100);
const dgsAfter = await client.query({
fetchPolicy: 'network-only',
query: gql(await fetchTag('deployment-groups-filtered')),
variables: {
slug: 'test3'
}
});
t.snapshot(JSON.stringify(dg.data, null, 2));
t.snapshot(JSON.stringify(provision.data, null, 2));
t.snapshot(JSON.stringify(dgsBefore.data, null, 2));
t.snapshot(JSON.stringify(dgsAfter.data, null, 2));
});
test('should scale down', async t => {
const client = await getClient();
const dg = await client.mutate({
fetchPolicy: 'network-only',
mutation: gql(await fetchTag('create-deployment-group')),
variables: {
name: 'test4'
}
});
const provision = await client.mutate({
fetchPolicy: 'network-only',
mutation: gql(await fetchTag('provision-manifest')),
variables: {
deploymentGroupId: dg.data.createDeploymentGroup.id,
type: 'COMPOSE',
format: 'YAML',
environment: {},
files: [],
raw: `
redis:
image: redis:latest
`
}
});
const dgs = await client.query({
fetchPolicy: 'network-only',
query: gql(await fetchTag('deployment-groups-filtered')),
variables: {
slug: 'test4'
}
});
const scaleUp = await client.mutate({
fetchPolicy: 'network-only',
mutation: gql(await fetchTag('scale')),
variables: {
serviceId: dgs.data.portal.deploymentGroups[0].services[0].id,
replicas: 10
}
});
await wait(3100);
const dgsBefore = await client.query({
fetchPolicy: 'network-only',
query: gql(await fetchTag('deployment-groups-filtered')),
variables: {
slug: 'test4'
}
});
const scaleDown = await client.mutate({
fetchPolicy: 'network-only',
mutation: gql(await fetchTag('scale')),
variables: {
serviceId: dgs.data.portal.deploymentGroups[0].services[0].id,
replicas: 7
}
});
await wait(3100);
const dgsAfter = await client.query({
fetchPolicy: 'network-only',
query: gql(await fetchTag('deployment-groups-filtered')),
variables: {
slug: 'test4'
}
});
t.snapshot(JSON.stringify(dg.data, null, 2));
t.snapshot(JSON.stringify(provision.data, null, 2));
t.snapshot(JSON.stringify(dgs.data, null, 2));
t.snapshot(JSON.stringify(dgsBefore.data, null, 2));
t.snapshot(JSON.stringify(dgsAfter.data, null, 2));
});
test("should delete Service's", async t => {
const client = await getClient();
const dgsInitial = await client.query({
fetchPolicy: 'network-only',
query: gql(await fetchTag('deployment-groups-direct-filtered')),
variables: {
slug: 'test5'
}
});
const dg = await client.mutate({
fetchPolicy: 'network-only',
mutation: gql(await fetchTag('create-deployment-group')),
variables: {
name: 'test5'
}
});
const provision = await client.mutate({
fetchPolicy: 'network-only',
mutation: gql(await fetchTag('provision-manifest')),
variables: {
deploymentGroupId: dg.data.createDeploymentGroup.id,
type: 'COMPOSE',
format: 'YAML',
environment: {},
files: [],
raw: `
redis:
image: redis:latest
`
}
});
const dgsBefore = await client.query({
fetchPolicy: 'network-only',
query: gql(await fetchTag('deployment-groups-direct-filtered')),
variables: {
slug: 'test5'
}
});
const deleted = await client.mutate({
fetchPolicy: 'network-only',
mutation: gql(await fetchTag('delete-services')),
variables: {
ids: dgsBefore.data.deploymentGroups
.filter(({ id }) => id === dg.data.createDeploymentGroup.id)[0]
.services.map(({ id }) => id)
}
});
await wait(5100);
const dgsAfter = await client.query({
fetchPolicy: 'network-only',
query: gql(await fetchTag('deployment-groups-direct-filtered')),
variables: {
slug: 'test5'
}
});
t.snapshot(JSON.stringify(dgsInitial.data, null, 2));
t.snapshot(JSON.stringify(dg.data, null, 2));
t.snapshot(JSON.stringify(dgsBefore.data, null, 2));
t.snapshot(JSON.stringify(deleted.data, null, 2));
t.snapshot(JSON.stringify(dgsAfter.data, null, 2));
});
test("should restart Service's", async t => {
const client = await getClient();
const dgsInitial = await client.query({
fetchPolicy: 'network-only',
query: gql(await fetchTag('deployment-groups-direct-filtered')),
variables: {
slug: 'test6'
}
});
const dg = await client.mutate({
fetchPolicy: 'network-only',
mutation: gql(await fetchTag('create-deployment-group')),
variables: {
name: 'test6'
}
});
const provision = await client.mutate({
fetchPolicy: 'network-only',
mutation: gql(await fetchTag('provision-manifest')),
variables: {
deploymentGroupId: dg.data.createDeploymentGroup.id,
type: 'COMPOSE',
format: 'YAML',
environment: {},
files: [],
raw: `
redis:
image: redis:latest
`
}
});
const dgsBefore = await client.query({
fetchPolicy: 'network-only',
query: gql(await fetchTag('deployment-groups-direct-filtered')),
variables: {
slug: 'test6'
}
});
const restarted = await client.mutate({
fetchPolicy: 'network-only',
mutation: gql(await fetchTag('restart-services')),
variables: {
ids: dgsBefore.data.deploymentGroups
.filter(({ id }) => id === dg.data.createDeploymentGroup.id)[0]
.services.map(({ id }) => id)
}
});
const dgsWhile = await client.query({
fetchPolicy: 'network-only',
query: gql(await fetchTag('deployment-groups-direct-filtered')),
variables: {
slug: 'test6'
}
});
await wait(5100);
const dgsAfter = await client.query({
fetchPolicy: 'network-only',
query: gql(await fetchTag('deployment-groups-direct-filtered')),
variables: {
slug: 'test6'
}
});
t.snapshot(JSON.stringify(dgsInitial.data, null, 2));
t.snapshot(JSON.stringify(dg.data, null, 2));
t.snapshot(JSON.stringify(dgsBefore.data, null, 2));
t.snapshot(JSON.stringify(restarted.data, null, 2));
t.snapshot(JSON.stringify(dgsWhile.data, null, 2));
t.snapshot(JSON.stringify(dgsAfter.data, null, 2));
});
test("should stop Service's", async t => {
const client = await getClient();
const dgsInitial = await client.query({
fetchPolicy: 'network-only',
query: gql(await fetchTag('deployment-groups-direct-filtered')),
variables: {
slug: 'test7'
}
});
const dg = await client.mutate({
fetchPolicy: 'network-only',
mutation: gql(await fetchTag('create-deployment-group')),
variables: {
name: 'test7'
}
});
const provision = await client.mutate({
fetchPolicy: 'network-only',
mutation: gql(await fetchTag('provision-manifest')),
variables: {
deploymentGroupId: dg.data.createDeploymentGroup.id,
type: 'COMPOSE',
format: 'YAML',
environment: {},
files: [],
raw: `
redis:
image: redis:latest
`
}
});
const dgsBefore = await client.query({
fetchPolicy: 'network-only',
query: gql(await fetchTag('deployment-groups-direct-filtered')),
variables: {
slug: 'test7'
}
});
const stopped = await client.mutate({
fetchPolicy: 'network-only',
mutation: gql(await fetchTag('stop-services')),
variables: {
ids: dgsBefore.data.deploymentGroups
.filter(({ id }) => id === dg.data.createDeploymentGroup.id)[0]
.services.map(({ id }) => id)
}
});
const dgsWhile = await client.query({
fetchPolicy: 'network-only',
query: gql(await fetchTag('deployment-groups-direct-filtered')),
variables: {
slug: 'test7'
}
});
await wait(5100);
const dgsAfter = await client.query({
fetchPolicy: 'network-only',
query: gql(await fetchTag('deployment-groups-direct-filtered')),
variables: {
slug: 'test7'
}
});
t.snapshot(JSON.stringify(dgsInitial.data, null, 2));
t.snapshot(JSON.stringify(dg.data, null, 2));
t.snapshot(JSON.stringify(dgsBefore.data, null, 2));
t.snapshot(JSON.stringify(stopped.data, null, 2));
t.snapshot(JSON.stringify(dgsWhile.data, null, 2));
t.snapshot(JSON.stringify(dgsAfter.data, null, 2));
});
test("should start Service's", async t => {
const client = await getClient();
const dgsInitial = await client.query({
fetchPolicy: 'network-only',
query: gql(await fetchTag('deployment-groups-direct-filtered')),
variables: {
slug: 'test7'
}
});
const dg = await client.mutate({
fetchPolicy: 'network-only',
mutation: gql(await fetchTag('create-deployment-group')),
variables: {
name: 'test7'
}
});
const provision = await client.mutate({
fetchPolicy: 'network-only',
mutation: gql(await fetchTag('provision-manifest')),
variables: {
deploymentGroupId: dg.data.createDeploymentGroup.id,
type: 'COMPOSE',
format: 'YAML',
environment: {},
files: [],
raw: `
redis:
image: redis:latest
`
}
});
const dgsBeforeStop = await client.query({
fetchPolicy: 'network-only',
query: gql(await fetchTag('deployment-groups-direct-filtered')),
variables: {
slug: 'test7'
}
});
const stopped = await client.mutate({
fetchPolicy: 'network-only',
mutation: gql(await fetchTag('stop-services')),
variables: {
ids: dgsBeforeStop.data.deploymentGroups
.filter(({ id }) => id === dg.data.createDeploymentGroup.id)[0]
.services.map(({ id }) => id)
}
});
const dgsWhileStop = await client.query({
fetchPolicy: 'network-only',
query: gql(await fetchTag('deployment-groups-direct-filtered')),
variables: {
slug: 'test7'
}
});
await wait(5100);
const dgsAfterStop = await client.query({
fetchPolicy: 'network-only',
query: gql(await fetchTag('deployment-groups-direct-filtered')),
variables: {
slug: 'test7'
}
});
const started = await client.mutate({
fetchPolicy: 'network-only',
mutation: gql(await fetchTag('start-services')),
variables: {
ids: dgsBeforeStop.data.deploymentGroups
.filter(({ id }) => id === dg.data.createDeploymentGroup.id)[0]
.services.map(({ id }) => id)
}
});
const dgsWhileStart = await client.query({
fetchPolicy: 'network-only',
query: gql(await fetchTag('deployment-groups-direct-filtered')),
variables: {
slug: 'test7'
}
});
await wait(5100);
const dgsAfterStart = await client.query({
fetchPolicy: 'network-only',
query: gql(await fetchTag('deployment-groups-direct-filtered')),
variables: {
slug: 'test7'
}
});
t.snapshot(JSON.stringify(dgsInitial.data, null, 2));
t.snapshot(JSON.stringify(dg.data, null, 2));
t.snapshot(JSON.stringify(dgsBeforeStop.data, null, 2));
t.snapshot(JSON.stringify(stopped.data, null, 2));
t.snapshot(JSON.stringify(dgsWhileStop.data, null, 2));
t.snapshot(JSON.stringify(dgsAfterStop.data, null, 2));
t.snapshot(JSON.stringify(started.data, null, 2));
t.snapshot(JSON.stringify(dgsWhileStart.data, null, 2));
t.snapshot(JSON.stringify(dgsAfterStart.data, null, 2));
});

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,129 @@
query {
portal {
id
user {
id
firstName
lastName
email
login
}
datacenter {
id
name
region
}
deploymentGroups {
id
name
slug
services {
id
hash
name
slug
instances {
id
name
machineId
status
healthy
watches
jobs
}
connections
branches {
name
slug
instances {
id
name
machineId
status
healthy
watches
jobs
}
}
config {
id
environment {
id
name
value
}
image
labels {
id
name
value
}
ports
}
status
}
version {
id
manifest {
id
type
format
environment
files {
id
name
value
}
raw
}
scale {
id
serviceName
replicas
}
plan {
id
type
service
toProcess
processed
machines
}
hasPlan
error
}
history {
id
manifest {
id
type
format
environment
files {
id
name
value
}
raw
}
scale {
id
serviceName
replicas
}
plan {
id
type
service
toProcess
processed
machines
}
hasPlan
error
}
imported
status
}
}
}

View File

@ -0,0 +1,114 @@
mutation createDeploymentGroup($name: String!) {
createDeploymentGroup(name: $name) {
id
name
slug
services {
id
hash
name
slug
instances {
id
name
machineId
status
healthy
watches
jobs
}
connections
branches {
name
slug
instances {
id
name
machineId
status
healthy
watches
jobs
}
}
config {
id
environment {
id
name
value
}
image
labels {
id
name
value
}
ports
}
status
}
version {
id
manifest {
id
type
format
environment
files {
id
name
value
}
raw
}
scale {
id
serviceName
replicas
}
plan {
id
type
service
toProcess
processed
machines
}
hasPlan
error
}
history {
id
manifest {
id
type
format
environment
files {
id
name
value
}
raw
}
scale {
id
serviceName
replicas
}
plan {
id
type
service
toProcess
processed
machines
}
hasPlan
error
}
imported
status
}
}

View File

@ -0,0 +1,5 @@
mutation deleteDeploymentGroup($id: ID!) {
deleteDeploymentGroup(id: $id) {
id
}
}

View File

@ -0,0 +1,5 @@
mutation deleteServices($ids: [ID]!) {
deleteServices(ids: $ids) {
id
}
}

View File

@ -0,0 +1,27 @@
query DeploymentGroups($slug: String!) {
deploymentGroups(slug: $slug) {
id
name
slug
services {
id
name
status
slug
instances {
id
name
status
}
branches {
id
name
slug
instances {
id
name
}
}
}
}
}

View File

@ -0,0 +1,27 @@
query {
deploymentGroups {
id
name
slug
services {
id
name
status
slug
instances {
id
name
status
}
branches {
id
name
slug
instances {
id
name
}
}
}
}
}

View File

@ -0,0 +1,30 @@
query DeploymentGroups($slug: String!) {
portal {
id
deploymentGroups(slug: $slug) {
id
name
slug
services {
id
name
status
slug
instances {
id
name
status
}
branches {
id
name
slug
instances {
id
name
}
}
}
}
}
}

View File

@ -0,0 +1,9 @@
query {
portal {
id
deploymentGroups {
id
slug
}
}
}

View File

@ -0,0 +1,6 @@
query DeploymentGroups($iName: String!) {
instances(name: $iName) {
id
name
}
}

View File

@ -0,0 +1,6 @@
query {
instances {
id
name
}
}

View File

@ -0,0 +1,32 @@
query DeploymentGroups(
$dgSlug: String!
$sSlug: String!
$iName: String!
$biName: String!
) {
portal {
id
deploymentGroups(slug: $dgSlug) {
id
name
slug
services(slug: $sSlug) {
id
name
slug
instances(name: $iName) {
id
name
}
branches {
name
slug
instances(name: $biName) {
id
name
}
}
}
}
}
}

View File

@ -0,0 +1,28 @@
query {
portal {
id
deploymentGroups {
id
name
slug
services {
id
name
slug
instances {
id
name
}
branches {
id
name
slug
instances {
id
name
}
}
}
}
}
}

View File

@ -0,0 +1,5 @@
query {
portal {
id
}
}

View File

@ -0,0 +1,19 @@
mutation provisionManifest(
$deploymentGroupId: ID!
$type: ManifestType!
$format: ManifestFormat!
$environment: String!
$files: [KeyValueInput]!
$raw: String!
) {
provisionManifest(
deploymentGroupId: $deploymentGroupId
type: $type
format: $format
environment: $environment
files: $files
raw: $raw
) {
id
}
}

View File

@ -0,0 +1,5 @@
mutation restartServices($ids: [ID]!) {
restartServices(ids: $ids) {
id
}
}

View File

@ -0,0 +1,11 @@
mutation scale(
$serviceId: ID!
$replicas: Int!
) {
scale(
serviceId: $serviceId
replicas: $replicas
) {
id
}
}

View File

@ -0,0 +1,12 @@
query DeploymentGroups($sSlug: String!) {
services(slug: $sSlug) {
id
name
slug
branches {
id
name
slug
}
}
}

View File

@ -0,0 +1,12 @@
query {
services {
id
name
slug
branches {
id
name
slug
}
}
}

View File

@ -0,0 +1,19 @@
query DeploymentGroups($dgSlug: String!, $sSlug: String!) {
portal {
id
deploymentGroups(slug: $dgSlug) {
id
name
slug
services(slug: $sSlug) {
id
name
slug
branches {
name
slug
}
}
}
}
}

View File

@ -0,0 +1,20 @@
query {
portal {
id
deploymentGroups {
id
name
slug
services {
id
name
slug
branches {
id
name
slug
}
}
}
}
}

View File

@ -0,0 +1,5 @@
mutation startServices($ids: [ID]!) {
startServices(ids: $ids) {
id
}
}

View File

@ -0,0 +1,5 @@
mutation stopServices($ids: [ID]!) {
stopServices(ids: $ids) {
id
}
}

View File

@ -51,8 +51,8 @@ type ConvergenceAction {
id: ID!
type: ConvergenceActionType!
service: String! # service name
toProcess: Int, # merely used for book keeping
processed: [String], # merely used for book keeping
toProcess: Int # merely used for book keeping
processed: [String] # merely used for book keeping
machines: [String]! # current instance machine ids
}
@ -171,7 +171,7 @@ type Instance {
id: ID!
name: String!
machineId: ID!
status: InstanceStatus!
status: InstanceStatus
healthy: HealthyStatus
watches: [String]
jobs: [String]
@ -179,7 +179,6 @@ type Instance {
type Datacenter {
id: ID!
url: String!
name: String!
region: String!
}
@ -193,22 +192,56 @@ type Query {
deploymentGroup(id: ID, name: String, slug: String): DeploymentGroup
serviceScales(serviceName: String, versionId: ID): [ServiceScale]
serviceScale(id: ID!): ServiceScale
convergenceActions(type: ConvergenceActionType, service: String, versionId: ID): [ConvergenceAction]
convergenceActions(
type: ConvergenceActionType
service: String
versionId: ID
): [ConvergenceAction]
convergenceAction(id: ID!): ConvergenceAction
versions(manifestId: ID, deploymentGroupId: ID): [Version]
version(id: ID, manifestId: ID): Version
manifests(type: String, deploymentGroupId: ID): [Manifest]
manifest(id: ID!): Manifest
services(name: String, slug: String, parentId: ID, deploymentGroupId: ID, deploymentGroupSlug: String): [Service]
services(
name: String
slug: String
parentId: ID
deploymentGroupId: ID
deploymentGroupSlug: String
): [Service]
service(id: ID, hash: ID): Service
packages(name: String, type: String, memory: Int, disk: Int, swap: Int, lwps: Int, vcpus: Int, version: String, group: String): [Package]
packages(
name: String
type: String
memory: Int
disk: Int
swap: Int
lwps: Int
vcpus: Int
version: String
group: String
): [Package]
package(id: ID!): Package
instances(name: String!, machineId: ID, status: InstanceStatus, serviceId: ID, serviceSlug: String, deploymentGroupId: ID, deploymentGroupSlug: String): [Instance]
instances(
name: String
machineId: ID
status: InstanceStatus
serviceId: ID
serviceSlug: String
deploymentGroupId: ID
deploymentGroupSlug: String
): [Instance]
instance(id: ID!): Instance
datacenter(id: ID, region: String): Datacenter
datacenters: [Datacenter]
config(deploymentGroupName: String!, type: ManifestType!, format: ManifestFormat!, environment: String!, files: [KeyValueInput]!, raw: String!): [Service]
config(
deploymentGroupName: String!
type: ManifestType!
format: ManifestFormat!
environment: String!
files: [KeyValueInput]!
raw: String!
): [Service]
importableDeploymentGroups: [DeploymentGroup]
}
@ -216,19 +249,22 @@ type Mutation {
createDeploymentGroup(name: String!): DeploymentGroup
updateDeploymentGroup(id: ID!, name: String!): DeploymentGroup
deleteDeploymentGroup(id: ID!): DeploymentGroup
provisionManifest(deploymentGroupId: ID!, type: ManifestType!, format: ManifestFormat!, environment: String!, files: [KeyValueInput]!, raw: String!): Version
provisionManifest(
deploymentGroupId: ID!
type: ManifestType!
format: ManifestFormat!
environment: String!
files: [KeyValueInput]!
raw: String!
): Version
scale(serviceId: ID!, replicas: Int!): Version
stopServices(ids: [ID]!): [Service]
startServices(ids: [ID]!): [Service]
restartServices(ids: [ID]!): [Service]
deleteServices(ids: [ID]!): [Service]
stopInstances(ids: [ID]!): [Instance]
startInstances(ids: [ID]!): [Instance]
restartInstances(ids: [ID]!): [Instance]
importDeploymentGroup(deploymentGroupSlug: String!): DeploymentGroup
deleteDeploymentGroup(id: ID!): DeploymentGroup
}

View File

@ -38,7 +38,7 @@
"lodash.isundefined": "^3.0.1"
},
"devDependencies": {
"ava": "0.19.1",
"ava": "^0.21.0",
"babel-plugin-istanbul": "^4.1.4",
"babel-preset-env": "^1.5.2",
"babel-register": "^6.24.1",
@ -46,7 +46,7 @@
"cross-env": "^5.0.1",
"eslint": "^3.19.0",
"eslint-config-joyent-portal": "2.0.0",
"nyc": "^11.0.2",
"nyc": "^11.0.3",
"redrun": "^5.9.15",
"tap-xunit": "^1.7.0"
},

View File

@ -40,7 +40,7 @@
"yaml-ast-parser": "0.0.33"
},
"devDependencies": {
"ava": "0.19.1",
"ava": "^0.21.0",
"babel-plugin-istanbul": "^4.1.4",
"babel-preset-env": "^1.5.2",
"babel-register": "^6.24.1",
@ -48,7 +48,7 @@
"cross-env": "^5.0.1",
"eslint": "^3.19.0",
"eslint-config-joyent-portal": "2.0.0",
"nyc": "^11.0.2",
"nyc": "^11.0.3",
"redrun": "^5.9.15",
"tap-xunit": "^1.7.0"
},

View File

@ -28,7 +28,7 @@
"lodash.flatten": "^4.4.0"
},
"devDependencies": {
"ava": "0.19.1",
"ava": "^0.21.0",
"babel-plugin-istanbul": "^4.1.4",
"babel-plugin-transform-es2015-arrow-functions": "^6.22.0",
"babel-plugin-transform-es2015-parameters": "^6.24.1",
@ -39,7 +39,7 @@
"cross-env": "^5.0.1",
"eslint": "^3.19.0",
"eslint-config-joyent-portal": "2.0.0",
"nyc": "^11.0.2",
"nyc": "^11.0.3",
"tap-xunit": "^1.7.0"
},
"nyc": {

View File

@ -24,7 +24,7 @@
"random-natural": "^1.0.3"
},
"devDependencies": {
"ava": "0.19.1",
"ava": "^0.21.0",
"babel-plugin-istanbul": "^4.1.4",
"babel-plugin-transform-es2015-arrow-functions": "^6.22.0",
"babel-plugin-transform-es2015-template-literals": "^6.22.0",
@ -34,7 +34,7 @@
"eslint": "^3.19.0",
"eslint-config-joyent-portal": "2.0.0",
"lodash.uniq": "^4.5.0",
"nyc": "^11.0.2",
"nyc": "^11.0.3",
"tap-xunit": "^1.7.0"
},
"nyc": {

View File

@ -27,7 +27,7 @@
"prepublish": "redrun build"
},
"devDependencies": {
"ava": "0.19.1",
"ava": "^0.21.0",
"babel-plugin-istanbul": "^4.1.4",
"babel-plugin-transform-es2015-arrow-functions": "^6.22.0",
"babel-plugin-transform-es2015-parameters": "^6.24.1",
@ -38,7 +38,7 @@
"cross-env": "^5.0.1",
"eslint": "^3.19.0",
"eslint-config-joyent-portal": "2.0.0",
"nyc": "^11.0.2",
"nyc": "^11.0.3",
"react": "^15.6.1",
"redrun": "^5.9.15",
"styled-components": "^2.1.0",

View File

@ -31,7 +31,7 @@
"remcalc": "^1.0.8"
},
"devDependencies": {
"ava": "0.19.1",
"ava": "^0.21.0",
"babel-plugin-istanbul": "^4.1.4",
"babel-plugin-transform-es2015-arrow-functions": "^6.22.0",
"babel-plugin-transform-es2015-parameters": "^6.24.1",
@ -41,7 +41,7 @@
"cross-env": "^5.0.1",
"eslint": "^3.19.0",
"eslint-config-joyent-portal": "2.0.0",
"nyc": "^11.0.2",
"nyc": "^11.0.3",
"tap-xunit": "^1.7.0"
},
"nyc": {

534
yarn.lock

File diff suppressed because it is too large Load Diff