Skip to content

Commit 6534d5c

Browse files
AnnaZivkovicclaude
andcommitted
Increase memory limits for integration tests
Tests were being OOMed with 4Gi limit when running with race detector after recent dependency updates. Increased to 8Gi to accommodate increased memory usage from cilium/ebpf and other vendor updates. Also updated to support both component and group test types by parsing the SNAPSHOT parameter using Python, with fallback to fetching Snapshot resources when git info is not in the parameter. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 27bd4f0 commit 6534d5c

1 file changed

Lines changed: 80 additions & 19 deletions

File tree

.tekton/multiarch-tuning-operator-integration-tests.yaml

Lines changed: 80 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,49 +4,110 @@ metadata:
44
name: integration-and-unit-tests
55
namespace: multiarch-tuning-ope-tenant
66
spec:
7-
params: [ ]
7+
params:
8+
- name: SNAPSHOT
9+
description: 'Snapshot of the application'
10+
type: string
11+
default: '{"components": [{"name":"multiarch-tuning-operator", "containerImage": "quay.io/example/repo:latest"}]}'
812
tasks:
913
- name: clone-and-test
14+
params:
15+
- name: SNAPSHOT
16+
value: $(params.SNAPSHOT)
1017
taskSpec:
18+
params:
19+
- name: SNAPSHOT
20+
type: string
1121
volumes:
1222
- name: source
1323
emptyDir: { }
1424
steps:
1525
- image: brew.registry.redhat.io/rh-osbs/openshift-golang-builder:rhel_9_1.25
1626
env:
17-
- name: URL
18-
valueFrom:
19-
fieldRef:
20-
fieldPath: metadata.annotations['pac.test.appstudio.openshift.io/source-repo-url']
21-
- name: REVISION
22-
valueFrom:
23-
fieldRef:
24-
fieldPath: metadata.annotations['pac.test.appstudio.openshift.io/sha']
27+
- name: SNAPSHOT
28+
value: $(params.SNAPSHOT)
2529
computeResources:
2630
limits:
2731
cpu: 8
28-
memory: 4Gi
32+
memory: 8Gi
2933
requests:
3034
cpu: 500m
31-
memory: 1Gi
35+
memory: 2Gi
3236
volumeMounts:
3337
- name: source
3438
mountPath: /workspace
3539
script: |
3640
#!/bin/bash
37-
set -exuo pipefail
41+
set -euo pipefail
42+
43+
# Extract git URL and revision from SNAPSHOT parameter
44+
# Uses Python for JSON parsing (available in golang-builder image)
45+
read -r URL REVISION <<< $(python3 -c "
46+
import json
47+
snapshot = json.loads('''${SNAPSHOT}''')
48+
components = snapshot.get('components', [])
49+
if components:
50+
comp = components[0]
51+
url = comp.get('source', {}).get('git', {}).get('url', '')
52+
rev = comp.get('source', {}).get('git', {}).get('revision', '')
53+
if not url:
54+
url = comp.get('repository', '')
55+
if not rev:
56+
rev = comp.get('revision', '')
57+
print(url, rev)
58+
")
59+
60+
# Fallback: Fetch from Snapshot resource if not in parameter (group tests)
3861
if [ -z "$URL" ] || [ -z "$REVISION" ]; then
39-
echo "URL and REVISION must be set"
62+
SNAPSHOT_NAME=$(python3 -c "
63+
import json
64+
try:
65+
snapshot = json.loads('''${SNAPSHOT}''')
66+
print(snapshot.get('application', ''))
67+
except: pass
68+
" 2>/dev/null || echo "")
69+
70+
if [ -n "$SNAPSHOT_NAME" ]; then
71+
if ! command -v oc &> /dev/null && ! command -v kubectl &> /dev/null; then
72+
curl -sL https://mirror.openshift.com/pub/openshift-v4/clients/ocp/stable/openshift-client-linux.tar.gz | tar -xzf - -C /usr/local/bin/ oc
73+
chmod +x /usr/local/bin/oc
74+
fi
75+
76+
K8S_CMD=$(command -v oc || command -v kubectl)
77+
SNAPSHOT_JSON=$($K8S_CMD get snapshot "$SNAPSHOT_NAME" -o json 2>/dev/null || echo "")
78+
79+
if [ -n "$SNAPSHOT_JSON" ]; then
80+
read -r URL REVISION <<< $(echo "$SNAPSHOT_JSON" | python3 -c "
81+
import json, sys
82+
try:
83+
snapshot = json.load(sys.stdin)
84+
components = snapshot.get('spec', {}).get('components', [])
85+
for comp in components:
86+
if 'multiarch-tuning-operator' in comp.get('name', ''):
87+
url = comp.get('source', {}).get('git', {}).get('url', '')
88+
rev = comp.get('source', {}).get('git', {}).get('revision', '')
89+
if url and rev:
90+
print(url, rev)
91+
break
92+
except: pass
93+
")
94+
fi
95+
fi
96+
fi
97+
98+
if [ -z "$URL" ] || [ -z "$REVISION" ]; then
99+
echo "ERROR: Could not extract git URL and revision from SNAPSHOT"
40100
exit 1
41101
fi
42-
echo "Initializing the env vars"
43-
echo "URL: $URL"
44-
echo "REVISION: $REVISION"
102+
103+
echo "Cloning $URL at $REVISION"
104+
45105
mkdir /workspace/source
46106
cd /workspace/source
47107
git init
48-
git remote add origin $URL
49-
git fetch origin $REVISION
108+
git remote add origin "$URL"
109+
git fetch origin "$REVISION"
50110
git checkout FETCH_HEAD
111+
112+
echo "Running integration tests..."
51113
make unit NO_DOCKER=1
52-
exit $? # exit with the status of the tests

0 commit comments

Comments
 (0)