Skip to content

Commit

Permalink
Improved WS and TLS tests
Browse files Browse the repository at this point in the history
  • Loading branch information
alongir committed Oct 4, 2024
1 parent 53f85fd commit 85904c5
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 11 deletions.
2 changes: 1 addition & 1 deletion additions/outbound-tls-golang/build.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash

# docker build . -t mertyildiran/mizutest-outbound-tls-golang:latest && docker push mertyildiran/mizutest-outbound-tls-golang:latest
docker buildx build --platform linux/amd64 -t alongir/mizutest-outbound-tls-openssl:latest . --push
docker buildx build --platform linux/amd64,linux/arm64 -t kubeshark/mizutest-outbound-tls-golang:latest . --push
17 changes: 9 additions & 8 deletions additions/outbound-tls-golang/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ func main() {
for {
j++

req, err := http.NewRequest("GET", "https://gorest.co.in/public/v2/not-found", nil)
// Include the index 'j' in the query parameter of the URL
getURL := fmt.Sprintf("https://gorest.co.in/public/v2/not-found?index=%d", j)
req, err := http.NewRequest("GET", getURL, nil)
if err != nil {
fmt.Println(err)
continue
Expand Down Expand Up @@ -72,7 +74,9 @@ func main() {
fmt.Printf("res: %+v\n", res)
res.Body.Close()

req, err = http.NewRequest("GET", "https://gorest.co.in/public/v2/users", nil)
// Include the index 'j' in the query parameter of the GET request for users
getUsersURL := fmt.Sprintf("https://gorest.co.in/public/v2/users?index=%d", j)
req, err = http.NewRequest("GET", getUsersURL, nil)
if err != nil {
fmt.Println(err)
continue
Expand All @@ -92,7 +96,9 @@ func main() {
fmt.Printf("res: %+v\n", res)
res.Body.Close()

req, err = http.NewRequest("GET", "https://gorest.co.in/public/v2/posts", nil)
// Include the index 'j' in the query parameter of the GET request for posts
getPostsURL := fmt.Sprintf("https://gorest.co.in/public/v2/posts?index=%d", j)
req, err = http.NewRequest("GET", getPostsURL, nil)
if err != nil {
fmt.Println(err)
continue
Expand All @@ -105,11 +111,6 @@ func main() {
continue
}
_, err = io.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
continue
}
_, err = io.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
}
Expand Down
2 changes: 1 addition & 1 deletion deploy/kubernetes/complete-demo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1782,7 +1782,7 @@ spec:
containers:
- command:
- ./main
image: mertyildiran/mizutest-outbound-tls-golang:latest
image: kubeshark/mizutest-outbound-tls-golang:latest
imagePullPolicy: Always
name: mizutest-outbound-tls-golang
ports:
Expand Down
2 changes: 1 addition & 1 deletion deploy/kubernetes/tls-demo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ spec:
spec:
containers:
- name: mizutest-outbound-tls-golang
image: alongir/mizutest-outbound-tls-golang:latest
image: kubeshark/mizutest-outbound-tls-golang:latest
imagePullPolicy: Always
command: ["./main"]
resources:
Expand Down
78 changes: 78 additions & 0 deletions deploy/kubernetes/ws-demo.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
---
apiVersion: v1
kind: Namespace
metadata:
name: sock-shop
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: mizutest-websocket-client
name: mizutest-websocket-client
version: v0.1.0
name: mizutest-websocket-client
namespace: sock-shop
spec:
replicas: 1
selector:
matchLabels:
name: mizutest-websocket-client
template:
metadata:
labels:
app: mizutest-websocket-client
name: mizutest-websocket-client
version: v0.1.0
spec:
containers:
- command:
- sh
- -c
- ./run.sh # > /dev/null 2>&1
env:
- name: PYTHONUNBUFFERED
value: '1'
- name: PYTHONIOENCODING
value: UTF-8
image: kubeshark/mizutest-websocket-client:latest
imagePullPolicy: Always
name: mizutest-websocket-client
ports:
- containerPort: 5672
resources:
limits:
cpu: 50m
memory: 200Mi
requests:
cpu: 10m
memory: 10Mi
securityContext:
capabilities:
add:
- NET_BIND_SERVICE
drop:
- all
readOnlyRootFilesystem: true
runAsNonRoot: true
runAsUser: 10001
nodeSelector:
kubernetes.io/os: linux
---
apiVersion: v1
kind: Service
metadata:
annotations:
prometheus.io/scrape: 'true'
labels:
app: mizutest-websocket-client
name: mizutest-websocket-client
version: v0.1.0
name: mizutest-websocket-client
namespace: sock-shop
spec:
ports:
- port: 5672
targetPort: 5672
selector:
name: mizutest-websocket-client

0 comments on commit 85904c5

Please sign in to comment.