forked from elastic/beats
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request elastic#13 from ruflin/integration-tests
Integration tests
- Loading branch information
Showing
15 changed files
with
522 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
/coverage | ||
/etc/filebeat.dev.yml | ||
.idea | ||
filebeat | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,13 @@ go: | |
|
||
sudo: false | ||
|
||
addons: | ||
apt: | ||
packages: | ||
- libpcap-dev | ||
- python-virtualenv | ||
- geoip-database | ||
|
||
before_install: | ||
# Redo the travis setup but with the elastic/filebeat path. This is needed so the package path is correct | ||
- mkdir -p $HOME/gopath/src/github.com/elastic/filebeat | ||
|
@@ -17,13 +24,12 @@ install: | |
|
||
script: | ||
- make check | ||
- make cover | ||
- make full-coverage | ||
|
||
notifications: | ||
email: | ||
- [email protected] | ||
|
||
after_success: | ||
# Copy profile.cov to coverage.txt because codecov.io requires this file | ||
- cp profile.cov coverage.txt | ||
- bash <(curl -s https://codecov.io/bash) | ||
- bash <(curl -s https://codecov.io/bash) -f coverage/full.cov |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package crawler | ||
|
||
import ( | ||
"github.com/stretchr/testify/assert" | ||
"testing" | ||
) | ||
|
||
// Most harvester tests need real files to tes that can be modified. These tests are implemented with | ||
// integration tests | ||
|
||
func TestExampleTest(t *testing.T) { | ||
|
||
h := Harvester{ | ||
Path: "/var/log/", | ||
Offset: 0, | ||
} | ||
|
||
assert.Equal(t, "/var/log/", h.Path) | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
env | ||
last_run | ||
run | ||
|
||
*.pyc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
SHELL := /bin/bash | ||
PROCESSES ?= 4 | ||
TIMEOUT ?= 60 | ||
|
||
env: env/bin/activate | ||
env/bin/activate: requirements.txt | ||
test -d env || virtualenv env > /dev/null | ||
. env/bin/activate && pip install -Ur requirements.txt > /dev/null | ||
touch env/bin/activate | ||
|
||
.PHONY: test | ||
test: env | ||
make -C ../.. filebeat.test | ||
. env/bin/activate; nosetests --processes=${PROCESSES} --process-timeout=$(TIMEOUT) | ||
|
||
.PHONY: coverage | ||
coverage: test | ||
mkdir -p ../../coverage | ||
# Writes count mode on top of file | ||
echo 'mode: count' > ../../coverage/integration.cov | ||
# Collects all integration coverage files and skips top line with mode | ||
tail -q -n +2 ./run/**/*.cov >> ../../coverage/integration.cov | ||
# Generates HTML output | ||
go tool cover -html=../../coverage/integration.cov -o ../../coverage/integration.html | ||
|
||
.PHONY: clean | ||
clean: | ||
-rm -r env | ||
-rm -r run | ||
-rm last_run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
############################# Filbeat ###################################### | ||
filebeat: | ||
files: | ||
- | ||
# Paths that should be crawled and fetched | ||
paths: | ||
- "{{ path }}" | ||
# Type of the files. Annotated in every documented | ||
type: log | ||
spoolSize: | ||
harvesterBufferSize: | ||
cpuProfileFile: | ||
idleTimeout: | ||
tailOnRotate: | ||
quiet: | ||
registryfile: {{ fb.working_dir + '/' }}.filebeat | ||
|
||
|
||
|
||
############################# Shipper ############################################ | ||
shipper: | ||
|
||
# The name of the shipper that publishes the network data. It can be used to group | ||
# all the transactions sent by a single shipper in the web interface. | ||
# If this options is not defined, the hostname is used. | ||
name: | ||
|
||
# The tags of the shipper are included in their own field with each | ||
# transaction published. Tags make it easy to group servers by different | ||
# logical properties. | ||
tags: [ | ||
{%- if agent_tags -%} | ||
{%- for tag in agent_tags -%} | ||
"{{ tag }}" | ||
{%- if not loop.last %}, {% endif -%} | ||
{%- endfor -%} | ||
{%- endif -%}] | ||
|
||
|
||
# Uncomment the following if you want to ignore transactions created | ||
# by the server on which the shipper is installed. This option is useful | ||
# to remove duplicates if shippers are installed on multiple servers. | ||
# ignore_outgoing: true | ||
|
||
|
||
|
||
############################# Output ############################################ | ||
|
||
# Configure what outputs to use when sending the data collected by packetbeat. | ||
# You can enable one or multiple outputs by setting enabled option to true. | ||
output: | ||
|
||
# Elasticsearch as output | ||
# Options: | ||
# host, port: where Elasticsearch is listening on | ||
# save_topology: specify if the topology is saved in Elasticsearch | ||
#elasticsearch: | ||
# enabled: false | ||
# host: localhost | ||
# port: 9200 | ||
# save_topology: true | ||
|
||
# Redis as output | ||
# Options: | ||
# host, port: where Redis is listening on | ||
# save_topology: specify if the topology is saved in Redis | ||
#redis: | ||
# enabled: false | ||
# host: localhost | ||
# port: 6379 | ||
# save_topology: true | ||
|
||
# File as output | ||
# Options | ||
# path: where to save the files | ||
# filename: name of the files | ||
# rotate_every_kb: maximum size of the files in path | ||
# number of files: maximum number of files in path | ||
file: | ||
enabled: true | ||
path: "{{ output_file_path|default(fb.working_dir + "/output") }}" | ||
filename: "{{ output_file_filename|default("filebeat") }}" | ||
rotate_every_kb: 1000 | ||
#number_of_files: 7 | ||
|
||
# vim: set ft=jinja: |
Oops, something went wrong.