Skip to content
Open
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
41 changes: 41 additions & 0 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: E2E

on:
push:
branches:
- main
pull_request:
workflow_dispatch:

permissions:
contents: read

concurrency:
group: e2e-${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.sha }}
cancel-in-progress: true

jobs:
e2e:
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Provision cluster
uses: agynio/bootstrap/.github/actions/provision@main

- name: Setup DevSpace
uses: agynio/e2e/.github/actions/setup-devspace@main

- name: Deploy threads from source
run: devspace dev

- name: Run E2E tests
uses: agynio/e2e/.github/actions/run-tests@main
with:
service: threads

- name: Restore ArgoCD auto-sync
if: always()
run: devspace run-pipeline restore-argocd
59 changes: 8 additions & 51 deletions devspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ version: v2beta1

vars:
THREADS_NAMESPACE: platform
E2E_IMAGE: ghcr.io/agynio/devcontainer-go:1

functions:
disable_argocd_sync: |-
Expand All @@ -27,7 +26,7 @@ functions:
fi
patch_deployment: |-
echo "Patching threads deployment for DevSpace..."
kubectl patch deployment threads-threads -n ${THREADS_NAMESPACE} --type strategic --patch "$(cat <<'EOF'
kubectl patch deployment threads -n ${THREADS_NAMESPACE} --type strategic --patch "$(cat <<'EOF'
spec:
template:
spec:
Expand All @@ -40,7 +39,7 @@ functions:
emptyDir: {}
containers:
- name: threads
image: ghcr.io/agynio/devcontainer-go:1 # keep in sync with E2E_IMAGE
image: ghcr.io/agynio/devcontainer-go:1
workingDir: /opt/app/data
command:
- sh
Expand Down Expand Up @@ -77,26 +76,6 @@ functions:
EOF
)"

deployments:
e2e-runner:
namespace: ${THREADS_NAMESPACE}
helm:
chart:
name: component-chart
repo: https://charts.devspace.sh
values:
containers:
- image: ${E2E_IMAGE}
env:
- name: THREADS_ADDRESS
value: "threads:50051"
labels:
app.kubernetes.io/name: threads-e2e

commands:
test:e2e: |-
devspace run-pipeline test:e2e $@

pipelines:
dev:
flags:
Expand All @@ -109,11 +88,12 @@ pipelines:
if [ "$(get_flag "watch")" == "true" ]; then
start_dev --disable-pod-replace threads
else
start_dev --disable-pod-replace threads
start_dev --disable-pod-replace threads &
DEVSPACE_PID=$!
echo "Waiting for threads to be healthy on :50051..."
healthy=false
for i in $(seq 1 60); do
if exec_container --label-selector=app.kubernetes.io/name=threads -n ${THREADS_NAMESPACE} -- bash -c 'nc -z localhost 50051 >/dev/null 2>&1 || (echo > /dev/tcp/localhost/50051) >/dev/null 2>&1'; then
if kubectl exec deployment/threads -n ${THREADS_NAMESPACE} -c threads -- sh -c 'nc -z localhost 50051 >/dev/null 2>&1 || (echo > /dev/tcp/localhost/50051) >/dev/null 2>&1' 2>/dev/null; then
healthy=true
break
fi
Expand All @@ -125,21 +105,12 @@ pipelines:
fi
echo "Dev environment ready. Stopping dev session."
stop_dev threads
wait "$DEVSPACE_PID"
fi

test:e2e:
restore-argocd:
run: |-
create_deployments e2e-runner
start_dev e2e-runner &
sleep 5
exec_container \
--label-selector "app.kubernetes.io/name=threads-e2e" \
-n ${THREADS_NAMESPACE} \
-- bash -c 'cd /opt/app/data && buf generate buf.build/agynio/api --path agynio/api/threads/v1 --path agynio/api/notifications/v1 --path agynio/api/identity/v1 --path agynio/api/metering/v1 --path agynio/api/authorization/v1 --path agynio/api/agents/v1 && go test -v -count=1 -tags e2e ./test/e2e/'
EXIT_CODE=$?
stop_dev e2e-runner
purge_deployments e2e-runner
exit $EXIT_CODE
restore_argocd_sync

hooks:
- name: restore-argocd-auto-sync
Expand Down Expand Up @@ -181,17 +152,3 @@ dev:
lastLines: 200
ports:
- port: "50051"

e2e-runner:
namespace: ${THREADS_NAMESPACE}
labelSelector:
app.kubernetes.io/name: threads-e2e
command: ["sleep", "infinity"]
workingDir: /opt/app/data
sync:
- path: ./:/opt/app/data
excludePaths:
- .git/
- .devspace/
- /.gen/
- /tmp/
27 changes: 0 additions & 27 deletions test/e2e/main_test.go

This file was deleted.

41 changes: 0 additions & 41 deletions test/e2e/threads_test.go

This file was deleted.

Loading