Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
10 changes: 10 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,16 @@ matrix:
# - npm run build -- --scope "@loopback/test-repository-cloudant" --include-dependencies
# - cd acceptance/repository-cloudant && npm run docker:setup
# - source cloudant-config.sh && npm run mocha
- node_js: "12"
os: linux
env:
- TASK=test-extension-logging-fluentd
services:
- docker
script:
- npm run postinstall -- --scope "@loopback/test-extension-logging-fluentd" --include-dependencies
- npm run build -- --scope "@loopback/test-extension-logging-fluentd" --include-dependencies
- cd acceptance/extension-logging-fluentd && npm run mocha

branches:
only:
Expand Down
2 changes: 2 additions & 0 deletions CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ packages/testlab/* @bajtos
packages/tsdocs/* @raymondfeng

extensions/health/* @raymondfeng
extensions/logging/* @raymondfeng
extensions/metrics/* @raymondfeng

examples/todo/* @bajtos @hacksparrow
examples/context/* @raymondfeng
Expand Down
1 change: 1 addition & 0 deletions acceptance/extension-logging-fluentd/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package-lock=true
25 changes: 25 additions & 0 deletions acceptance/extension-logging-fluentd/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
Copyright (c) IBM Corp. 2017,2019. All Rights Reserved.
Node module: @loopback/test-extension-logging-fluentd
This project is licensed under the MIT License, full text below.

--------

MIT license

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
30 changes: 30 additions & 0 deletions acceptance/extension-logging-fluentd/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# @loopback/test-extension-logging-fluentd

Acceptance tests for `@loopback/extension-logging` against a fluentd server.

## Running the test suite

### Prerequisite

- [Docker](https://docs.docker.com/engine/installation/) is installed.

### Run the test:

For mocha tests, we use
[testcontainers](https://github.com/testcontainers/testcontainers-node) to
start/stop the fluentd docker container automatically.

The fluentd configuration is read from `fixtures/etc/fluentd.conf`.

```bash
npm test
```

## Contributors

See
[all contributors](https://github.com/strongloop/loopback-next/graphs/contributors).

## License

MIT
18 changes: 18 additions & 0 deletions acceptance/extension-logging-fluentd/fixtures/etc/fluentd.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<source>
@type http
port 9880
bind 0.0.0.0
</source>
<source>
@type forward
port 24224
</source>
<match **>
@type file
path /fluentd/log/
<buffer>
timekey 1d
timekey_use_utc true
timekey_wait 10m
</buffer>
</match>
18 changes: 18 additions & 0 deletions acceptance/extension-logging-fluentd/fixtures/start-fluentd.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash
SCRIPT_NAME=${BASH_SOURCE[0]}
BASE_DIR=`dirname "${SCRIPT_NAME}"`
$BASE_DIR/stop-fluentd.sh

FLUENTD__CONTAINER_NAME="fluentd_lb4"
pushd $BASE_DIR >/dev/null
ROOT_DIR=$(pwd)
rm -rf $ROOT_DIR/logs/*
docker pull fluent/fluentd:v1.7.4-debian-1.0
docker run --name $FLUENTD__CONTAINER_NAME -d \
-p 24224:24224 -p 9880:9880 -v $ROOT_DIR/etc:/fluentd/etc \
-e FLUENTD_CONF=fluentd.conf fluent/fluentd
popd >/dev/null

export FLUENTD_SERVICE_HOST=127.0.0.1
export FLUENTD_SERVICE_PORT_TCP=24224
export FLUENTD_SERVICE_PORT_HTTP=9880
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
FLUENTD__CONTAINER_NAME="fluentd_lb4"
docker rm -f $FLUENTD__CONTAINER_NAME >/dev/null 2>&1
6 changes: 6 additions & 0 deletions acceptance/extension-logging-fluentd/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// Copyright IBM Corp. 2019. All Rights Reserved.
// Node module: @loopback/test-extension-logging-fluentd
// This file is licensed under the MIT License.
// License text available at https://opensource.org/licenses/MIT

export * from './dist';
6 changes: 6 additions & 0 deletions acceptance/extension-logging-fluentd/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// Copyright IBM Corp. 2019. All Rights Reserved.
// Node module: @loopback/test-extension-logging-fluentd
// This file is licensed under the MIT License.
// License text available at https://opensource.org/licenses/MIT

module.exports = require('./dist');
Loading