Skip to content
This repository has been archived by the owner on Oct 21, 2024. It is now read-only.

feat: E2E tests iteration #1 #4

Merged
merged 51 commits into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
ac69396
chore(main): release 0.1.16 (#162)
lostbean Aug 16, 2024
ce473fb
Merge branch 'main' of github.com:kurtosis-tech/kardinal-kontrol
laurentluce Aug 20, 2024
0342914
Merge branch 'main' of github.com:kurtosis-tech/kardinal-kontrol
laurentluce Aug 20, 2024
5656d78
Merge branch 'main' of github.com:kurtosis-tech/kardinal-kontrol
laurentluce Aug 20, 2024
8711eae
Merge branch 'main' of github.com:kurtosis-tech/kardinal-kontrol
laurentluce Aug 21, 2024
68b578a
Merge branch 'main' of github.com:kurtosis-tech/kardinal-kontrol
laurentluce Aug 22, 2024
1abf992
Merge branch 'main' of github.com:kurtosis-tech/kardinal-kontrol
laurentluce Aug 22, 2024
ca3a89f
Merge branch 'main' of github.com:kurtosis-tech/kardinal-kontrol
laurentluce Aug 24, 2024
04492a1
E2E tests
laurentluce Aug 24, 2024
41e668a
Run on changes
laurentluce Aug 24, 2024
957d47b
Run on changes
laurentluce Aug 24, 2024
e7e2b29
Run on changes
laurentluce Aug 24, 2024
7fdbaef
Fix docker compose cmd line
laurentluce Aug 24, 2024
c340436
Fix docker compose cmd line
laurentluce Aug 24, 2024
f295613
Build and load kontrol service image
laurentluce Aug 24, 2024
59f53f7
Install nix
laurentluce Aug 24, 2024
d69dba0
List images
laurentluce Aug 24, 2024
9720f3f
Update docker compose file to use the built kontrol service image
laurentluce Aug 24, 2024
20d746e
Kardinal deploy and flow
laurentluce Aug 24, 2024
cf59901
Delete flows
laurentluce Aug 25, 2024
3d0d2da
Merge branch 'main' of github.com:kurtosis-tech/kardinal-kontrol
laurentluce Aug 26, 2024
4b56a23
Cluster resources endpoint check
laurentluce Aug 26, 2024
beca19e
Fix deploy parsing
laurentluce Aug 26, 2024
4361610
CLI in dev mode - Use tenant show command
laurentluce Aug 27, 2024
6d916b1
List docker containers running
laurentluce Aug 27, 2024
4fd1839
Debug docker networking
laurentluce Aug 27, 2024
d6abb99
Debug docker networking
laurentluce Aug 27, 2024
2cce6d6
Debug docker networking
laurentluce Aug 27, 2024
5f09e11
Deployments validation
laurentluce Aug 27, 2024
baa159e
Docker compose ports localhost set
laurentluce Aug 27, 2024
ff398cf
Debug docker networking
laurentluce Aug 27, 2024
a39970a
Fix tenant output
laurentluce Aug 27, 2024
7fd5de0
Debug docker networking
laurentluce Aug 27, 2024
2a7c486
Debug docker networking
laurentluce Aug 27, 2024
f1b044f
Debug docker networking
laurentluce Aug 27, 2024
954015f
Debug cluster resources check
laurentluce Aug 27, 2024
939738e
Fix deployments check
laurentluce Aug 27, 2024
f9b32a1
Update deployments checks
laurentluce Aug 27, 2024
2619d30
Merge branch 'main' of github.com:kurtosis-tech/kardinal-kontrol
laurentluce Aug 27, 2024
d55c363
Merge branch 'main' into laurent/e2e-tests-1
laurentluce Aug 27, 2024
2a9aaf0
Fix deployments check
laurentluce Aug 27, 2024
f311a1c
Template e2e tests
laurentluce Aug 28, 2024
3f49f50
Fix topology nodes retrieval
laurentluce Aug 28, 2024
b04b821
Renaming
laurentluce Aug 28, 2024
ae4e799
Check flow ls and template ls commands
laurentluce Aug 28, 2024
588184c
Refactoring
laurentluce Aug 28, 2024
67bbaaa
Cleanup
laurentluce Aug 28, 2024
53f5048
Merge branch 'main' of github.com:kurtosis-tech/kardinal-kontrol
laurentluce Aug 28, 2024
d2125a3
Merge branch 'main' into laurent/e2e-tests-1
laurentluce Aug 28, 2024
24cb56b
Merge branch 'main' of github.com:kurtosis-tech/kardinal-kontrol
laurentluce Aug 30, 2024
02b7f50
Merge branch 'main' into laurent/e2e-tests-1
laurentluce Aug 30, 2024
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
File renamed without changes.
114 changes: 114 additions & 0 deletions .github/workflows/ci-e2e-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
# Our desired pipeline using only a Nix shell environment
name: E2E tests

permissions:
id-token: write
contents: read

on:
push:
branches:
- main
tags:
- "v*.*.*"
pull_request:
branches:
- main

jobs:
e2e_tests:
name: E2E tests
runs-on: ubuntu-22.04
steps:
- name: Git checkout
uses: actions/checkout@v3

- name: Install Nix
uses: cachix/install-nix-action@v27
# relax sandbox due impure kontrol-service tests during build
with:
extra_nix_config: |
sandbox = relaxed

- name: Magic cache
uses: DeterminateSystems/magic-nix-cache-action@v7

- name: Build and load kontrol service image
run: |
docker load < $(nix build ./#kontrol-service-container --no-link --print-out-paths)

- name: Start kontrol service and Postgres
run: |
docker version
docker compose -f ci/docker-compose.yml up -d
docker ps

- name: Wait for docker network to be ready
run: sleep 10s
shell: bash

- name: Install CLI
run: curl get.kardinal.dev -sL | sh

- name: Verify kardinal command
run: bash -c 'source ~/.bashrc; if kardinal | grep -q "Kardinal CLI"; then exit 0; else exit 1; fi'

- name: Retrieve the tenant UUID
id: tenant
run: |
tenant_id=$(kardinal tenant show)
echo "id=${tenant_id}" >> "$GITHUB_OUTPUT"

- name: Deploy boutique demo manifest
run: |
KARDINAL_CLI_DEV_MODE=TRUE kardinal deploy -k ci/obd-demo.yaml

- name: Validate cluster resources endpoint
run: |
tenant_id=${{ steps.tenant.outputs.id }}
services=$(curl http://localhost:8080/tenant/${tenant_id}/cluster-resources | jq -r '.services[].metadata.name' | tr " " "\n" | sort -g | tr "\n" " " | xargs)
if [ "${services}" != "cartservice frontend postgres productcatalogservice" ]; then exit 1; fi
deployments=$(curl http://localhost:8080/tenant/${tenant_id}/cluster-resources | jq -r '.deployments[].metadata.name' | tr " " "\n" | sort -g | tr "\n" " " | xargs)
if [ "${deployments}" != "cartservice-prod frontend-prod postgres-prod productcatalogservice-prod" ]; then exit 1; fi

- name: Validate topology endpoint
run: |
tenant_id=${{ steps.tenant.outputs.id }}
nodes=$(curl http://localhost:8080/tenant/${tenant_id}/topology | jq -r '.nodes[].id' | tr " " "\n" | sort -g | tr "\n" " " | xargs)
if [ "${nodes}" != "cartservice free-currency-api frontend frontend-external postgres productcatalogservice" ]; then exit 1; fi

- name: Create, validate and delete flow
run: |
KARDINAL_CLI_DEV_MODE=TRUE kardinal flow create frontend kurtosistech/frontend:demo-frontend > kardinal.out
flow_id=$(grep "Flow.*created" kardinal.out | cut -d ' ' -f2 | tr -d "\"")
tenant_id=${{ steps.tenant.outputs.id }}
deployments=$(curl http://localhost:8080/tenant/${tenant_id}/cluster-resources | jq -r '.deployments[].metadata.name' | tr " " "\n" | sort -g | tr "\n" " " | xargs)
if [ "${deployments}" != "cartservice-prod frontend-${flow_id} frontend-prod postgres-prod productcatalogservice-prod" ]; then exit 1; fi
KARDINAL_CLI_DEV_MODE=TRUE kardinal flow ls | grep ${flow_id}
KARDINAL_CLI_DEV_MODE=TRUE kardinal flow delete ${flow_id}

- name: Create, validate and delete a more complex flow
run: |
KARDINAL_CLI_DEV_MODE=TRUE kardinal flow create frontend kurtosistech/frontend:demo-on-sale -s productcatalogservice=kurtosistech/productcatalogservice:demo-on-sale > kardinal.out
flow_id=$(grep "Flow.*created" kardinal.out | cut -d ' ' -f2 | tr -d "\"")
tenant_id=${{ steps.tenant.outputs.id }}
deployments=$(curl http://localhost:8080/tenant/${tenant_id}/cluster-resources | jq -r '.deployments[].metadata.name' | tr " " "\n" | sort -g | tr "\n" " " | xargs)
if [ "${deployments}" != "cartservice-prod frontend-${flow_id} frontend-prod postgres-prod productcatalogservice-${flow_id} productcatalogservice-prod" ]; then exit 1; fi
KARDINAL_CLI_DEV_MODE=TRUE kardinal flow ls | grep ${flow_id}
KARDINAL_CLI_DEV_MODE=TRUE kardinal flow delete ${flow_id}

- name: Create template
run: |
KARDINAL_CLI_DEV_MODE=TRUE kardinal template create extra-item-shared --template-yaml ci/template.yaml --description "Extra item and postgres is shared"
KARDINAL_CLI_DEV_MODE=TRUE kardinal template ls | grep "extra-item-shared"

- name: Create flow with template and delete flow
run: |
KARDINAL_CLI_DEV_MODE=TRUE kardinal flow create frontend kurtosistech/frontend:demo-frontend --template-args ci/template_args.yaml --template extra-item-shared > kardinal.out
flow_id=$(grep "Flow.*created" kardinal.out | cut -d ' ' -f2 | tr -d "\"")
KARDINAL_CLI_DEV_MODE=TRUE kardinal flow ls | grep ${flow_id}
KARDINAL_CLI_DEV_MODE=TRUE kardinal flow delete ${flow_id}

- name: Delete template
run: |
KARDINAL_CLI_DEV_MODE=TRUE kardinal template delete extra-item-shared
38 changes: 38 additions & 0 deletions ci/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
networks:
kardinal:
driver: bridge
enable_ipv6: false

services:
kontrol-service:
image: kontrol-service:latest-amd64
restart: always
environment:
- DB_HOSTNAME=postgres
- DB_PORT=5432
- DB_NAME=kardinal
- DB_USERNAME=postgres
- DB_PASSWORD=kurtosis
- DEV_MODE=true
ports:
- '8080:8080'
networks:
- kardinal
depends_on:
- postgres
postgres:
image: postgres:13-alpine
restart: always
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=kurtosis
- POSTGRES_DB=kardinal
ports:
- '5432:5432'
networks:
- kardinal
volumes:
- postgres:/var/lib/postgresql/data
volumes:
postgres:
driver: local
Loading
Loading