Skip to content
This repository was archived by the owner on Jun 29, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
46d6840
Write local commands logs into log files
javierbrea Apr 25, 2018
a6c3bc6
Use different docker-compose start commands for each service
javierbrea Apr 26, 2018
b631754
Add abort-on-error configuration
javierbrea Apr 26, 2018
10ac904
Use wait-on inside Docker. Services can wait for other services, in d…
javierbrea Apr 27, 2018
8efd979
Remove wait-for-it.sh
javierbrea Apr 27, 2018
4fa12af
Add integration tests
javierbrea May 1, 2018
4a64efc
Add mocha and istanbul configuration integration tests
javierbrea May 1, 2018
663ecfb
Add foo api package for integration tests
javierbrea May 1, 2018
db9f9f4
Add end-to-end tests to foo-api package
javierbrea May 2, 2018
6e770a6
Add foo-api package docker tests
javierbrea May 2, 2018
88b2f21
Execute foo-api package tests as part of integration tests. Allow wai…
javierbrea May 3, 2018
47bcc4f
Adding integration tests. Add custom wait-on config for Docker execut…
javierbrea May 3, 2018
e5f2881
Copy Narval to foo _node_modules folder inside the foo packages and l…
javierbrea May 3, 2018
6f90161
Add environment variables integration tests
javierbrea May 3, 2018
8c0f33a
Stack traces in process logs until files are ready
javierbrea May 4, 2018
d94ecc6
Add integration tests
javierbrea May 4, 2018
a586cb2
Add integration tests
javierbrea May 4, 2018
de5654f
Add integration tests. Do not exit process inmediatly on error. Let i…
javierbrea May 4, 2018
be9e785
Add integration tests
javierbrea May 5, 2018
3bffeef
Execute only integration tests
javierbrea May 5, 2018
85cee67
Change coverage folder permissions
javierbrea May 5, 2018
6fff9f7
Merge branch 'integration-tests' into develop-integration-tests
javierbrea May 5, 2018
0101df1
Debug docker created file permissions on travis
javierbrea May 5, 2018
f82027f
Exclude foo packages used in integration tests from Sonar analysis. E…
javierbrea May 5, 2018
99ecf68
Trace file permissions
javierbrea May 5, 2018
739cd93
Use sudo for running tests
javierbrea May 5, 2018
758162f
Sonar exclusions fixed
javierbrea May 5, 2018
e2df0e6
Execute npm test as sudo
javierbrea May 5, 2018
915e521
Add sudo true to travis config
javierbrea May 5, 2018
062b655
Trying to run npm test as sudo
javierbrea May 5, 2018
1843a72
Use sudo in clean command if fails without sudo
javierbrea May 5, 2018
b9e34e8
Remove example code from clean-package bash
javierbrea May 5, 2018
38864f1
Execute all integration tests
javierbrea May 5, 2018
7792de0
Add delay before reading other service logs
javierbrea May 5, 2018
341e1d4
Add custom timeout to specs delayed
javierbrea May 5, 2018
5ce4344
Wait before reading output when execution is aborted
javierbrea May 5, 2018
78e725c
Increase wait-on timeout for running test with docker build
javierbrea May 5, 2018
078ab3b
Execute all integration tests
javierbrea May 5, 2018
27eda9c
Remove unused variable
javierbrea May 5, 2018
1be11c1
Add local integration tests
javierbrea May 5, 2018
f10704d
Add local abort-on-error integration test
javierbrea May 5, 2018
4df75bd
Add integration tests about local execution
javierbrea May 5, 2018
db0b5fc
Improve prepare_package script
javierbrea May 5, 2018
fcdb6d9
Fix foo package databse connection promise
javierbrea May 5, 2018
ce6ef7e
Fix foo package standard
javierbrea May 5, 2018
8abf623
Change integration test configuration
javierbrea May 5, 2018
62c658f
Fix abort-on-error integration test
javierbrea May 5, 2018
a541818
Execute all integration tests
javierbrea May 5, 2018
2f4b7fb
Add integration tests for local service with coverage enabled
javierbrea May 6, 2018
63046f4
Finish integration tests about local executions
javierbrea May 6, 2018
d511177
Add integration test for local execution of a single service
javierbrea May 6, 2018
3fcd1c0
Add integration test for running api and test in different services
javierbrea May 6, 2018
a9af0a0
Add standard fix option integration test
javierbrea May 6, 2018
a19d171
Deactive temporarily coveralls to check only integration tests on travis
javierbrea May 6, 2018
6327313
Testing wait for logs write finish in travis
javierbrea May 6, 2018
215331d
Wait for logs close instead of process close
javierbrea May 6, 2018
8e6664f
Enable all integration tests
javierbrea May 6, 2018
00d22a5
Remove commented code
javierbrea May 6, 2018
f080414
Add wait-on docs
javierbrea May 7, 2018
64b9d88
Fill changelog
javierbrea May 7, 2018
70fa575
Add logs documentation
javierbrea May 7, 2018
c7c25e2
Add abort-on-error docs
javierbrea May 7, 2018
d7394e4
Add standard configuration docs
javierbrea May 7, 2018
6922267
Add docker versions to docs
javierbrea May 7, 2018
cd9ac66
Add real example based on integration tests to documentation
javierbrea May 7, 2018
abf8b32
Add example file
javierbrea May 7, 2018
bad4334
Enable unit tests
javierbrea May 7, 2018
466a906
Increase timeouts for local tests executions
javierbrea May 7, 2018
33683ec
Fix forceExit value
javierbrea May 7, 2018
2ffca3e
Fix runner unit test
javierbrea May 8, 2018
4809717
Upgrade version
javierbrea May 8, 2018
85daeea
Fixed: was not executing all specs
javierbrea May 8, 2018
b1b6af1
Fix standard configuration
javierbrea May 8, 2018
6bc501d
Increase time out in test that includes npm i command
javierbrea May 8, 2018
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
961 changes: 957 additions & 4 deletions .narval.yml

Large diffs are not rendered by default.

28 changes: 28 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,34 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [unreleased]
### Added
### Changed
### Fixed
### Removed

## [1.0.0-beta.5] - 2018-05-08
### Added
- Add "wait-on" options to configuration.
- Add "abort-on-error" configuration option for services.
- Add "Standard" directories option to configuration.
- Specs can be defined as an Array of paths to files or folders.
- Services can wait for other services.
- Add narval default environment variables to all commands, services and tests.
- Write services logs to files. These files are available inside Docker containers too.
- Add integration tests.

### Changed
- Use "wait-on" instead of "wait-for" inside Docker.
- Changed method to start Docker services internally. Now use "docker-compose-up start" command independently for each service, for better control.

### Fixed
- Do not force process exit on finish. Let it exit gracefully.
- Install mandatory nodejs dependencies in Docker containers only in containers with nodejs available.

### Removed
- Remove "depends_on" docker-containers property. Not necessary any more because of new feature "wait-on".

## [1.0.0-beta.4] - 2018-04-25
### Added
- Add "shell" option.
Expand Down
398 changes: 279 additions & 119 deletions README.md

Large diffs are not rendered by default.

84 changes: 0 additions & 84 deletions examples/all-properties.yml

This file was deleted.

40 changes: 22 additions & 18 deletions lib/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,8 @@ const _ = require('lodash')

const options = require('./options')
const istanbulMocha = require('./istanbul-mocha')

const logProcessData = function (data) {
data = _.trim(data)
if (data.length) {
console.log(data)
}
}
const processLogs = require('./process-logs')
const tracer = require('./tracer')

const windowsBaseCommand = function () {
return {
Expand Down Expand Up @@ -59,34 +54,43 @@ const run = function (command, opts) {
return getBaseCommand()
.then((baseCommand) => {
return new Promise((resolve, reject) => {
let proc = childProcess.spawn(baseCommand.cmd, baseCommand.args.concat(path.join(process.cwd(), command)), {
let logs
const proc = childProcess.spawn(baseCommand.cmd, baseCommand.args.concat(path.join(process.cwd(), command)), {
cwd: process.cwd(),
env: _.extend({}, process.env, {
FORCE_COLOR: true
}, opts.env),
windowsHide: true,
windowsVerbatimArguments: true
})

proc.stdout.setEncoding('utf8')
proc.stdout.on('data', (data) => {
logProcessData(data)
logs = new processLogs.Handler(proc, {
type: opts.suiteType,
suite: opts.suite,
service: opts.service
}, {
close: true
})

proc.stderr.on('data', (data) => {
logProcessData(data)
proc.on('error', (err) => {
tracer.error(`Error trying to run command. ${err.message}`)
reject(err)
})

proc.stdout.setEncoding('utf8')

if (opts.sync) {
proc.on('close', (code) => {
if (code !== null && code !== 0) {
reject(new Error(`Error running command. Exit code ${code}`))
logs.on('close', (logData) => {
if (logData.processCode !== null && logData.processCode !== 0) {
reject(new Error(`Error running command. Exit code ${logData.processCode}`))
} else {
resolve(0)
}
})
} else {
resolve(proc)
resolve({
process: proc,
logs: logs
})
}
})
})
Expand Down
5 changes: 5 additions & 0 deletions lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,13 @@ const checkDockerContainers = function (customConfig) {
return customConfig['docker-containers'] || []
}

const checkStandardConfig = function (customConfig) {
return customConfig.standard || {}
}

const checkConfig = function (configs) {
return Promise.props({
standard: checkStandardConfig(configs.custom),
dockerImages: checkDockerImages(configs.custom),
dockerContainers: checkDockerContainers(configs.custom),
suitesByType: getSuitesByType(configs.custom, configs.default)
Expand Down
9 changes: 5 additions & 4 deletions lib/docker-resources/.narval/scripts/run-cmd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ command_to_run=$1
command_params=$2
coverage_options=$3
coverage_enabled=$4
wait_for=$5
wait_on=$5
exit_after=$6

log_title="[Narval] [DEBUG]"
Expand All @@ -16,7 +16,7 @@ log_sep="================================"
# echo "$log_title command_params: $command_params"
# echo "$log_title coverage_options: $coverage_options"
# echo "$log_title coverage_enabled: $coverage_enabled"
# echo "$log_title wait_for: $wait_for"
# echo "$log_title wait_on: $wait_on"
# echo "$log_title exit_after: $exit_after"

if [ -z "$command_to_run" ]; then
Expand All @@ -43,8 +43,9 @@ else
command_to_run="node_modules/.bin/narval-msc-istanbul $coverage_options cover ./$command_to_run"
fi

if [ "$wait_for" != "" ]; then
command_to_run=".narval/scripts/wait-for-it.sh $wait_for -- ./$command_to_run"
if [ "$wait_on" != "" ]; then
echo "WAITING FOR: $wait_on"
wait-on $wait_on
fi

echo "$log_sep"
Expand Down
Loading