Skip to content

Commit 4683fb3

Browse files
CLDSRV-740: Test healthcheck s3 internal route S3C
1 parent 0646251 commit 4683fb3

File tree

3 files changed

+38
-5
lines changed

3 files changed

+38
-5
lines changed

.github/docker/config.s3c.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
"clusters": 5,
2323
"kmsHideScalityArn": true,
2424
"healthChecks": {
25-
"allowFrom": ["127.0.0.1", "::1"]
25+
"allowFrom": ["127.0.0.1", "::1"],
26+
"enableInternalRoute": true
2627
},
2728
"localCache": {
2829
"host": "localhost",

.github/workflows/tests.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -574,6 +574,13 @@ jobs:
574574
run: |-
575575
set -o pipefail;
576576
yarn run ft_backbeat | tee /tmp/artifacts/${{ matrix.job-name }}/ft_backbeat.log
577+
- name: Run healthchecks tests
578+
env:
579+
S3_CONFIG_FILE: ${{ github.workspace }}/.github/docker/config.s3c.json
580+
S3_LOCATION_FILE: ${{ github.workspace }}/tests/locationConfig/locationConfigS3C.json
581+
run: |-
582+
set -o pipefail;
583+
yarn run ft_healthchecks | tee /tmp/artifacts/${{ matrix.job-name }}/ft_healthchecks.log
577584
- name: Teardown CI services
578585
run: docker compose down redis sproxyd metadata-standalone vault-sse-before-migration cloudserver-sse-before-migration
579586
working-directory: .github/docker

tests/functional/healthchecks/test/checkRoutes.js

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@ const async = require('async');
88
const Redis = require('ioredis');
99

1010
const conf = require('../../config.json');
11+
const { config } = require('../../../../lib/Config');
1112

1213
const redis = new Redis({
13-
host: conf.localCache.host,
14-
port: conf.localCache.port,
14+
host: config.localCache.host,
15+
port: config.localCache.port,
1516
// disable offline queue
1617
enableOfflineQueue: false,
1718
});
@@ -23,7 +24,7 @@ const transport = transportStr === 'http' ? http : https;
2324
const options = {
2425
host: conf.ipAddress,
2526
path: '/live',
26-
port: 8002,
27+
port: config.metricsPort || 8002,
2728
};
2829

2930
function checkResult(expectedStatus, res) {
@@ -55,7 +56,7 @@ function makeDummyS3Request(cb) {
5556
const getOptions = deepCopy(options);
5657
getOptions.path = '/foo/bar';
5758
getOptions.method = 'GET';
58-
getOptions.port = 8000;
59+
getOptions.port = config.port || 8000;
5960
getOptions.agent = makeAgent();
6061
const req = transport.request(getOptions);
6162
req.end(() => cb());
@@ -106,6 +107,30 @@ describe('Healthcheck routes', () => {
106107
});
107108
});
108109

110+
if (config.healthChecks.enableInternalRoute) {
111+
describe('Healthcheck s3 port internal routes', () => {
112+
it('should return 200 OK on GET request', done => {
113+
const getOptions = deepCopy(options);
114+
getOptions.method = 'GET';
115+
getOptions.path = '/_/healthcheck';
116+
getOptions.port = config.port || 8000;
117+
getOptions.agent = makeAgent();
118+
const req = transport.request(getOptions, makeChecker(200, done));
119+
req.end();
120+
});
121+
122+
it('should return 200 on deep GET request', done => {
123+
const deepOptions = deepCopy(options);
124+
deepOptions.method = 'GET';
125+
deepOptions.path = '/_/healthcheck/deep';
126+
deepOptions.port = config.port || 8000;
127+
deepOptions.agent = makeAgent();
128+
const req = transport.request(deepOptions, makeChecker(200, done));
129+
req.end();
130+
});
131+
});
132+
}
133+
109134
describe('Healthcheck stats', () => {
110135
const totalReqs = 5;
111136
beforeEach(done => {

0 commit comments

Comments
 (0)