Skip to content

Commit

Permalink
Add prepared logs to the logging test
Browse files Browse the repository at this point in the history
  • Loading branch information
siegfriedweber committed Jun 5, 2024
1 parent e12d2d4 commit 635d116
Show file tree
Hide file tree
Showing 12 changed files with 56 additions and 219 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

200 changes: 6 additions & 194 deletions Cargo.nix

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@ tokio = { version = "1.37", features = ["full"] }
tracing = "0.1"
url = "2.4"

# [patch."https://github.com/stackabletech/operator-rs.git"]
# stackable-operator = { git = "https://github.com/stackabletech//operator-rs.git", branch = "main" }
[patch."https://github.com/stackabletech/operator-rs.git"]
stackable-operator = { git = "https://github.com/stackabletech//operator-rs.git", branch = "fix/vector-log-processing" }
4 changes: 2 additions & 2 deletions crate-hashes.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 0 additions & 12 deletions tests/templates/kuttl/logging/03-assert.yaml

This file was deleted.

17 changes: 17 additions & 0 deletions tests/templates/kuttl/logging/03-copy-prepared-logs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
apiVersion: kuttl.dev/v1beta1
kind: TestStep
commands:
- script: |
opa_pod=$(kubectl get pods \
--namespace=$NAMESPACE \
--selector=app.kubernetes.io/instance=test-opa \
--output=jsonpath='{.items[0].metadata.name}')
kubectl cp ./prepared-opa-logs.json \
$NAMESPACE/$opa_pod:/stackable/log/opa/test \
--container vector
kubectl cp ./prepared-bundle-builder-logs.txt \
$NAMESPACE/$opa_pod:/stackable/log/bundle-builder/test \
--container vector
16 changes: 9 additions & 7 deletions tests/templates/kuttl/logging/04-assert.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
---
apiVersion: kuttl.dev/v1beta1
kind: TestAssert
commands:
- script: >-
kubectl exec --namespace=$NAMESPACE opa-test-runner-0 --
python /tmp/test_log_aggregation.py -n $NAMESPACE
- script: >-
kubectl exec --namespace=$NAMESPACE opa-test-runner-0 --
sh /tmp/test_log_aggregation.sh
timeout: 300
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: opa-test-runner
status:
readyReplicas: 1
replicas: 1
10 changes: 10 additions & 0 deletions tests/templates/kuttl/logging/05-assert.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
apiVersion: kuttl.dev/v1beta1
kind: TestAssert
commands:
- script: >-
kubectl exec --namespace=$NAMESPACE opa-test-runner-0 --
python /tmp/test_log_aggregation.py -n $NAMESPACE
- script: >-
kubectl exec --namespace=$NAMESPACE opa-test-runner-0 --
sh /tmp/test_log_aggregation.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
2024-01-01T00:00:00.000000Z  INFO bundle: Valid log event
Unparsable log event
6 changes: 6 additions & 0 deletions tests/templates/kuttl/logging/prepared-opa-logs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{"level":"info","msg":"Valid server log event","name":"stackable","plugin":"bundle","time":"2024-01-01T00:00:00Z","logger":"server"}
{"bundles":{"stackable":{}},"decision_id":"5b887ec2-80a0-4b44-9009-2e0cae3507c2","labels":{"id":"992b9dd5-f29e-47a7-aa3a-4408218c3825","version":"0.61.0"},"level":"info","metrics":{"counter_server_query_cache_hit":0,"timer_rego_input_parse_ns":5500,"timer_rego_query_compile_ns":143369,"timer_rego_query_eval_ns":41107,"timer_rego_query_parse_ns":95750,"timer_server_handler_ns":422100},"msg":"Valid decision log event","path":"test","req_id":3,"requested_by":"10.244.0.138:33268","time":"2024-01-01T00:00:00Z","timestamp":"2024-01-01T00:00:00.000000000Z","type":"openpolicyagent.org/decision_logs","logger":"decision"}
{"level":"info","msg":"Invalid log event without a timestamp","name":"stackable","plugin":"bundle","logger":"server"}
{"msg":"Invalid log event without a level","name":"stackable","plugin":"bundle","time":"2024-01-01T00:00:00Z","logger":"server"}
{"level":"info","name":"stackable","plugin":"bundle","time":"2024-01-01T00:00:00Z","logger":"server"}
{"level":"info","msg":"Unparsable log event",...

0 comments on commit 635d116

Please sign in to comment.