From bea7540ef5bd18620720cbf3af24c70d6c83e87f Mon Sep 17 00:00:00 2001 From: Toby Corbin Date: Mon, 17 Feb 2020 13:49:32 +0000 Subject: [PATCH 1/2] release 0.3.0 Signed-off-by: Toby Corbin --- README.md | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 27d1259..4c16d62 100644 --- a/README.md +++ b/README.md @@ -191,7 +191,7 @@ This module adopts the [Module Long Term Support (LTS)](http://github.com/CloudN | V2.x.x | Jun 2018 | Dec 2019 | | Current | ## Version -0.1.0 +0.3.0 ## License diff --git a/package.json b/package.json index 6ff949c..738b2df 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "appmetrics-codewind", - "version": "0.2.0", + "version": "0.3.0", "description": "Provides a /metrics endpoints for Application Metrics", "main": "index.js", "dependencies": { From 8cd81d9bd0e7e89ab655e13f08593f38aaab265c Mon Sep 17 00:00:00 2001 From: Toby Corbin Date: Mon, 17 Feb 2020 13:51:54 +0000 Subject: [PATCH 2/2] remove obsolete test Signed-off-by: Toby Corbin --- test/test-attach-appmetrics-dash-socket-io.js | 112 ------------------ 1 file changed, 112 deletions(-) delete mode 100644 test/test-attach-appmetrics-dash-socket-io.js diff --git a/test/test-attach-appmetrics-dash-socket-io.js b/test/test-attach-appmetrics-dash-socket-io.js deleted file mode 100644 index afd61da..0000000 --- a/test/test-attach-appmetrics-dash-socket-io.js +++ /dev/null @@ -1,112 +0,0 @@ -/******************************************************************************* - * Copyright 2017 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *******************************************************************************/ -'use strict'; - -const debug = require('debug')('appmetrics-codewind:test'); -const express = require('express'); -const http = require('http'); -const request = require('request'); -const tap = require('tap'); -const util = require('util'); - -const config = require('./config'); - -require('..').attach(); - -const app = express(); -const server = http.createServer(app); -const io = require('socket.io')(server); - -require('appmetrics-dash').monitor({server, app}); - -io.on('connection', function(socket) { - socket.on('hello', function() { - socket.emit('farewell'); - }); -}); - -app.get('*', (req, res) => { - res.status(404).send('Not Found'); -}); - -server.listen(0, '127.0.0.1'); - -let base; - -tap.test('start', function(t) { - server.on('listening', function() { - const port = this.address().port; - let addr = this.address().address; - if (addr === '0.0.0.0') - addr = '127.0.0.1'; - if (addr === '::') - addr = '[::1]'; - base = util.format('http://%s:%s', addr, port); - t.pass('listened'); - t.end(); - }); -}); - -tap.test('/metrics available', function(t) { - const options = { - url: base + '/metrics', - }; - debug('request %j', options); - request(options, function(err, resp, body) { - t.ifError(err); - config.expectedMetrics.forEach(metricName => { - t.similar(body, metricName); - }); - t.end(); - }); -}); - -tap.test('collections API available', function(t) { - const options = { - url: base + '/appmetrics/api/v1/collections', - }; - debug('request %j', options); - request(options, function(err, resp, body) { - t.ifError(err); - t.equal(body, '{"collectionUris":[]}'); - t.end(); - }); -}); - -tap.test('appmetrics-dash websocket responds', function(t) { - const io = require('socket.io-client').connect(base, { - path: '/appmetrics-dash/socket.io' - }); - - io.on('connect', function() { - io.emit('connected'); - io.emit('enableprofiling'); - io.emit('disableprofiling'); - io.emit('nodereport'); - io.emit('heapdump'); - io.on('gc', disconnect); - }); - - function disconnect() { - io.disconnect(); - } - - io.on('disconnect', t.end); -}); - -tap.test('stop', function(t) { - server.close(t.end); -});