Update workflow to dump Docker logs on failure and improve PostgreSQL container configuration

- Add Docker logs capturing step in GitHub Actions workflow for better debugging.
- Update PostgreSQL test container to use `postgres:16-alpine` with enhanced configuration options.
- Set database connection `Max Pool Size` to 20 in component tests.
This commit is contained in:
Sipke Schoorstra 2025-12-10 10:55:52 +01:00
parent baf2495fd5
commit 56089c95f1
No known key found for this signature in database
GPG key ID: 5C10502B28A4268F
3 changed files with 20 additions and 2 deletions

View file

@ -70,6 +70,17 @@ jobs:
dotnet test "$project" --configuration Release --no-build --logger "GitHubActions;report-warnings=false" /p:CollectCoverage=true
done
- name: Dump docker logs on failure
if: failure()
run: |
echo "=== Docker containers ==="
docker ps -a || true
echo "=== Docker logs ==="
for container in $(docker ps -aq); do
echo "--- Logs for container $container ---"
docker logs "$container" 2>&1 | tail -100 || true
done
- name: Install ReportGenerator
run: dotnet tool install -g dotnet-reportgenerator-globaltool

View file

@ -6,10 +6,17 @@ namespace Elsa.Workflows.ComponentTests.Fixtures;
public class Infrastructure : IAsyncLifetime
{
public readonly PostgreSqlContainer DbContainer = new PostgreSqlBuilder()
.WithImage("postgres:latest")
.WithImage("postgres:16-alpine")
.WithDatabase("elsa")
.WithUsername("postgres")
.WithPassword("postgres")
.WithCommand(
"postgres",
"-c", "max_connections=25",
"-c", "shared_buffers=128MB",
"-c", "work_mem=4MB",
"-c", "effective_cache_size=256MB"
)
.Build();
public readonly RabbitMqContainer RabbitMqContainer = new RabbitMqBuilder()

View file

@ -55,7 +55,7 @@ public class WorkflowServer(Infrastructure infrastructure, string url) : WebAppl
protected override void ConfigureWebHost(IWebHostBuilder builder)
{
var dbConnectionString = infrastructure.DbContainer.GetConnectionString();
var dbConnectionString = infrastructure.DbContainer.GetConnectionString() + ";Max Pool Size=20;";
var rabbitMqConnectionString = infrastructure.RabbitMqContainer.GetConnectionString();
builder.UseUrls(url);