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

Parallelize tests by filename #135

Merged
merged 5 commits into from
Feb 12, 2024

Conversation

ryanohnemus
Copy link
Contributor

@ryanohnemus ryanohnemus commented Jan 28, 2024

This makes a few changes to some current expectations that allows us to run tests in parallel and can speed up test runs from around 11 minutes down to 4 minutes (which could be trimmed down even further if the chunked-rollover test is re-worked and there isn't a 3 minute sleep within it).

Changes:

  • Tests can be parallelized by file, by default this runs 8 jobs, to accomplish this tests run within their own namespace, by setting the TEST_NAMESPACE variable in their setup_file(). We no longer require TEST_NAMESPACE being set before the test is run for this reason.
  • Tests also require that fullnameOverrides are used within the helm installs so that daemonsets or clusterroles being set up by the helm chart do not conflict when they run in parallel. This also means for tests that use multiple helms (like elasticsearch), I removed passing the extra templated helm file options passed to them as using fullnameOverrides conflicts and causes elasticsearch to take on the same name we're giving fluent-bit.
  • If TEST_NAMESPACE is set before calling run-tests.sh tests will be required to run in sequential order (as they do today), but the fullnameOverride logic above still applies.
  • values.yaml.tpl env substitution requires TEST_NAMESPACE is set, which is used to create a non-conflicting templated file for the running test, a function create_helm_extra_values_file was also created within test-helpers.bash to remove some of the copy code.
========================
Starting tests.
========================

Fluentbit repository: ghcr.io/fluent/fluent-bit/pr-8279 - tag: 18e5eda4b644723fcfbe6a46524de8430f856fe5-debug


1..11
ok 1 chunk rollover test in 201000ms
ok 2 test fluent-bit forwards logs to elasticsearch default index in 96000ms
ok 3 test fluent-bit forwards logs to elasticsearch default index using http compression in 100000ms
ok 4 test fluent-bit adds kubernetes pod labels to records in 16000ms
ok 5 test fluent-bit adds kubernetes namespace labels to records in 17000ms
ok 6 test fluent-bit adds kubernetes pod and namespace labels to records in 17000ms
ok 7 test fluent-bit adds kubernetes pod and namespace labels to records - kubelet enabled in 0ms # skip kubelet-enabled test skipped until https://github.com/fluent/fluent-bit-ci/issues/134 is resolved
ok 8 verify config in 3000ms
ok 9 test fluent-bit forwards logs to opensearch default index in 57000ms
ok 10 test fluent-bit forwards logs to AWS OpenSearch hosted service default index in 0ms # skip Skipping Hosted OpenSearch When 'HOSTED_OPENSEARCH_HOST=localhost'
ok 11 Verify K8S cluster accessible in 0ms


========================
All tests passed!
========================


FLUENTBIT_IMAGE_REPOSITORY=ghcr.io/fluent/fluent-bit/pr-8279 = ./run-tests.sh  24.69s user 13.43s system 15% cpu 4:07.66 total

Copy link
Collaborator

@patrick-stephens patrick-stephens left a comment

Choose a reason for hiding this comment

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

Can you resolve the linting problems?

run-tests.sh Outdated Show resolved Hide resolved
tests/elasticsearch/basic.bats Outdated Show resolved Hide resolved
tests/elasticsearch/compress.bats Outdated Show resolved Hide resolved
tests/kubernetes-plugins/basic.bats Outdated Show resolved Hide resolved
tests/kubernetes-plugins/full.bats Outdated Show resolved Hide resolved
tests/opensearch/basic.bats Outdated Show resolved Hide resolved
tests/opensearch/hosted.bats Outdated Show resolved Hide resolved
Signed-off-by: ryanohnemus <[email protected]>
Signed-off-by: ryanohnemus <[email protected]>
@ryanohnemus ryanohnemus force-pushed the feature/parallel_jobs branch from 6874330 to 0cb622f Compare February 3, 2024 14:06
@ryanohnemus
Copy link
Contributor Author

@patrick-stephens, sorry it was a busy week so it took me a bit to get back to this. I just got the lints fixed and I added a little documentation. Please take another look when you get a chance, thank you!

Signed-off-by: ryanohnemus <[email protected]>
@@ -68,8 +62,8 @@ teardown() {

function set_fluent_bit_pod_name() {
try "at most 30 times every 2s " \
"to find 1 pods named 'fluentbit-ci-tests' " \
"with 'status' being 'Running'"
"to find 1 pods named 'fluent-bit' " \
Copy link
Collaborator

Choose a reason for hiding this comment

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

I wonder if we should parameterise this to simplify?

tests/opensearch/basic.bats Show resolved Hide resolved
tests/opensearch/hosted.bats Outdated Show resolved Hide resolved
Signed-off-by: ryanohnemus <[email protected]>
@patrick-stephens patrick-stephens merged commit fedbb2b into fluent:main Feb 12, 2024
7 of 8 checks passed
@ryanohnemus ryanohnemus deleted the feature/parallel_jobs branch February 17, 2024 14:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants