Skip to content

Conversation

@mpilquist
Copy link
Member

@mpilquist mpilquist commented Mar 25, 2025

Adds support for connecting to the Postgres server via unix domain sockets.

Example usage:

Session.Builder[IO] .withUnixSockets .withUser("jimmy") .withDatabase("world") .single

The above configuration results in connecting via /tmp/.s.PGSQL.5432. Variations of withUnixSockets are supplied for customizing the path.

Supports both trust and peer authentication types.

TODO: Figure out how to test this with the current docker-compose based configuration

@mpilquist
Copy link
Member Author

I tried adding a test in c521068 but it fails on Mac w/ Colima due to permissions issues. The new container fails to start with this error:

025-03-25 12:57:24.774 UTC [49] LOG: could not set permissions of file "/var/run/postgresql/.s.PGSQL.5432": Invalid argument 2025-03-25 12:57:24.774 UTC [49] WARNING: could not create Unix-domain socket in directory "/var/run/postgresql" 2025-03-25 12:57:24.774 UTC [49] FATAL: could not create any Unix-domain sockets 2025-03-25 12:57:24.782 UTC [49] LOG: database system is shut down 

Tried various things (e.g. changing fstype used by Colima, symlink nonsense, etc) without luck.

ThisBuild / tlCiReleaseBranches += "series/0.6.x"
ThisBuild / tlCiScalafmtCheck := false
ThisBuild / tlSitePublishBranch := Some("series/0.6.x")
ThisBuild / githubWorkflowOSes := Seq("ubuntu-latest")
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't need this (anymore?)

Tests.Argument(TestFrameworks.MUnit, "--exclude-tags=" + excludedTags.mkString(","))
else Tests.Argument()
},
Test / baseDirectory := (ThisBuild / Test / run / baseDirectory).value
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make forked tests working directory be root of build instead of root of submodule

@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 52.17391% with 11 lines in your changes missing coverage. Please review.

Project coverage is 83.24%. Comparing base (a2c4f74) to head (7ca500b).
Report is 197 commits behind head on main.

Files with missing lines Patch % Lines
modules/core/shared/src/main/scala/Session.scala 50.00% 11 Missing ⚠️
Additional details and impacted files
@@ Coverage Diff @@ ## main #1192 +/- ## ========================================== - Coverage 83.94% 83.24% -0.70%  ========================================== Files 138 140 +2 Lines 2136 2238 +102 Branches 243 230 -13 ========================================== + Hits 1793 1863 +70  - Misses 343 375 +32 

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
fs2.io.compression.fs2ioCompressionForIO
}

final val isJVM = false
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

munit.internal.PlatformCompat has appropriate isJVM/isJS/isNative since munit 1.2.0.

def withHost(newHost: Host): Builder[F] =
copy(host = newHost)

/** Configures the post of the Postgres server. Throws `IllegalArgumentException` if the specified port is not a valid port number. */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/** Configures the post of the Postgres server. Throws `IllegalArgumentException` if the specified port is not a valid port number. */
/** Configures the port of the Postgres server. Throws `IllegalArgumentException` if the specified port is not a valid port number. */
Copy link
Contributor

@vendamere vendamere left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried it out on a project and it worked well. Looking forward to this being merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

6 participants