Skip to content

Commit

Permalink
tests(operator): add e2e tests
Browse files Browse the repository at this point in the history
Signed-off-by: Dominik Rosiek <[email protected]>
  • Loading branch information
Dominik Rosiek committed Jun 28, 2023
1 parent a196a7d commit 6d3656d
Show file tree
Hide file tree
Showing 5 changed files with 156 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/pull_requests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,21 @@ jobs:
chmod +x /usr/local/bin/kubectl-kuttl
- name: Run e2e tests
run: make e2e-helm-certmanager

test-helm-chart-with-custom-configuration:
name: Test Helm chart with custom configuration
runs-on: ubuntu-20.04
timeout-minutes: 15
steps:
- uses: actions/checkout@v3
- name: Setup go
uses: actions/setup-go@v4
with:
go-version: '1.20'
- uses: imranismail/setup-kustomize@v2
- name: Install kuttl
run: |
curl -Lo /usr/local/bin/kubectl-kuttl https://github.com/kudobuilder/kuttl/releases/download/v${{ env.KUTTL_VERSION }}/kubectl-kuttl_${{ env.KUTTL_VERSION }}_linux_x86_64
chmod +x /usr/local/bin/kubectl-kuttl
- name: Run e2e tests
run: make e2e-helm-custom-configuration
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ e2e-helm: e2e
e2e-helm-certmanager: KUTTL_CONFIG = kuttl-test-helm-certmanager.yaml
e2e-helm-certmanager: e2e

.PHONY: e2e-helm-custom-configuration
e2e-helm-custom-configuration: KUTTL_CONFIG = kuttl-test-helm-custom-configuration.yaml
e2e-helm-custom-configuration: e2e

build-push-deploy: build-push-sidecar build-push-deploy-operator

build-push-sidecar:
Expand Down
12 changes: 12 additions & 0 deletions helm/tests/values.withCustomConfiguration.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
operator:
image:
repository: registry.localhost:5000/sumologic/tailing-sidecar-operator
tag: test

sidecar:
image:
repository: registry.localhost:5000/sumologic/tailing-sidecar
tag: test

config:
configMapName: 'custom-configuration'
17 changes: 17 additions & 0 deletions kuttl-test-helm-custom-configuration.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: kuttl.dev/v1beta1
kind: TestSuite
artifactsDir: ./tests/_build/artifacts/
testDirs:
- ./tests/sidecar/
- ./tests/operator/
timeout: 150
parallel: 4
startKIND: true
kindNodeCache: true
kindContainers:
- registry.localhost:5000/sumologic/tailing-sidecar-operator:test
- registry.localhost:5000/sumologic/tailing-sidecar:test
commands:
- command: helm upgrade --install test-release ./helm/tailing-sidecar-operator -f ./helm/tests/values.withCustomConfiguration.yaml -n tailing-sidecar-system --create-namespace
- command: kubectl wait --for=condition=available --timeout 300s deploy -l app.kubernetes.io/name=tailing-sidecar-operator -n tailing-sidecar-system
- command: kubectl wait --for=condition=ready --timeout 300s pod -l app.kubernetes.io/name=tailing-sidecar-operator -n tailing-sidecar-system
105 changes: 105 additions & 0 deletions operator/examples/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: custom-configuration
data:
fluent-bit.conf: |
[SERVICE]
# Flush
# =====
# set an interval of seconds before to flush records to a destination
flush 1
# Daemon
# ======
# instruct Fluent Bit to run in foreground or background mode.
daemon Off
# Log_Level
# =========
# Set the verbosity level of the service, values can be:
#
# - error
# - warning
# - info
# - debug
# - trace
#
# e.g. when 'info' is set, that means it includes 'error' and 'warning'.
log_level ${LOG_LEVEL}
# Parsers File
# ============
# specify an optional 'Parsers' configuration file
parsers_file parsers.conf
# Plugins File
# ============
# specify an optional 'Plugins' configuration file to load external plugins.
plugins_file plugins.conf
# HTTP Server
# ===========
# Enable/Disable the built-in HTTP Server for metrics
http_server Off
http_listen 0.0.0.0
http_port 2020
# Storage
# =======
# Fluent Bit can use memory and filesystem buffering based mechanisms
#
# - https://docs.fluentbit.io/manual/administration/buffering-and-storage
#
# storage metrics
# ---------------
# publish storage pipeline metrics in '/api/v1/storage'. The metrics are
# exported only if the 'http_server' option is enabled.
#
storage.metrics on
# storage.path
# ------------
# absolute file system path to store filesystem data buffers (chunks).
#
# storage.path /tmp/storage
# storage.sync
# ------------
# configure the synchronization mode used to store the data into the
# filesystem. It can take the values normal or full.
#
# storage.sync normal
# storage.checksum
# ----------------
# enable the data integrity check when writing and reading data from the
# filesystem. The storage layer uses the CRC32 algorithm.
#
# storage.checksum off
# storage.backlog.mem_limit
# -------------------------
# if storage.path is set, Fluent Bit will look for data chunks that were
# not delivered and are still in the storage layer, these are called
# backlog data. This option configure a hint of maximum value of memory
# to use when processing these records.
#
# storage.backlog.mem_limit 5M
[INPUT]
name tail
path ${PATH_TO_TAIL}
Read_from_Head On
Refresh_Interval 1
Rotate_Wait 60
Mem_Buf_Limit 5MB
DB /tailing-sidecar/var/fluent-bit-state.db
DB.Sync Normal
[OUTPUT]
name gstdout
plugins.conf: |
[PLUGINS]
Path /tailing-sidecar/lib/out_gstdout.so

0 comments on commit 6d3656d

Please sign in to comment.