Skip to content

Commit

Permalink
Merge pull request #54 from hpcc-systems/eas-service-check
Browse files Browse the repository at this point in the history
Eas service check
  • Loading branch information
martdo02 authored Aug 31, 2023
2 parents 4fda1b5 + 459a01a commit d9a0239
Show file tree
Hide file tree
Showing 11 changed files with 2,043 additions and 11,752 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ passwords.txt

# .tfstate files
*.tfstate
*.tfstate.*
*.tfstate.*
*.log
13,753 changes: 2,010 additions & 11,743 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"chai": "^4.3.4"
},
"devDependencies": {
"@cucumber/cucumber": "^9.3.0",
"@cucumber/cucumber": "^9.0.0",
"@ln-maf/core": "^2.0.1",
"@ln-maf/validations": "file:../validations",
"eslint": "^8.18.0",
Expand Down
4 changes: 4 additions & 0 deletions packages/aws/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,10 @@ If a queue name is used, a regex search will be done to find the queue.

## AWS ECS Step Definitions

### `When at least one task is running for service {string} in cluster {string}`

Checks if the service in a cluster has at least one task running on ecs

### `When ecs taskDefinition {string} exists`
### `When ecs taskDefinition {string} does not exist`

Expand Down
2 changes: 1 addition & 1 deletion packages/aws/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"@ln-maf/core": "*"
},
"devDependencies": {
"@cucumber/cucumber": "^9.3.0",
"@cucumber/cucumber": "^9.0.0",
"@ln-maf/core": "*",
"@ln-maf/validations": "^2.0.3",
"eslint": "^8.18.0",
Expand Down
21 changes: 20 additions & 1 deletion packages/aws/stepDefinitions/ecs.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const { setDefaultTimeout } = require('@cucumber/cucumber')
const { MAFWhen, performJSONObjectTransform, filltemplate } = require('@ln-maf/core')
const { ECSClient, ListTaskDefinitionsCommand, ListClustersCommand, RunTaskCommand, DescribeClustersCommand } = require('@aws-sdk/client-ecs')
const { ECSClient, ListTaskDefinitionsCommand, ListClustersCommand, RunTaskCommand, DescribeClustersCommand, DescribeServicesCommand } = require('@aws-sdk/client-ecs')

setDefaultTimeout(15 * 60 * 1000)

Expand Down Expand Up @@ -195,3 +195,22 @@ MAFWhen('perform ecs run-task:', async function (docString) {
MAFWhen('ecs run-task is performed', async function () {
return await ecsRunTask.call(this)
})

/**
* Check that at least one task for a service is running
*/
MAFWhen('at least one task is running for service {string} in cluster {string}', async function (serviceName, clusterName) {
serviceName = filltemplate(serviceName, this.results)
clusterName = filltemplate(clusterName, this.results)
const ecsClient = new ECSClient({ maxAttempts: 2 })
const res = await ecsClient.send(new DescribeServicesCommand({
cluster: clusterName,
services: [serviceName]
}))
if (res.services.length === 0) {
throw new Error('Can\'t find service ' + serviceName + ' in cluster ' + clusterName)
}
if (res.services[0].runningCount < 1) {
throw new Error('Service ' + serviceName + ' is not currently running in cluster ' + clusterName)
}
})
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
},
"homepage": "https://github.com/hpcc-systems/MAF#readme",
"devDependencies": {
"@cucumber/cucumber": "^9.3.0",
"@cucumber/cucumber": "^9.0.0",
"eslint": "^8.18.0",
"eslint-config-standard": "^17.0.0",
"eslint-plugin-import": "^2.26.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/defaultSQL/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"keytar": "7.*"
},
"devDependencies": {
"@cucumber/cucumber": "^9.3.0",
"@cucumber/cucumber": "^9.0.0",
"@ln-maf/core": "^2.0.1",
"@ln-maf/validations": "^2.0.1",
"eslint": "^8.18.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/mysql/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"@ln-maf/core": "*"
},
"devDependencies": {
"@cucumber/cucumber": "^9.3.0",
"@cucumber/cucumber": "^9.0.0",
"@ln-maf/core": "^2.0.1",
"eslint": "^8.18.0",
"eslint-config-standard": "^17.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/preprocessor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"@ln-maf/core": "*"
},
"devDependencies": {
"@cucumber/cucumber": "^9.3.0",
"@cucumber/cucumber": "^9.0.0",
"@ln-maf/core": "^2.0.1",
"@ln-maf/validations": "^2.0.1",
"eslint": "^8.18.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/validations/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"@ln-maf/core": "*"
},
"devDependencies": {
"@cucumber/cucumber": "^9.3.0",
"@cucumber/cucumber": "^9.0.0",
"@ln-maf/core": "^2.0.1",
"eslint": "^8.18.0",
"eslint-config-standard": "^17.0.0",
Expand Down

0 comments on commit d9a0239

Please sign in to comment.