Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Start doing the minimum in /status checks #2246

Merged
merged 4 commits into from
Aug 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions src/routes/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,11 @@

const healthRoutes = require('../modules/health/routes')

const pkg = require('../../package.json')
const { version } = pkg

module.exports = [
{
method: 'GET',
path: '/status',
handler: () => ({ version }),
handler: () => ({ status: 'alive' }),
config: { auth: false, description: 'Check service status' }
},
...Object.values(healthRoutes)
Expand Down
5 changes: 1 addition & 4 deletions src/routes/water.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ const taskConfigRoutes = require('../controllers/task-config')
const moduleRoutes = require('../modules/routes')
const arAnalysisLicencesRoutes = require('../controllers/ar-analysis-licences')

const pkg = require('../../package.json')
const { version } = pkg

module.exports = [
...sessionRoutes,
...eventsRoutes,
Expand All @@ -24,7 +21,7 @@ module.exports = [
{
method: 'GET',
path: '/status',
handler: () => ({ version }),
handler: () => ({ status: 'alive' }),
config: { auth: false, description: 'Check service status' }
}
]
6 changes: 4 additions & 2 deletions test/routes/background.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict'

const { server, start } = require('../../index-background')

const { experiment, test, beforeEach, before } = exports.lab = require('@hapi/lab').script()
Expand All @@ -19,7 +21,7 @@ experiment('/status (background)', () => {
expect(response.statusCode).to.equal(200)
})

test('responds with an object containing the application version', async () => {
expect(response.result.version).to.match(/\d*\.\d*\.\d*/g)
test('responds with an object containing the application status', async () => {
expect(response.result.status).to.equal('alive')
})
})
6 changes: 4 additions & 2 deletions test/routes/water.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict'

const { server, start } = require('../../index')

const { experiment, test, beforeEach, before } = exports.lab = require('@hapi/lab').script()
Expand All @@ -19,7 +21,7 @@ experiment('/status (water)', () => {
expect(response.statusCode).to.equal(200)
})

test('responds with an object containing the application version', async () => {
expect(response.result.version).to.match(/\d*\.\d*\.\d*/g)
test('responds with an object containing the application status', async () => {
expect(response.result.status).to.equal('alive')
})
})
Loading