MarcoIeni / release-plz

Publish Rust crates from CI with a Release PR.
https://release-plz.ieni.dev
Apache License 2.0
842 stars 87 forks source link

Tests broken with podman #1318

Open VorpalBlade opened 8 months ago

VorpalBlade commented 8 months ago

Bug description

While trying to make a PR for release-plz I have had lots of issues running the test suite. I have podman, not docker, installed. And it is failing with Error: no container with name or ID "gitea" found: no such container. I thought the issue was image: gitea/gitea:1.21.6-rootless rather than specifying which registry it is supposed to come from (podman wants you to specify docker.io/library/gitea/gitea:1.21.6-rootless, the docker.io registry isn't considered more "blessed" than any other registry), but even changing that didn't fix the test run.

To Reproduce

Steps to reproduce the behavior:

  1. Install podman instead of docker
  2. cd tests; podman-compose up
  3. Images don't start due to assuming docker.io is the default

If I apply the basic fix the containers start:

diff --git a/tests/docker-compose.yml b/tests/docker-compose.yml
index 3a1ad32..4b0ceb4 100644
--- a/tests/docker-compose.yml
+++ b/tests/docker-compose.yml
@@ -4,7 +4,7 @@ services:
   # We use Gitea as a git server.
   # We test that release-plz can open PRs, create releases, etc.
   gitea:
-    image: gitea/gitea:1.21.6-rootless
+    image: docker.io/gitea/gitea:1.21.6-rootless
     container_name: gitea
     restart: always
     environment:
@@ -27,7 +27,7 @@ services:
   # We use postgres as a database for Gitea.
   # With SqlLite I had problems related to database locks.
   db:
-    image: postgres:16
+    image: docker.io/library/postgres:16
     restart: always
     environment:
       - POSTGRES_USER=gitea

But the tests still don't pass:

     Running tests/all/main.rs (/home/arvid/src/release-plz/target/debug/deps/all-12ac55b45984c782)

running 8 tests
test completion_test::test_generate_completions ... ok
2024/03/03 10:20:44 models/user/user.go:744:countUsers() [E] user.countUsers: dial tcp: lookup db on 10.89.2.1:53: read udp 10.89.2.8:55763->10.89.2.1:53: read: connection refused
Command error: CreateUser: dial tcp: lookup db on 10.89.2.1:53: read udp 10.89.2.8:36434->10.89.2.1:53: read: connection refused
2024/03/03 10:20:54 models/user/user.go:744:countUsers() [E] user.countUsers: dial tcp: lookup db on 10.89.2.1:53: read udp 10.89.2.8:38771->10.89.2.1:53: read: connection refused
test changelog::release_plz_adds_custom_changelog ... FAILED
2024/03/03 10:21:00 models/user/user.go:744:countUsers() [E] user.countUsers: dial tcp: lookup db on 10.89.2.1:53: read udp 10.89.2.8:36206->10.89.2.1:53: i/o timeout
2024/03/03 10:21:00 models/user/user.go:744:countUsers() [E] user.countUsers: dial tcp: lookup db on 10.89.2.1:53: read udp 10.89.2.8:56396->10.89.2.1:53: i/o timeout
2024/03/03 10:21:00 models/user/user.go:744:countUsers() [E] user.countUsers: dial tcp: lookup db on 10.89.2.1:53: read udp 10.89.2.8:58098->10.89.2.1:53: i/o timeout
2024/03/03 10:21:00 models/user/user.go:744:countUsers() [E] user.countUsers: dial tcp: lookup db on 10.89.2.1:53: read udp 10.89.2.8:58272->10.89.2.1:53: i/o timeout
2024/03/03 10:21:00 models/user/user.go:744:countUsers() [E] user.countUsers: dial tcp: lookup db on 10.89.2.1:53: read udp 10.89.2.8:55493->10.89.2.1:53: i/o timeout
Command error: CreateUser: dial tcp: lookup db on 10.89.2.1:53: read udp 10.89.2.8:38991->10.89.2.1:53: read: connection refused
test changelog::release_plz_does_not_open_release_pr_if_there_are_no_release_commits ... FAILED
Command error: CreateUser: dial tcp: lookup db on 10.89.2.1:53: read udp 10.89.2.8:55065->10.89.2.1:53: read: connection refused
test helpers::gitea::gitea_new::can_create_gitea_repository ... FAILED
Command error: CreateUser: dial tcp: lookup db on 10.89.2.1:53: read udp 10.89.2.8:32869->10.89.2.1:53: i/o timeout
Command error: CreateUser: dial tcp: lookup db on 10.89.2.1:53: read udp 10.89.2.8:42865->10.89.2.1:53: read: connection refused
Command error: CreateUser: dial tcp: lookup db on 10.89.2.1:53: read udp 10.89.2.8:44485->10.89.2.1:53: read: connection refused
test changelog::release_plz_releases_a_new_project ... FAILED
test changelog::release_plz_adds_changelog_on_new_project ... FAILED
test release::release_plz_releases_a_new_project_with_custom_tag_name ... FAILED
Command error: CreateUser: dial tcp: lookup db on 10.89.2.1:53: read udp 10.89.2.8:57244->10.89.2.1:53: i/o timeout
test release::release_plz_releases_a_new_project_with_custom_release_name ... FAILED

failures:

---- changelog::release_plz_adds_custom_changelog stdout ----
thread 'changelog::release_plz_adds_custom_changelog' panicked at crates/release_plz/tests/all/helpers/gitea/gitea_new.rs:50:10:
called `Result::unwrap()` on an `Err` value: reqwest::Error { kind: Request, url: Url { scheme: "http", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("localhost")), port: Some(3000), path: "/api/v1/users/ugwgrnyl/tokens", query: None, fragment: None }, source: hyper::Error(Io, Os { code: 104, kind: ConnectionReset, message: "Connection reset by peer" }) }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

---- changelog::release_plz_does_not_open_release_pr_if_there_are_no_release_commits stdout ----
thread 'changelog::release_plz_does_not_open_release_pr_if_there_are_no_release_commits' panicked at crates/release_plz/tests/all/helpers/gitea/gitea_new.rs:50:10:
called `Result::unwrap()` on an `Err` value: reqwest::Error { kind: Request, url: Url { scheme: "http", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("localhost")), port: Some(3000), path: "/api/v1/users/zcofrwcr/tokens", query: None, fragment: None }, source: hyper::Error(Io, Os { code: 104, kind: ConnectionReset, message: "Connection reset by peer" }) }

---- helpers::gitea::gitea_new::can_create_gitea_repository stdout ----
thread 'helpers::gitea::gitea_new::can_create_gitea_repository' panicked at crates/release_plz/tests/all/helpers/gitea/gitea_new.rs:50:10:
called `Result::unwrap()` on an `Err` value: reqwest::Error { kind: Request, url: Url { scheme: "http", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("localhost")), port: Some(3000), path: "/api/v1/users/vymbvwti/tokens", query: None, fragment: None }, source: hyper::Error(Io, Os { code: 104, kind: ConnectionReset, message: "Connection reset by peer" }) }

---- changelog::release_plz_releases_a_new_project stdout ----
thread 'changelog::release_plz_releases_a_new_project' panicked at crates/release_plz/tests/all/helpers/gitea/gitea_new.rs:50:10:
called `Result::unwrap()` on an `Err` value: reqwest::Error { kind: Request, url: Url { scheme: "http", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("localhost")), port: Some(3000), path: "/api/v1/users/uizjmsqj/tokens", query: None, fragment: None }, source: hyper::Error(Io, Os { code: 104, kind: ConnectionReset, message: "Connection reset by peer" }) }

---- changelog::release_plz_adds_changelog_on_new_project stdout ----
thread 'changelog::release_plz_adds_changelog_on_new_project' panicked at crates/release_plz/tests/all/helpers/gitea/gitea_new.rs:50:10:
called `Result::unwrap()` on an `Err` value: reqwest::Error { kind: Request, url: Url { scheme: "http", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("localhost")), port: Some(3000), path: "/api/v1/users/fmpzbkcg/tokens", query: None, fragment: None }, source: hyper::Error(Io, Os { code: 104, kind: ConnectionReset, message: "Connection reset by peer" }) }

---- release::release_plz_releases_a_new_project_with_custom_tag_name stdout ----
thread 'release::release_plz_releases_a_new_project_with_custom_tag_name' panicked at crates/release_plz/tests/all/helpers/gitea/gitea_new.rs:50:10:
called `Result::unwrap()` on an `Err` value: reqwest::Error { kind: Request, url: Url { scheme: "http", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("localhost")), port: Some(3000), path: "/api/v1/users/bvkkgupm/tokens", query: None, fragment: None }, source: hyper::Error(Io, Os { code: 104, kind: ConnectionReset, message: "Connection reset by peer" }) }

---- release::release_plz_releases_a_new_project_with_custom_release_name stdout ----
thread 'release::release_plz_releases_a_new_project_with_custom_release_name' panicked at crates/release_plz/tests/all/helpers/gitea/gitea_new.rs:50:10:
called `Result::unwrap()` on an `Err` value: reqwest::Error { kind: Request, url: Url { scheme: "http", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("localhost")), port: Some(3000), path: "/api/v1/users/cgaabsmk/tokens", query: None, fragment: None }, source: hyper::Error(Io, Os { code: 104, kind: ConnectionReset, message: "Connection reset by peer" }) }

failures:
    changelog::release_plz_adds_changelog_on_new_project
    changelog::release_plz_adds_custom_changelog
    changelog::release_plz_does_not_open_release_pr_if_there_are_no_release_commits
    changelog::release_plz_releases_a_new_project
    helpers::gitea::gitea_new::can_create_gitea_repository
    release::release_plz_releases_a_new_project_with_custom_release_name
    release::release_plz_releases_a_new_project_with_custom_tag_name

test result: FAILED. 1 passed; 7 failed; 0 ignored; 0 measured; 0 filtered out; finished in 40.68s

error: test failed, to rerun pass `-p release-plz --test all`

Expected behavior

Images should start and work just fine. And work with tests. I cannot install docker, I have a setup that assumes podman for other critical things.

Screenshots

Environment

Additional context

VorpalBlade commented 8 months ago

Seems part of the problem is that it gitea doesn't manage to talk to the database:

[gitea] | 2024/03/03 10:21:47 routers/common/db.go:37:InitDBEngine() [I] Backing off for 3 seconds
[gitea] | 2024/03/03 10:21:50 routers/common/db.go:30:InitDBEngine() [I] ORM engine initialization attempt #9/10...
[gitea] | 2024/03/03 10:21:50 cmd/web.go:194:serveInstalled() [I] PING DATABASE postgres
[gitea] | 2024/03/03 10:21:55 routers/common/db.go:36:InitDBEngine() [E] ORM engine initialization attempt #9/10 failed. Error: dial tcp: lookup db on 10.89.2.1:53: read udp 10.89.2.8:37392->10.89.2.1:53: read: connection refused

I assume this earlier message has something to do with it:

[db]    | The files belonging to this database system will be owned by user "postgres".
[db]    | This user must also own the server process.
[db]    | 
[db]    | The database cluster will be initialized with locale "en_US.utf8".
[db]    | The default database encoding has accordingly been set to "UTF8".
[db]    | The default text search configuration will be set to "english".
[db]    | 
[db]    | Data page checksums are disabled.
[db]    | 
[db]    | fixing permissions on existing directory /var/lib/postgresql/data ... ok
[db]    | creating subdirectories ... ok
[db]    | selecting dynamic shared memory implementation ... posix
[db]    | selecting default max_connections ... 100
[db]    | selecting default shared_buffers ... 128MB
[db]    | selecting default time zone ... Etc/UTC
[db]    | creating configuration files ... ok
[db]    | running bootstrap script ... ok
[db]    | performing post-bootstrap initialization ... ok
[db]    | syncing data to disk ... ok
[db]    | 
[db]    | 
[db]    | Success. You can now start the database server using:
[db]    | 
[db]    |     pg_ctl -D /var/lib/postgresql/data -l logfile start
[db]    | 
[db]    | waiting for server to start....2024-03-03 10:20:36.730 UTC [45] LOG:  starting PostgreSQL 16.2 (Debian 16.2-1.pgdg120+2) on x86_64-pc-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit
[db]    | 2024-03-03 10:20:36.731 UTC [45] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
[db]    | 2024-03-03 10:20:36.734 UTC [48] LOG:  database system was shut down at 2024-03-03 10:20:36 UTC
[db]    | 2024-03-03 10:20:36.737 UTC [45] LOG:  database system is ready to accept connections
[db]    |  done
[db]    | server started
[db]    | CREATE DATABASE
[db]    | 
[db]    | 
[db]    | /usr/local/bin/docker-entrypoint.sh: ignoring /docker-entrypoint-initdb.d/*
[db]    | 
[db]    | waiting for server to shut down...2024-03-03 10:20:36.896 UTC [45] LOG:  received fast shutdown request
[db]    | .2024-03-03 10:20:36.897 UTC [45] LOG:  aborting any active transactions
[db]    | 2024-03-03 10:20:36.898 UTC [45] LOG:  background worker "logical replication launcher" (PID 51) exited with exit code 1
[db]    | 2024-03-03 10:20:36.898 UTC [46] LOG:  shutting down
[db]    | 2024-03-03 10:20:36.899 UTC [46] LOG:  checkpoint starting: shutdown immediate
[db]    | 2024-03-03 10:20:37.062 UTC [46] LOG:  checkpoint complete: wrote 923 buffers (5.6%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.013 s, sync=0.149 s, total=0.164 s; sync files=301, longest=0.002 s, average=0.001 s; distance=4257 kB, estimate=4257 kB; lsn=0/1913068, redo lsn=0/1913068
[db]    | 2024-03-03 10:20:37.068 UTC [45] LOG:  database system is shut down
[db]    |  done
[db]    | server stopped
[db]    | 
[db]    | PostgreSQL init process complete; ready for start up.
[db]    | 

Seems like the database starts up but then shuts down again? Maybe? This is well outside my expertise.

MarcoIeni commented 8 months ago

I don't use podman myself. If anybody has a fix, I will review the PR 👍