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

Commit

Permalink
feat: E2E tests iteration #1 (#4)
Browse files Browse the repository at this point in the history
* chore(main): release 0.1.16 (#162)

:robot: I have created a release *beep* *boop*
---


##
[0.1.16](kurtosis-tech/kardinal-kontrol-private@0.1.15...0.1.16)
(2024-08-16)


### Features

* allow for templates to work
([#160](kurtosis-tech/kardinal-kontrol-private#160))
([3f70e0a](kurtosis-tech/kardinal-kontrol-private@3f70e0a))
* RDS cloud formation and DB secrets exposed to kontrol service pods
([#147](kurtosis-tech/kardinal-kontrol-private#147))
([0457a89](kurtosis-tech/kardinal-kontrol-private@0457a89))


### Bug Fixes

* allow for job to run on kontrol private repo
([#170](kurtosis-tech/kardinal-kontrol-private#170))
([786e7be](kurtosis-tech/kardinal-kontrol-private@786e7be))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

* E2E tests

* Run on changes

* Run on changes

* Run on changes

* Fix docker compose cmd line

* Fix docker compose cmd line

* Build and load kontrol service image

* Install nix

* List images

* Update docker compose file to use the built kontrol service image

* Kardinal deploy and flow

* Delete flows

* Cluster resources endpoint check

* Fix deploy parsing

* CLI in dev mode - Use tenant show command

* List docker containers running

* Debug docker networking

* Debug docker networking

* Debug docker networking

* Deployments validation

* Docker compose ports localhost set

* Debug docker networking

* Fix tenant output

* Debug docker networking

* Debug docker networking

* Debug docker networking

* Debug cluster resources check

* Fix deployments check

* Update deployments checks

* Fix deployments check

* Template e2e tests

* Fix topology nodes retrieval

* Renaming

* Check flow ls and template ls commands

* Refactoring

* Cleanup

---------

Co-authored-by: Edgar Gomes <[email protected]>
  • Loading branch information
laurentluce and lostbean authored Aug 30, 2024
1 parent c10f2d4 commit b6fae2f
Show file tree
Hide file tree
Showing 6 changed files with 518 additions and 0 deletions.
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

0 comments on commit b6fae2f

Please sign in to comment.