Skip to content

Commit 3ed5763

Browse files
authored
Updated dev guide instructions to work with master (#30014)
filebeat fails (hangs) on 8.0 due to `Elasticsearch is too old.` so updating to 8.1 as well as fixing up expectations around authentication, ssl, and information about options and where to find logs.
1 parent d4bd46b commit 3ed5763

5 files changed

Lines changed: 49 additions & 9 deletions

File tree

docs/devguide/contributing.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ and documentation. The primary command used for this is:
8383
--------------------------------------------------------------------------------
8484
make update
8585
--------------------------------------------------------------------------------
86-
Each Beat has its own `update` target, as well as a master `update` in the repository root.
86+
Each Beat has its own `update` target, as well as a master `update` in the repository root.
8787
If a PR adds or removes a dependency, run `make update` in the root `beats` directory.
8888

8989
Another command properly formats go source files and adds a copyright header:

docs/devguide/index.asciidoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ include::./pull-request-guidelines.asciidoc[]
1919

2020
include::./contributing.asciidoc[]
2121

22+
include::./testing.asciidoc[]
23+
2224
include::{libbeat-dir}/communitybeats.asciidoc[]
2325

2426
include::./fields-yml.asciidoc[]
@@ -36,5 +38,3 @@ include::./metricbeat-devguide.asciidoc[]
3638
include::./modules-dev-guide.asciidoc[]
3739

3840
include::./migrate-dashboards.asciidoc[]
39-
40-

docs/devguide/modules-dev-guide.asciidoc

Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -485,8 +485,46 @@ run.
485485
In order to test the filesets with the sample logs and/or generate the expected output one should run the tests
486486
locally for a specific module, using the following procedure under Filebeat directory:
487487

488-
. Run an Elasticsearch instance locally using docker: `docker run -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" docker.elastic.co/elasticsearch/elasticsearch:8.0.0-SNAPSHOT`
488+
. Start an Elasticsearch instance locally. For example, using Docker:
489+
+
490+
[source,bash]
491+
----
492+
docker run \
493+
--name elasticsearch \
494+
-p 9200:9200 -p 9300:9300 \
495+
-e "xpack.security.http.ssl.enabled=false" -e "ELASTIC_PASSWORD=changeme" \
496+
-e "discovery.type=single-node" \
497+
--pull allways --rm --detach \
498+
docker.elastic.co/elasticsearch/elasticsearch:master-SNAPSHOT
499+
----
500+
. Create an "admin" user on that Elasticsearch instance:
501+
+
502+
[source,bash]
503+
----
504+
curl -u elastic:changeme \
505+
http://localhost:9200/_security/user/admin \
506+
-X POST -H 'Content-Type: application/json' \
507+
-d '{"password": "changeme", "roles": ["superuser"]}'
508+
----
509+
. Create the testing binary: `make filebeat.test`
510+
. Update fields yaml: `make update`
489511
. Create python env: `make python-env`
490512
. Source python env: `source ./build/python-env/bin/activate`
491-
. Create the testing binary: `make filebeat.test`
492-
. Run the test, ie: `GENERATE=1 INTEGRATION_TESTS=1 BEAT_STRICT_PERMS=false TESTING_FILEBEAT_MODULES=nginx pytest tests/system/test_modules.py`
513+
. Run a test, for example to check nginx access log parsing:
514+
+
515+
[source,bash]
516+
----
517+
INTEGRATION_TESTS=1 BEAT_STRICT_PERMS=false ES_PASS=changeme \
518+
TESTING_FILEBEAT_MODULES=nginx \
519+
pytest tests/system/test_modules.py -v --full-trace
520+
----
521+
. Add and remove option env vars as required. Here are some useful ones:
522+
* `TESTING_FILEBEAT_ALLOW_OLDER`: if set to 1, allow connecting older versions of Elasticsearch
523+
* `TESTING_FILEBEAT_MODULES`: comma separated list of modules to test.
524+
* `TESTING_FILEBEAT_FILESETS`: comma separated list of filesets to test.
525+
* `TESTING_FILEBEAT_FILEPATTERN`: glob pattern for log files within the fileset to test.
526+
* `GENERATE`: if set to 1, the expected documents will be generated.
527+
528+
The filebeat logs are writen to the `build` directory. It may be useful to tail them in another terminal using `tail -F build/system-tests/run/test_modules.Test.*/output.log`.
529+
530+
For example if there's a syntax error in an ingest pipeline, the test will probably just hang. The filebeat log output will contain the error message from elasticsearch.

docs/devguide/new_protocol.asciidoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ The following topics describe how to add a new protocol to Packetbeat:
55

66
* <<getting-ready-new-protocol>>
77
* <<protocol-modules>>
8-
* <<testing>>
8+
* <<protocol-testing>>
99

1010
[[getting-ready-new-protocol]]
1111
=== Getting Ready
@@ -95,7 +95,7 @@ We are working on updating this section. While you're waiting for updates, you
9595
might want to try out the TCP protocol generator at
9696
https://github.com/elastic/beats/tree/master/packetbeat/scripts/tcp-protocol.
9797

98-
[[testing]]
98+
[[protocol-testing]]
9999
=== Testing
100100

101-
We are working on updating this section.
101+
We are working on updating this section.

docs/devguide/testing.asciidoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ To run the tests without the services running locally, the command `make system-
3434

3535
All Python tests are under `tests/system` directory.
3636

37+
Filebeat's module python tests have additional documentation found in the <<filebeat-modules-devguide,Filebeat module>> guide.
38+
3739
==== Test commands
3840

3941
This is a quick summary of the available test commands:

0 commit comments

Comments
 (0)