тест
Some checks failed
Unit tests / container-network-test (push) Failing after 3s

This commit is contained in:
Olga Nemt 2024-12-18 11:20:57 +05:00
parent e78e8381d3
commit a1fa5651c8

View File

@ -2,46 +2,62 @@ name: Unit tests
run-name: ${{ gitea.actor }} is testing run-name: ${{ gitea.actor }} is testing
on: push on: push
env:
POSTGRES_HOST: persistence-cicd-test-postgres-db
POSTGRES_PORT: 5442
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
jobs: jobs:
test: container-network-test:
runs-on: ubuntu-latest runs-on: ubuntu-latest
# Service containers to run with `runner-job`
services: services:
# Label used to access the service container
postgres: postgres:
# Docker Hub image
image: postgres image: postgres
# Provide the password for postgres
# hostname: ${{ env.POSTGRES_HOST }}
env: env:
POSTGRES_USER: ${{ env.POSTGRES_USER }} POSTGRES_PASSWORD: postgres
POSTGRES_PASSWORD: ${{ env.POSTGRES_PASSWORD }} POSTGRES_USER: postgres
# Set health checks to wait until postgres has started POSTGRES_DB: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports: ports:
# Maps tcp port 5432 on service container to the host - 5442:5432
- '${{ env.POSTGRES_PORT }}:5432' options: --health-cmd pg_isready --health-interval 5s --health-timeout 5s --health-retries 10
steps: steps:
- name: Setup dotnet - uses: actions/checkout@v4
uses: actions/setup-dotnet@v4 - name: Run docker action and test network connection
uses: ./
with: with:
dotnet-version: 8.0.x image: postgres
- name: Check out repository code run: >
uses: actions/checkout@v4 pg_isready -d test -U test -h postgres -p 5442
- name: Run integration tests options: >
env: -e PGPASSWORD=postgres
POSTGRES_HOST: persistence-cicd-test-postgres-db # test:
POSTGRES_PORT: ${{ env.POSTGRES_PORT }} # runs-on: ubuntu-latest
run: dotnet test DD.Persistence.IntegrationTests
# # Service containers to run with `runner-job`
# services:
# # Label used to access the service container
# postgres:
# # Docker Hub image
# image: postgres
# # Provide the password for postgres
# # hostname: ${{ env.POSTGRES_HOST }}
# env:
# POSTGRES_USER: ${{ env.POSTGRES_USER }}
# POSTGRES_PASSWORD: ${{ env.POSTGRES_PASSWORD }}
# # Set health checks to wait until postgres has started
# options: >-
# --health-cmd pg_isready
# --health-interval 10s
# --health-timeout 5s
# --health-retries 5
# ports:
# # Maps tcp port 5432 on service container to the host
# - '${{ env.POSTGRES_PORT }}:5432'
# steps:
# - name: Setup dotnet
# uses: actions/setup-dotnet@v4
# with:
# dotnet-version: 8.0.x
# - name: Check out repository code
# uses: actions/checkout@v4
# - name: Run integration tests
# env:
# POSTGRES_HOST: persistence-cicd-test-postgres-db
# POSTGRES_PORT: ${{ env.POSTGRES_PORT }}
# run: dotnet test DD.Persistence.IntegrationTests