From a05a1ae94129b4aff482c54bfff52bc0f9ec5abc Mon Sep 17 00:00:00 2001 From: Steffen Zull Date: Wed, 7 Feb 2018 11:56:35 +0100 Subject: [PATCH 1/3] Add special logging for integration tests --- .../backend/extensionRuntime/StepExecutor.js | 11 +++++++-- lib/logger.js | 23 +++++++++++++------ package.json | 2 +- 3 files changed, 26 insertions(+), 10 deletions(-) diff --git a/lib/app/backend/extensionRuntime/StepExecutor.js b/lib/app/backend/extensionRuntime/StepExecutor.js index 7a2746f5..5af65852 100644 --- a/lib/app/backend/extensionRuntime/StepExecutor.js +++ b/lib/app/backend/extensionRuntime/StepExecutor.js @@ -29,11 +29,18 @@ class StepExecutor { ignoreInitial: true } + const streams = [] + + if (process.env.INTEGRATION_TEST === 'true') { + streams.push({level: process.env.LOG_LEVEL || 'debug', stream: process.stdout}) + } else { + streams.push({stream: new LogStream(osLocale.sync().replace('_', '-')), type: 'raw', level: 'debug'}) + } + // Init special step logger with its own log level this.stepLogger = bunyan.createLogger({ name: '\u0008', - streams: [{stream: new LogStream(osLocale.sync().replace('_', '-')), type: 'raw', level: 'debug'}], - type: 'raw' + streams }) this.stepLogger.plain = console.log } diff --git a/lib/logger.js b/lib/logger.js index a7030c67..08c4351b 100644 --- a/lib/logger.js +++ b/lib/logger.js @@ -2,18 +2,27 @@ const bunyan = require('bunyan') const LogStream = require('./utils/logstream') const osLocale = require('os-locale') +const streams = [] + +if (process.env.INTEGRATION_TEST === 'true') { + streams.push({ + level: process.env.LOG_LEVEL || 'debug', + stream: process.stdout + }) +} else { + streams.push({ + level: process.env.LOG_LEVEL || 'info', + stream: new LogStream(osLocale.sync().replace('_', '-')), + type: 'raw' + }) +} + /** * @type {{trace:Function, debug:Function, info:Function, warn:Function, error:Function, child:Function, level:Function, levels:Function}} */ const logger = bunyan.createLogger({ name: '\u0008', - streams: [ - { - level: process.env.LOG_LEVEL || 'info', - stream: new LogStream(osLocale.sync().replace('_', '-')), - type: 'raw' - } - ] + streams }) logger.plain = console.log diff --git a/package.json b/package.json index c2e783f5..326fdeca 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@shopgate/platform-sdk", - "version": "1.2.2", + "version": "1.3.0", "description": "Shopgate's Platform SDK", "main": "index.js", "scripts": { From 9761bcd0ba37e3be3060da1a24eb4835372b44b1 Mon Sep 17 00:00:00 2001 From: Philipp Heyse Date: Thu, 8 Feb 2018 15:14:19 +0100 Subject: [PATCH 2/3] CLOUD-163 adapted travis ci to run integrational test --- .travis.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.travis.yml b/.travis.yml index 977d0906..778630e7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,11 +17,21 @@ matrix: before_script: - if [[ "$TRAVIS_NODE_VERSION" == "8" && "$TRAVIS_OS_NAME" == "linux" ]]; then npm run lint; fi - if [[ "$TRAVIS_NODE_VERSION" == "8" && "$TRAVIS_OS_NAME" == "linux" ]]; then npm run check; fi + - wget https://github.com/shopgate/connect-sdk-integration-test/archive/master.zip + - mkdir integration + - unzip master.zip -d integration + - cd integration/connect-sdk-integration-test-master + - npm i --no-package-lock + - cd ../../ install: - npm i --no-package-lock script: + - cd integration/connect-sdk-integration-test-master + - ls -la + - npm run test + - cd ../../ - if [[ "$TRAVIS_NODE_VERSION" == "8" && "$TRAVIS_OS_NAME" == "linux" ]]; then npm run cover; else npm t; fi after_script: From c045b402c6e4ee3070f3ff59782366da1b63b19c Mon Sep 17 00:00:00 2001 From: Philipp Heyse Date: Thu, 8 Feb 2018 15:34:57 +0100 Subject: [PATCH 3/3] CLOUD-163 travis preparation --- .travis.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 977d0906..d82a9061 100644 --- a/.travis.yml +++ b/.travis.yml @@ -29,7 +29,3 @@ after_script: notifications: email: false - -branches: - only: - - master \ No newline at end of file