Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable system tests for auditbeat #5945

Merged
merged 3 commits into from
Mar 13, 2018

Conversation

ruflin
Copy link
Member

@ruflin ruflin commented Dec 21, 2017

  • There were system tests and system integration tests for auditbeat but so far they were not run.
  • Integration tests enabled
  • Module config changed to module that works on more systems. Limitation for linux removed.

This is prerequisite for #5938

@ruflin
Copy link
Member Author

ruflin commented Dec 21, 2017

jenkins, test it

Copy link
Member

@andrewkroh andrewkroh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@andrewkroh
Copy link
Member

jenkins, test it

Seems like Jenkins never started for this one.

@ruflin
Copy link
Member Author

ruflin commented Dec 22, 2017

Seems like it refuses to start even with our comments :-(

@ph
Copy link
Contributor

ph commented Dec 22, 2017

@ruflin Yes, there is an issue with github hook infra and github are working on it.

@ph
Copy link
Contributor

ph commented Dec 22, 2017

Jenkins test this please

@ruflin ruflin force-pushed the enable-auditbeat-system-tests branch from 8f3b496 to a78b6a4 Compare December 27, 2017 02:47
@ruflin ruflin force-pushed the enable-auditbeat-system-tests branch 2 times, most recently from 6aed4aa to f5ed930 Compare January 4, 2018 23:03
@ruflin ruflin force-pushed the enable-auditbeat-system-tests branch from f5ed930 to b79d60d Compare February 6, 2018 02:51
@ruflin
Copy link
Member Author

ruflin commented Feb 6, 2018

Rebased this on master to see if it builds correctly.

GOX_OS?=linux windows ## @Building List of all OS to be supported by "make crosscompile".
DEV_OS?=linux
TESTING_ENVIRONMENT?=snapshot-noxpack
GOPACKAGES=$(shell go list ${BEAT_PATH}/... | grep -v /vendor/)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you know what requires this line? I'd assume this is the default in libbeat/scripts/Makefile.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just copied over from Metricbeat. It does not seem to be needed anymore. I also removed it from Metricbeat.


elasticsearch:
extends:
file: ../testing/environments/${TESTING_ENVIRONMENT}.yml
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you follow this file you will find that it references Dockerfile-snapshot which no longer exists.

context: ./docker/elasticsearch
dockerfile: Dockerfile-snapshot

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Strange, metricbeat depends on the same one and still works. Change.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@andrewkroh I think I just found a potential issue. Metricbeat has it's own elasticsearch instance for the testing of the module. This is reused also for the tests where data is sent to ES like the template loading.

It could now be argued that this a good thing as template loading etc. is tested with a stable version and it's up to libbeat to test its own functionality against master as each beat just uses the provided functionality. At the same time this was not intended.

The above explains how the noxpack file could have become outdated without breaking the tests.

@ruflin
Copy link
Member Author

ruflin commented Feb 27, 2018

It seems the test on Jenkins is failing because the mac slave tries to start the environment which it shouldn't because TEST_ENVIRONMENT=0 is set. I need to further investigate.

ruflin added a commit to ruflin/beats that referenced this pull request Feb 27, 2018
This PR is a subset of elastic#5945 to remove the Metricbeat changes from the PR.
SYSTEM_TESTS=false
TEST_ENVIRONMENT=false
SYSTEM_TESTS=true
TEST_ENVIRONMENT=true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would setting TEST_ENVIRONMENT?=true solve the issue? IIRC we set TEST_ENVIRONMENT=0 in the Jenkins darwin environment.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch, will try

@ruflin ruflin force-pushed the enable-auditbeat-system-tests branch from ae26160 to 3e9299b Compare March 11, 2018 13:36
exekias pushed a commit that referenced this pull request Mar 12, 2018
* Cleanup Metricbeat composer and Makefile

This PR is a subset of #5945 to remove the Metricbeat changes from the PR.
ruflin added 2 commits March 12, 2018 11:07
* There were system tests and system integration tests for auditbeat but so far they were not run.
* Integration tests enabled
* Module config changed to module that works on more systems. Limitation for linux removed.

Change noxpack path

readd es_beats path

remove kibana snapshot file

one more check for xpack0 to see if timeout becomes less of a problem

readd go packages

unify metricbeat / auditbeat to find problem

update travis, rename beat-path as double used

remove kibana because not needed

modify build flag to run as unit test

add file tree test to unit tests

add ? for test env
@ruflin ruflin force-pushed the enable-auditbeat-system-tests branch from 3e9299b to 6e11a0c Compare March 12, 2018 16:10
proxy_dep:
image: busybox
depends_on:
elasticsearch: { condition: service_healthy }
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@exekias In compose version 2 depends_on has to be an array and does not support the health check: https://docs.docker.com/compose/compose-file/compose-file-v2/#depends_on 2.1 is required for the above notation. But 2.1 is not supported by the module script. As there is no compose usage yet in auditbeat I will check if I can get away with using 2.1 here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want to use the uncoupled testing code you need to switch to something like this: https://github.com/elastic/beats/blob/master/metricbeat/docker-compose.yml

Where there is no proxy_dep and health checks are managed from testing framework

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems to work with 2.1 for now as there are no usage of the testing framework.

@ruflin
Copy link
Member Author

ruflin commented Mar 13, 2018

The test failure from autodiscovery should not be related, still posting it here for @exekias

github.com/elastic/beats/libbeat/version
17:14:47 ?   	github.com/elastic/beats/libbeat/api	[no test files]
17:14:50 command [go test -race -cover -coverprofile /tmp/gotestcover-568559804 github.com/elastic/beats/libbeat/autodiscover]: exit status 1
17:14:50 --- FAIL: TestAutodiscover (0.08s)
17:14:50 	<autogenerated>:1: 
17:14:50                           
17:14:50 	Error Trace:	autodiscover_test.go:183
17:14:50 		
17:14:50 	Error:      	Not equal: 
17:14:50 		
17:14:50 	            	expected: 1
17:14:50 		
17:14:50 	            	actual  : 2
17:14:50 		
17:14:50 	Test:       	TestAutodiscover
17:14:50 	<autogenerated>:1: 
17:14:50                           
17:14:50 	Error Trace:	autodiscover_test.go:184
17:14:50 		
17:14:50 	Error:      	Should be true
17:14:50 		
17:14:50 	Test:       	TestAutodiscover
17:14:50 panic: runtime error: index out of range [recovered]
17:14:50 	panic: runtime error: index out of range
17:14:50 
17:14:50 goroutine 3 [running]:
17:14:50 testing.tRunner.func1(0xc420134000)
17:14:50 	/var/lib/jenkins/.gvm/versions/go1.9.4.linux.amd64/src/testing/testing.go:711 +0x5d9
17:14:50 panic(0x90b4a0, 0xbdebf0)
17:14:50 	/var/lib/jenkins/.gvm/versions/go1.9.4.linux.amd64/src/runtime/panic.go:491 +0x2a2
17:14:50 github.com/elastic/beats/libbeat/autodiscover.TestAutodiscover(0xc420134000)
17:14:50 	/var/lib/jenkins/workspace/elastic+beats+pull-request+multijob-linux/beat/libbeat/label/ubuntu/src/github.com/elastic/beats/libbeat/autodiscover/autodiscover_test.go:185 +0x1e76
17:14:50 testing.tRunner(0xc420134000, 0x986d68)
17:14:50 	/var/lib/jenkins/.gvm/versions/go1.9.4.linux.amd64/src/testing/testing.go:746 +0x16d
17:14:50 created by testing.(*T).Run
17:14:50 	/var/lib/jenkins/.gvm/versions/go1.9.4.linux.amd64/src/testing/testing.go:789 +0x569
17:14:50 FAIL	github.com/elastic/beats/libbeat/autodiscover	0.457s
17:14:51 ok  	github.com/elastic/beats/libbeat/autodiscover/builder	1.052s	coverage: 32.6% of statements

@andrewkroh Ready for an other review / merge.

@andrewkroh
Copy link
Member

Thanks for adding this test!

@andrewkroh andrewkroh merged commit 3bb5cb6 into elastic:master Mar 13, 2018
@ruflin ruflin deleted the enable-auditbeat-system-tests branch March 13, 2018 12:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants