Skip to content

Commit

Permalink
Test mut-gather script (grafana#1052)
Browse files Browse the repository at this point in the history
  • Loading branch information
IshwarKanse authored Oct 8, 2024
1 parent 642fc96 commit 88d46a5
Show file tree
Hide file tree
Showing 4 changed files with 108 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tests/e2e-openshift/monolithic-route/chainsaw-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,9 @@ spec:
- apply:
file: install-tempo.yaml
- assert:
file: install-tempo-assert.yaml
file: install-tempo-assert.yaml
- name: Run the must-gather and verify the contents
try:
- script:
timeout: 5m
content: ./check-must-gahter.sh
44 changes: 44 additions & 0 deletions tests/e2e-openshift/monolithic-route/check-must-gahter.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/bash

# Check if must gather directory exists
MUST_GATHER_DIR=/tmp/monolithic-route
mkdir -p $MUST_GATHER_DIR

# Run the must-gather script
oc adm must-gather --dest-dir=$MUST_GATHER_DIR --image=quay.io/rhn_support_ikanse/tempo-must-gather:latest -- /usr/bin/must-gather --operator-namespace tempo-operator

# Define required files and directories
REQUIRED_ITEMS=(
"event-filter.html"
"timestamp"
"*sha*/deployment-tempo-operator-controller.yaml"
"*sha*/olm/operator-servicemeshoperator-openshift-operators.yaml"
"*sha*/olm/installplan-install-*.yaml"
"*sha*/olm/clusterserviceversion-tempo-operator-*.yaml"
"*sha*/olm/operator-opentelemetry-product-openshift-opentelemetry-operator.yaml"
"*sha*/olm/operator-tempo-operator-tempo-operator.yaml"
"*sha*/olm/operator-tempo-product-openshift-tempo-operator.yaml"
"*sha*/olm/subscription-tempo-operator-*-sub.yaml"
"*sha*/namespaces/chainsaw-mono-route/tempomonolithic/mono-route/tempomonolithic-mono-route.yaml"
"*sha*/namespaces/chainsaw-mono-route/tempomonolithic/mono-route/service-tempo-mono-route-jaegerui.yaml"
"*sha*/namespaces/chainsaw-mono-route/tempomonolithic/mono-route/configmap-tempo-mono-route-serving-cabundle.yaml"
"*sha*/namespaces/chainsaw-mono-route/tempomonolithic/mono-route/statefulset-tempo-mono-route.yaml"
"*sha*/namespaces/chainsaw-mono-route/tempomonolithic/mono-route/service-tempo-mono-route.yaml"
"*sha*/namespaces/chainsaw-mono-route/tempomonolithic/mono-route/route-tempo-mono-route-jaegerui.yaml"
"*sha*/namespaces/chainsaw-mono-route/tempomonolithic/mono-route/configmap-tempo-mono-route-config.yaml"
"*sha*/namespaces/chainsaw-mono-route/tempomonolithic/mono-route/serviceaccount-tempo-mono-route.yaml"
"*sha*/tempo-operator-controller-*"
)

# Verify each required item
for item in "${REQUIRED_ITEMS[@]}"; do
if ! find "$MUST_GATHER_DIR" -path "$MUST_GATHER_DIR/$item" -print -quit | grep -q .; then
echo "Missing: $item"
exit 1
else
echo "Found: $item"
fi
done

# Cleanup the must-gather directory
rm -rf $MUST_GATHER_DIR
5 changes: 5 additions & 0 deletions tests/e2e-openshift/route/chainsaw-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,8 @@ spec:
- script:
timeout: 5m
content: kubectl get --namespace $NAMESPACE tempo simplest -o jsonpath='{.status.conditions[?(@.type=="Ready")].status}' | grep True
- name: Run the must-gather and verify the contents
try:
- script:
timeout: 5m
content: ./check-must-gahter.sh
53 changes: 53 additions & 0 deletions tests/e2e-openshift/route/check-must-gahter.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#!/bin/bash

# Check if must gather directory exists
MUST_GATHER_DIR=/tmp/route
mkdir -p $MUST_GATHER_DIR

# Run the must-gather script
oc adm must-gather --dest-dir=$MUST_GATHER_DIR --image=quay.io/rhn_support_ikanse/tempo-must-gather:latest -- /usr/bin/must-gather --operator-namespace tempo-operator

# Define required files and directories
REQUIRED_ITEMS=(
"event-filter.html"
"timestamp"
"*sha*/deployment-tempo-operator-controller.yaml"
"*sha*/olm/installplan-install-*"
"*sha*/olm/clusterserviceversion-tempo-operator-*.yaml"
"*sha*/olm/operator-opentelemetry-product-openshift-opentelemetry-operator.yaml"
"*sha*/olm/operator-tempo-operator-tempo-operator.yaml"
"*sha*/olm/operator-tempo-product-openshift-tempo-operator.yaml"
"*sha*/olm/subscription-tempo-operator-*-sub.yaml"
"*sha*/namespaces/chainsaw-route/tempostack/simplest/service-tempo-simplest-distributor.yaml"
"*sha*/namespaces/chainsaw-route/tempostack/simplest/service-tempo-simplest-ingester.yaml"
"*sha*/namespaces/chainsaw-route/tempostack/simplest/deployment-tempo-simplest-distributor.yaml"
"*sha*/namespaces/chainsaw-route/tempostack/simplest/service-tempo-simplest-querier.yaml"
"*sha*/namespaces/chainsaw-route/tempostack/simplest/configmap-tempo-simplest.yaml"
"*sha*/namespaces/chainsaw-route/tempostack/simplest/service-tempo-simplest-compactor.yaml"
"*sha*/namespaces/chainsaw-route/tempostack/simplest/service-tempo-simplest-query-frontend.yaml"
"*sha*/namespaces/chainsaw-route/tempostack/simplest/deployment-tempo-simplest-querier.yaml"
"*sha*/namespaces/chainsaw-route/tempostack/simplest/tempostack-simplest.yaml"
"*sha*/namespaces/chainsaw-route/tempostack/simplest/serviceaccount-tempo-simplest-query-frontend.yaml"
"*sha*/namespaces/chainsaw-route/tempostack/simplest/statefulset-tempo-simplest-ingester.yaml"
"*sha*/namespaces/chainsaw-route/tempostack/simplest/deployment-tempo-simplest-query-frontend.yaml"
"*sha*/namespaces/chainsaw-route/tempostack/simplest/route-tempo-simplest-query-frontend.yaml"
"*sha*/namespaces/chainsaw-route/tempostack/simplest/service-tempo-simplest-gossip-ring.yaml"
"*sha*/namespaces/chainsaw-route/tempostack/simplest/configmap-tempo-simplest-ca-bundle.yaml"
"*sha*/namespaces/chainsaw-route/tempostack/simplest/serviceaccount-tempo-simplest.yaml"
"*sha*/namespaces/chainsaw-route/tempostack/simplest/deployment-tempo-simplest-compactor.yaml"
"*sha*/namespaces/chainsaw-route/tempostack/simplest/service-tempo-simplest-query-frontend-discovery.yaml"
"*sha*/tempo-operator-controller-*"
)

# Verify each required item
for item in "${REQUIRED_ITEMS[@]}"; do
if ! find "$MUST_GATHER_DIR" -path "$MUST_GATHER_DIR/$item" -print -quit | grep -q .; then
echo "Missing: $item"
exit 1
else
echo "Found: $item"
fi
done

# Cleanup the must-gather directory
rm -rf $MUST_GATHER_DIR

0 comments on commit 88d46a5

Please sign in to comment.