Skip to content

Commit 2b32700

Browse files
Adapt the logging test to the bundle builder v2 (#615)
1 parent 7a52724 commit 2b32700

4 files changed

+40
-8
lines changed

tests/templates/kuttl/logging/02-create-configmap-with-prepared-logs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ commands:
55
- script: >
66
kubectl create configmap prepared-logs
77
--from-file=prepared-opa-logs.json
8-
--from-file=prepared-bundle-builder-logs.txt
8+
--from-file=prepared-bundle-builder-logs.tracing-rs.json
99
--namespace=$NAMESPACE

tests/templates/kuttl/logging/03-install-opa.yaml.j2

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,41 @@ spec:
6565
level: INFO
6666
podOverrides:
6767
spec:
68+
initContainers:
69+
- name: create-opa-log-dir
70+
image: docker.stackable.tech/stackable/testing-tools:0.2.0-stackable0.0.0-dev
71+
# Create the log directory for the opa container upfront
72+
# to avoid a race condition between the opa and the
73+
# vector container. If the vector container is
74+
# initialized first then the prepared logs are mounted
75+
# to /stackable/log/opa/test. If the directory
76+
# /stackable/log/opa would not exist then it would be
77+
# created with the following permissions:
78+
# drwxr-sr-x root stackable
79+
# The opa container would not be able to write its logs
80+
# into this directory.
81+
# Creating the directory in this init container results
82+
# in the following permissions:
83+
# drwxr-sr-x stackable stackable
84+
# It is not necessary to create the log directory for
85+
# the bundle builder upfront because the prepared logs
86+
# are put into a separate directory.
87+
command:
88+
- mkdir
89+
- --parents
90+
- /stackable/log/opa
91+
volumeMounts:
92+
- name: log
93+
mountPath: /stackable/log
6894
containers:
6995
- name: vector
7096
volumeMounts:
7197
- name: prepared-logs
7298
mountPath: /stackable/log/opa/test
7399
subPath: prepared-opa-logs.json
74100
- name: prepared-logs
75-
mountPath: /stackable/log/bundle-builder/test
76-
subPath: prepared-bundle-builder-logs.txt
101+
mountPath: /stackable/log/prepared-logs/prepared-bundle-builder-logs.tracing-rs.json
102+
subPath: prepared-bundle-builder-logs.tracing-rs.json
77103
volumes:
78104
- name: prepared-logs
79105
configMap:
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{"timestamp":"2024-01-01T00:00:00.000000Z","level":"INFO","fields":{"message":"Valid log event","directory":"/stackable/log/prepared-logs"},"target":"TestLogger"}
2+
{"timestamp":"2024-01-01T00:00:00.000000Z","level":"INFO","fields":{"message":"Valid log event with only the message field"},"target":"TestLogger"}
3+
{"timestamp":"2024-01-01T00:00:00.000000Z","level":"INFO","fields":{"message":"Valid log event with a nested field","nested":{"array":[1,2,3]}},"target":"TestLogger"}
4+
{"level":"INFO","fields":{"message":"Invalid log event without a timestamp","directory":"/stackable/log/prepared-logs"},"target":"TestLogger"}
5+
{"timestamp":"unparsable timestamp","level":"INFO","fields":{"message":"Invalid log event with an unparsable timestamp","directory":"/stackable/log/prepared-logs"},"target":"TestLogger"}
6+
{"timestamp":"2024-01-01T00:00:00.000000Z","fields":{"message":"Invalid log event without a level","directory":"/stackable/log/prepared-logs"},"target":"TestLogger"}
7+
{"timestamp":"2024-01-01T00:00:00.000000Z","level":"INFO","fields":{"message":"Invalid log event without a logger","directory":"/stackable/log/prepared-logs"}}
8+
{"timestamp":"2024-01-01T00:00:00.000000Z","level":"CRITICAL","fields":{"message":"Invalid log event with an unknown level","directory":"/stackable/log/prepared-logs"},"target":"TestLogger"}
9+
{"timestamp":"2024-01-01T00:00:00.000000Z","level":"INFO","fields":{"directory":"/stackable/log/prepared-logs"},"target":"TestLogger"}
10+
{"timestamp":"2024-01-01T00:00:00.000000Z","level":"INFO","target":"TestLogger"}
11+
"true"

tests/templates/kuttl/logging/prepared-bundle-builder-logs.txt

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)