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: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Pull images - name: Robot cache
run: | uses: actions/setup-python@v4
cp .env.example .env with:
docker compose version python-version: '3.9'
docker compose pull cache: 'pip'
- name: Install robot
run: pip install -r requirements.txt
- name: Docker cache - name: Docker cache
uses: satackey/action-docker-layer-caching@v0.0.11 uses: satackey/action-docker-layer-caching@v0.0.11
@ -26,18 +29,18 @@ jobs:
- name: Start the service - name: Start the service
run: | 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 - name: Perform healthchecks
run: | run: |
docker compose ps -a docker compose ps -a
docker compose logs 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 - name: Run robot tests
run: | run: |
pip install -r back/tests/robot/requirements.txt robot -d out $(find -type d -name robot)
robot -d out back/tests/robot/
- name: Show logs - name: Show logs
if: failure() if: failure()

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -60,6 +60,23 @@ services:
- "traefik.enable=true" - "traefik.enable=true"
- "traefik.http.routers.front.rule=PathPrefix(`/`)" - "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: scanner:
build: ./scanner build: ./scanner
restart: on-failure restart: on-failure

View File

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