Files
opentf/internal/backend/remote-state/pg
Martin Atkins 9568e66ea2 backend/pg: Use a guaranteed-invalid host for invalid hostname test
"hostthatdoesnotexist" is not a hostname that is guaranteed to be unused,
and on some systems a hostname without any dots causes an implicit search
within various domain suffixes. There is no explicitly-specified rule for
what error should be returned when suffix-based search fails, so different
implementations handle that differently and this test was not written to
tolerate those differences, causing false failures.

The "invalid" top-level domain is reserved by RFC 6761 and required to
always cause the NXDOMAIN error, which is the DNS error required to produce
the error message this test expects.

Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
2026-03-24 17:31:01 -07:00
..

Run the integration tests:

container_id=$(docker run --rm --name opentofu-psql -p 5432:5432 -e POSTGRES_PASSWORD=tofu -d postgres)
TF_ACC=1 TF_PG_TEST=1 DATABASE_URL="postgresql://postgres:tofu@localhost:5432/postgres?sslmode=disable" \
  go test github.com/opentofu/opentofu/internal/backend/remote-state/pg
docker rm ${container_id} -f