Skip to content

Commit

Permalink
Add installation test
Browse files Browse the repository at this point in the history
  • Loading branch information
rielas committed Jul 24, 2024
1 parent dd8fbca commit fd4274c
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 3 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ docker-compose --file=docker-compose.local.yml up -d --build
## Running application with helm chart
Helm command example:
```bash
helm upgrade --install --namespace distributor broken \
$ helm upgrade --install --namespace distributor broken \
--set snifferApiURL=https://hotel.playground.neuralegion.com \
--set snifferProjectID=ud8v8jwUaG14JiAihMQx1M \
--set snifferApiKey=6g0daym.nexp.spkuhhishhttv \
Expand All @@ -48,6 +48,11 @@ helm upgrade --install --namespace distributor broken \
--set ingress.authlevel=- . --wait
```

Optionally, you can test your installation:
```bash
$ helm test broken --namespace=distributor --logs
```

### Arguments info

**repeaterID, token and cluster** - These argument values are required if you want to use repeater. In case you don't set any of these fields, repeater container won't be run. In that case this will be regular bc deployment. (Required arguments if repeater container is to be used).
Expand Down
2 changes: 1 addition & 1 deletion charts/brokencrystals/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: |
Benchmark application that uses modern technologies and implements a set of
common security vulnerabilities
type: application
version: 0.0.78
version: 0.0.79
keywords:
- brokencrystals
- brkn
2 changes: 1 addition & 1 deletion charts/brokencrystals/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
https://{{ include "brokencrystals.fullname" . }}.brokencrystals.{{ .Values.ingress.basedomain }}
https://{{ .Values.ingress.url }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
apiVersion: v1
kind: Pod
metadata:
name: "{{ .Release.Name }}-test-internal-connection"
namespace: "{{ .Release.Namespace }}"
annotations:
"helm.sh/hook": test
spec:
containers:
- name: test
image: python:3
command: ["/bin/sh", "-c"]
args:
- |
cat <<EOF > /tmp/check_availability.py
import urllib.request
import sys
def check_availability(url: str):
print(f"🔍 Checking application availability at {url}")
try:
with urllib.request.urlopen(url, timeout=10) as response:
if response.status == 200:
print(f"✅ Application is available at {url}")
else:
print(f"❌ Application returned status code {response.status}")
sys.exit(1)
except urllib.error.URLError as e:
print(f"🚨 Error checking application availability: {e}")
sys.exit(1)
internal_url = "http://{{ .Release.Name }}:3000"
check_availability(internal_url)
public_url = "https://{{ .Values.ingress.url }}"
check_availability(public_url)
sys.exit(0)
EOF
python /tmp/check_availability.py
restartPolicy: Never

0 comments on commit fd4274c

Please sign in to comment.