Skip to content

Add gnomock.WithShmSize option#1221

Open
bayandin wants to merge 3 commits intoorlangure:masterfrom
bayandin:add-shm-size
Open

Add gnomock.WithShmSize option#1221
bayandin wants to merge 3 commits intoorlangure:masterfrom
bayandin:add-shm-size

Conversation

@bayandin
Copy link

@bayandin bayandin commented Oct 30, 2025

This PR adds gnomock.WithShmSize option, allowing to configure a container’s shared memory size (just like Docker’s --shm-size flag).

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds support for configuring Docker container shared memory size through a new gnomock.WithShmSize option, mirroring Docker's --shm-size flag functionality. This is particularly useful for applications like PostgreSQL that may require more than the default 64MB of shared memory.

Key Changes:

  • Introduces WithShmSize option function for setting container shared memory size in bytes
  • Adds ShmSize field to the Options struct with appropriate JSON serialization
  • Implements conditional application of the shared memory size in container creation (only when > 0)

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
options.go Adds WithShmSize option function and ShmSize field to Options struct with documentation
docker.go Implements the shared memory size configuration by conditionally setting hostConfig.ShmSize during container creation
gnomock_test.go Adds comprehensive test that verifies the shared memory size is correctly applied by inspecting the created container

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants