Skip to content

Commit

Permalink
try
Browse files Browse the repository at this point in the history
  • Loading branch information
benzekrimaha committed Jan 3, 2025
1 parent b98a232 commit a743b35
Show file tree
Hide file tree
Showing 23 changed files with 37 additions and 37 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ jobs:
warpscript.maxops: '10000000'
ENABLE_SENSISION: 't'
options: >-
--health-cmd "curl localhost:4802/api/v0/check"
--health-cmd "curl 127.0.0.1:4802/api/v0/check"
--health-interval 10s
--health-timeout 5s
--health-retries 10
Expand Down Expand Up @@ -188,7 +188,7 @@ jobs:
- 8082:8082
- 9718:9718
options: >-
--health-cmd "curl localhost:4802/api/v0/check"
--health-cmd "curl 127.0.0.1:4802/api/v0/check"
--health-interval 10s
--health-timeout 5s
--health-retries 10
Expand All @@ -201,7 +201,7 @@ jobs:
- 8700:8700
- 8800:8800
options: >-
--health-cmd "curl http://localhost:8500/_/healthcheck"
--health-cmd "curl http://127.0.0.1:8500/_/healthcheck"
--health-interval 10s
--health-timeout 5s
--health-retries 10
Expand Down Expand Up @@ -309,7 +309,7 @@ jobs:
- 8082:8082
- 9718:9718
options: >-
--health-cmd "curl localhost:4802/api/v0/check"
--health-cmd "curl 127.0.0.1:4802/api/v0/check"
--health-interval 10s
--health-timeout 5s
--health-retries 10
Expand All @@ -322,7 +322,7 @@ jobs:
- 8700:8700
- 8800:8800
options: >-
--health-cmd "curl http://localhost:8500/_/healthcheck"
--health-cmd "curl http://127.0.0.1:8500/_/healthcheck"
--health-interval 10s
--health-timeout 5s
--health-retries 10
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ const { UtapiClient } = require('utapi');

const config = {
redis: {
host: 'localhost',
host: '127.0.0.1',
port: 6379
},
localCache: {
host: 'localhost',
host: '127.0.0.1',
port: 6379
}
}
Expand Down Expand Up @@ -276,7 +276,7 @@ deployment would be
```
node bin/list_metrics --metric buckets --buckets demo --start 1476231300000
--end 1476233099999 -a myAccessKey -k mySecretKey -h localhost -p 8100 --ssl
--end 1476233099999 -a myAccessKey -k mySecretKey -h 127.0.0.1 -p 8100 --ssl
```
Both start and end times are time expressed as UNIX epoch timestamps **expressed
Expand Down
2 changes: 1 addition & 1 deletion bin/ensureServiceUser
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ program.version(version);
].forEach(cmd => {
program
.command(cmd.name)
.option('--iam-endpoint <url>', 'IAM endpoint', 'http://localhost:8600')
.option('--iam-endpoint <url>', 'IAM endpoint', 'http://127.0.0.1:8600')
.option('--log-level <level>', 'log level', 'info')
.option('--log-dump-level <level>', 'log level that triggers a dump of the debug buffer', 'error')
.action(wrapAction.bind(null, cmd.actionFunc));
Expand Down
2 changes: 1 addition & 1 deletion images/warp10/s6/services.d/sensision-exporter/run
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/with-contenv sh

EXPORTER_CMD="warp10_sensision_exporter --warp10.url=http://localhost:${SENSISION_PORT}/metrics"
EXPORTER_CMD="warp10_sensision_exporter --warp10.url=http://127.0.0.1:${SENSISION_PORT}/metrics"

if [ -f "/usr/local/bin/warp10_sensision_exporter" -a -n "$ENABLE_SENSISION" ]; then
echo "Starting Sensision exporter with $EXPORTER_CMD ..."
Expand Down
2 changes: 1 addition & 1 deletion libV2/client/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class Uploader extends Transform {

class UtapiClient {
constructor(config) {
this._host = (config && config.host) || 'localhost';
this._host = (config && config.host) || '127.0.0.1';
this._port = (config && config.port) || '8100';
this._tls = (config && config.tls) || {};
this._transport = (config && config.tls) ? 'https' : 'http';
Expand Down
4 changes: 2 additions & 2 deletions libV2/config/defaults.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"repairSchedule": "0 */5 * * * *",
"reindexSchedule": "0 0 0 * * Sun",
"diskUsageSchedule": "0 */15 * * * *",
"bucketd": [ "localhost:9000" ],
"bucketd": [ "127.0.0.1:9000" ],
"reindex": {
"enabled": true,
"schedule": "0 0 0 * * 6"
Expand All @@ -57,7 +57,7 @@
},
"metrics" : {
"enabled": false,
"host": "localhost",
"host": "127.0.0.1",
"ingestPort": 10902,
"checkpointPort": 10903,
"snapshotPort": 10904,
Expand Down
2 changes: 1 addition & 1 deletion libV2/models/RequestContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const RequestContextModel = buildModel('RequestContext', contextSchema);

class RequestContext extends RequestContextModel {
constructor(request) {
const host = request.headers.host || 'localhost';
const host = request.headers.host || '127.0.0.1';
const protocol = RequestContext._determineProtocol(request);
const encrypted = protocol === 'https';
const url = `${protocol}://${host}${request.url}`;
Expand Down
2 changes: 1 addition & 1 deletion libV2/tasks/BaseTask.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class BaseTask extends Process {
this._defaultSchedule = Now;
this._defaultLag = 0;
this._enableMetrics = options.enableMetrics || false;
this._metricsHost = options.metricsHost || 'localhost';
this._metricsHost = options.metricsHost || '127.0.0.1';
this._metricsPort = options.metricsPort || 9001;
this._metricsHandlers = null;
this._probeServer = null;
Expand Down
2 changes: 1 addition & 1 deletion libV2/tasks/ManualAdjust.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class ManualAdjust extends BaseTask {
// Don't include default flags
await super._setup(false);
this._program
.option('-h, --host <host>', 'Utapi server host', 'localhost')
.option('-h, --host <host>', 'Utapi server host', '127.0.0.1')
.option('-p, --port <port>', 'Utapi server port', '8100', parseInt)
.option('-b, --bucket <buckets...>', 'target these buckets', collectArgs, [])
.option('-a, --account <accounts...>', 'target these accounts', collectArgs, [])
Expand Down
2 changes: 1 addition & 1 deletion libV2/warp10.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Warp10Client {
const proto = (config && config.tls) ? 'https' : 'http';
this._requestTimeout = (config && config.requestTimeout) || 30000;
this._connectTimeout = (config && config.connectTimeout) || 30000;
const host = (config && config.host) || 'localhost';
const host = (config && config.host) || '127.0.0.1';
const port = (config && config.port) || 4802;
this._client = new Warp10().endpoint(`${proto}://${host}:${port}`, this._requestTimeout, this._connectTimeout);
}
Expand Down
4 changes: 2 additions & 2 deletions tests/functional/server/testInvalidRequests.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe('Invalid requests', () => {
{
describe: 'should forbid a GET request ',
header: {
host: 'localhost',
host: '127.0.0.1',
port: 8100,
method: 'GET',
service: 's3',
Expand All @@ -30,7 +30,7 @@ describe('Invalid requests', () => {
{
describe: 'should forbid a GET request ',
header: {
host: 'localhost',
host: '127.0.0.1',
port: 8100,
method: 'GET',
service: 's3',
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/v2/server/testHealthcheck.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const needle = require('needle');

describe('Test healthcheck handler', () => {
it('should return true', async () => {
const res = await needle('get', 'http://localhost:8100/_/healthcheck');
const res = await needle('get', 'http://127.0.0.1:8100/_/healthcheck');
assert.strictEqual(res.statusCode, 200);
assert.strictEqual(res.statusMessage, 'OK');
});
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/v2/server/testIngestMetric.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const { generateFakeEvents } = require('../../../utils/v2Data');
function utapiRequest(events) {
return needle(
'post',
'http://localhost:8100/v2/ingest',
'http://127.0.0.1:8100/v2/ingest',
events,
);
}
Expand Down
6 changes: 3 additions & 3 deletions tests/functional/v2/server/testListMetrics.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,15 @@ async function listMetrics(level, resources, start, end, credentials) {
}

const headers = {
host: 'localhost',
host: '127.0.0.1',
port: 8100,
method: 'POST',
service: 's3',
path: `/${level}?Action=ListMetrics`,
headers: {
'Content-Type': 'application/json',
},
get: true;
};

const { accessKey: accessKeyId, secretKey: secretAccessKey } = credentials;
Expand All @@ -58,10 +59,9 @@ async function listMetrics(level, resources, start, end, credentials) {
};

const sig = aws4.sign(headers, _credentials);

return needle(
'post',
`http://localhost:8100/${level}?Action=ListMetrics`,
`http://127.0.0.1:8100/${level}?Action=ListMetrics`,

body,
{
Expand Down
6 changes: 3 additions & 3 deletions tests/functional/v2/server/testPrometheusMetrics.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ const testMetrics = async pair => {

describe('Test Prometheus Metrics', () => {
const nameUrlPairs = [
['utapi nodejs service exporter', 'http://localhost:8100/_/metrics'],
['sensision exporter', 'http://localhost:9718/metrics'],
['redis exporter', 'http://localhost:9121/metrics'],
['utapi nodejs service exporter', 'http://127.0.0.1:8100/_/metrics'],
['sensision exporter', 'http://127.0.0.1:9718/metrics'],
['redis exporter', 'http://127.0.0.1:9121/metrics'],
];
nameUrlPairs.forEach(pair => testMetrics(pair));
});
2 changes: 1 addition & 1 deletion tests/functional/v2/task/testBaseTask.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ describe('Test BaseTask metrics', () => {
it('should start a metrics server on the provided port', async () => {
const res = await needle(
'get',
`http://localhost:${METRICS_SERVER_PORT}${DEFAULT_METRICS_ROUTE}`,
`http://127.0.0.1:${METRICS_SERVER_PORT}${DEFAULT_METRICS_ROUTE}`,
);
const lines = res.body.split('\n');
const first = lines[0];
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/testUtapiClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const metricTypes = {
accountId: 'foo-account',
userId: 'foo-user',
};
const redisLocal = { host: 'localhost', port: 6379 };
const redisLocal = { host: '127.0.0.1', port: 6379 };
const config = {
redis: redisLocal,
localCache: redisLocal,
Expand Down
6 changes: 3 additions & 3 deletions tests/utils/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ function buildMockResponse({ start, end, val }) {

function makeUtapiClientRequest({ timeRange, resource }, cb) {
const header = {
host: 'localhost',
host: '127.0.0.1',
port: 8100,
method: 'POST',
service: 's3',
Expand All @@ -125,7 +125,7 @@ function makeUtapiClientRequest({ timeRange, resource }, cb) {

function makeUtapiGenericClientRequest(reqHeader, reqBody, cb) {
const header = Object.assign({
host: 'localhost',
host: '127.0.0.1',
port: 8100,
service: 's3',
}, reqHeader);
Expand Down Expand Up @@ -173,7 +173,7 @@ function _buildRequestBody(resource) {
function listMetrics(resource, cb) {
const requestBody = _buildRequestBody(resource);
const header = {
host: 'localhost',
host: '127.0.0.1',
port: 8100,
method: 'POST',
service: 's3',
Expand Down
2 changes: 1 addition & 1 deletion tests/utils/vaultclient.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ class VaultClient {
}

static getIAMClient(credentials) {
const endpoint = process.env.VAULT_ENDPOINT || 'http://localhost:8600';
const endpoint = process.env.VAULT_ENDPOINT || 'http://127.0.0.1:8600';
const info = {
endpoint,
sslEnabled: false,
Expand Down
2 changes: 1 addition & 1 deletion tests/utils/wait_for_local_port.bash
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ wait_for_local_port() {
local ret=1
echo "waiting for UtapiServer:$port"
while [[ "$ret" -eq "1" && "$count" -lt "$timeout" ]] ; do
nc -z -w 1 localhost $port
nc -z -w 1 127.0.0.1 $port
ret=$?
if [ ! "$ret" -eq "0" ]; then
echo -n .
Expand Down
2 changes: 1 addition & 1 deletion warpscript/utapi/getMetrics.mc2
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// @endpoint http://localhost:4802/api/v0/exec
// @endpoint http://127.0.0.1:4802/api/v0/exec

{
'name' 'utapi/getMetrics'
Expand Down
2 changes: 1 addition & 1 deletion warpscript/utapi/getMetricsAt.mc2
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// @endpoint http://localhost:4802/api/v0/exec
// @endpoint http://127.0.0.1:4802/api/v0/exec
{
'name' 'utapi/getMetricsAt'
'desc'
Expand Down
2 changes: 1 addition & 1 deletion warpscript/util/sumRecord.mc2
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// @endpoint http://localhost:4802/api/v0/exec
// @endpoint http://127.0.0.1:4802/api/v0/exec


{
Expand Down

0 comments on commit a743b35

Please sign in to comment.