Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RHCLOUD-35836 - Kessel E2E testing setup + Increase test coverage #258

Merged
merged 5 commits into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 16 additions & 5 deletions .github/workflows/e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,26 @@ jobs:
- name: Inventory Up - Kind Cluster
run: make inventory-up-kind

- name: Monitor Pods in Kind
run: |
timeout 90s kubectl get pods -w || exit 0

- name: View Test Pod Logs
run: |
TEST_POD=$(kubectl get pods --selector=job-name=e2e-inventory-http-tests -o jsonpath='{.items[0].metadata.name}')
for i in {1..50}; do
STATUS=$(kubectl get pods --selector=job-name=e2e-inventory-http-tests -o jsonpath='{.items[0].status.containerStatuses[0].state.terminated.reason}')
if [ "$STATUS" = "Completed" ]; then
echo "E2E test pod completed successfully."
kubectl logs $TEST_POD
kubectl get pods
kubectl get svc
exit 0
elif [ "$STATUS" = "Error" ]; then
echo "E2E test pod failed."
kubectl logs $TEST_POD
kubectl get pods
exit 1
fi
sleep 3
done
kubectl logs $TEST_POD

- name: Inventory Down - Kind Cluster
run: make inventory-down-kind

9 changes: 5 additions & 4 deletions deploy/kind/e2e/e2e-batch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ kind: Job
metadata:
name: e2e-inventory-http-tests
spec:
completions: 1
backoffLimit: 0
template:
spec:
initContainers:
Expand All @@ -13,7 +15,7 @@ spec:
- "-c"
- |
echo "Waiting for kessel-inventory-service to be ready..."
while ! curl -s http://kessel-inventory-service/api/inventory/v1/readyz; do
while ! curl -s http://kessel-inventory-service:8081/api/inventory/v1/readyz; do
echo "Inventory service not ready yet. Sleeping for 5 seconds..."
sleep 5
done
Expand All @@ -23,9 +25,8 @@ spec:
image: localhost/inventory-e2e-tests:e2e-test
env:
- name: INV_HTTP_URL
value: "kessel-inventory-service:80"
value: "kessel-inventory-service:8081"
- name: KAFKA_BOOTSTRAP_SERVERS
value: "localhost:9092"
value: "my-cluster-kafka-bootstrap:9092"
command: ["/usr/local/bin/e2e-inventory-tests", "-test.v"]
restartPolicy: Never
backoffLimit: 4
17 changes: 12 additions & 5 deletions deploy/kind/inventory/kessel-inventory.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ spec:
app: kessel-inventory
ports:
- protocol: TCP
port: 80
port: 8081
targetPort: 8081
---
# PodDisruptionBudget
Expand Down Expand Up @@ -138,14 +138,21 @@ stringData:
grpc:
address: 0.0.0.0:9081
authn:
psk:
pre-shared-key-file: /psks.yaml
allow-unauthenticated: true
#psk:
#pre-shared-key-file: /psks.yaml
authz:
impl: allow-all
impl: kessel
kessel:
insecure-client: true
url: relationships-service.default.svc.cluster.local:9000
enable-oidc-auth: false
eventing:
eventer: stdout
eventer: kafka
kafka:
bootstrap-servers: "my-cluster-kafka-bootstrap.default.svc.cluster.local:9092"
storage:
disable-persistence: true
database: postgres
sqlite3:
dsn: inventory.db
Expand Down
13 changes: 6 additions & 7 deletions deploy/kind/inventory/strimzi.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Taken from: https://github.com/strimzi/strimzi-kafka-operator/blob/main/examples/kafka/kafka-ephemeral.yaml
apiVersion: kafka.strimzi.io/v1beta2
kind: Kafka
metadata:
name: my-cluster
namespace: default
spec:
kafka:
version: 3.8.0
replicas: 1
replicas: 3
listeners:
- name: plain
port: 9092
Expand All @@ -17,19 +17,18 @@ spec:
type: internal
tls: true
config:
zookeeper.connect: my-cluster-zookeeper-client.default.svc.cluster.local:2181
auto.create.topics.enable: true
offsets.topic.replication.factor: 3
transaction.state.log.replication.factor: 3
transaction.state.log.min.isr: 2
default.replication.factor: 3
min.insync.replicas: 2
inter.broker.protocol.version: "3.8"
advertised.listeners: PLAINTEXT://my-cluster-kafka-bootstrap.default.svc.cluster.local:9092
storage:
type: ephemeral
zookeeper:
replicas: 1
replicas: 3
storage:
type: ephemeral
entityOperator:
topicOperator: {}
userOperator: {}

6 changes: 6 additions & 0 deletions deploy/kind/relations/spicedb-kind-setup/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
## Relations-api and SpiceDB setup

Setup for Relations-api and SpiceDB taken from:
```http
https://github.com/project-kessel/relations-api/tree/main/spicedb-kind-setup
```
Loading
Loading