Robot tests wip

This commit is contained in:
Zoe Roux 2024-09-11 12:05:06 +02:00
parent 8b1cf61209
commit 662457d0f1
No known key found for this signature in database
9 changed files with 40 additions and 15 deletions

View File

@ -14,11 +14,14 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Pull images
run: |
cp .env.example .env
docker compose version
docker compose pull
- name: Robot cache
uses: actions/setup-python@v4
with:
python-version: '3.9'
cache: 'pip'
- name: Install robot
run: pip install -r requirements.txt
- name: Docker cache
uses: satackey/action-docker-layer-caching@v0.0.11
@ -26,18 +29,18 @@ jobs:
- name: Start the service
run: |
docker compose up -d back postgres traefik meilisearch --wait
cp .env.example .env
docker compose -f docker-compose.build.yml up -d auth postgres traefik --wait
- name: Perform healthchecks
run: |
docker compose ps -a
docker compose logs
wget --retry-connrefused --retry-on-http-error=502 http://localhost:8901/api/health || (docker compose logs && exit 1)
# wget --retry-connrefused --retry-on-http-error=502 http://localhost:8901/api/health || (docker compose logs && exit 1)
- name: Run robot tests
run: |
pip install -r back/tests/robot/requirements.txt
robot -d out back/tests/robot/
robot -d out $(find -type d -name robot)
- name: Show logs
if: failure()

View File

@ -7,7 +7,8 @@ RUN go install github.com/swaggo/swag/cmd/swag@latest
COPY go.mod go.sum ./
RUN go mod download
COPY sqlc.yaml sql ./
COPY sqlc.yaml ./
COPY sql ./sql
RUN sqlc generate
COPY . .

View File

@ -79,6 +79,7 @@ func OpenDatabase() (*pgxpool.Pool, error) {
config.ConnConfig.RuntimeParams["search_path"] = schema
}
fmt.Printf("Connecting to database with %v\n", config)
db, err := pgxpool.NewWithConfig(ctx, config)
if err != nil {
fmt.Printf("Could not connect to database, check your env variables!")
@ -143,7 +144,7 @@ func main() {
db, err := OpenDatabase()
if err != nil {
e.Logger.Fatal("Could not open databse: %v", err)
e.Logger.Fatal("Could not open databse: ", err)
return
}
@ -152,7 +153,7 @@ func main() {
}
conf, err := LoadConfiguration(h.db)
if err != nil {
e.Logger.Fatal("Could not load configuration: %v", err)
e.Logger.Fatal("Could not load configuration: ", err)
return
}
h.config = conf

View File

@ -1,7 +1,7 @@
*** Settings ***
Documentation Common things to handle rest requests
Library REST http://localhost:8901/api
Library REST http://localhost:8901/auth
*** Keywords ***

View File

@ -1,7 +1,7 @@
*** Settings ***
Documentation Tests of the /sessions route.
Resource ../auth.resource
Resource ./auth.resource
*** Test Cases ***

View File

@ -2,7 +2,7 @@
Documentation Tests of the /users route.
... Ensures that the user can authenticate on kyoo.
Resource ../auth.resource
Resource ./auth.resource
*** Test Cases ***

View File

@ -60,6 +60,23 @@ services:
- "traefik.enable=true"
- "traefik.http.routers.front.rule=PathPrefix(`/`)"
auth:
build: ./auth
restart: on-failure
depends_on:
postgres:
condition: service_healthy
env_file:
- ./.env
labels:
- "traefik.enable=true"
- "traefik.http.routers.auth.rule=PathPrefix(`/auth/`)"
- "traefik.http.routers.auth.middlewares=auth-sp"
- "traefik.http.middlewares.auth-sp.stripprefix.prefixes=/auth"
- "traefik.http.middlewares.auth-sp.stripprefix.forceSlash=false"
profiles:
- "v5"
scanner:
build: ./scanner
restart: on-failure

View File

@ -11,6 +11,9 @@
dataclasses-json
msgspec
langcodes
robotframework
# restinstance needs to be packaged
]);
dotnet = with pkgs.dotnetCorePackages;
combinePackages [