Skip to content

Commit

Permalink
chore: change default postgres container shm size to 128MB
Browse files Browse the repository at this point in the history
  • Loading branch information
atzoum committed Oct 18, 2023
1 parent 35f3f81 commit 6ba6edb
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
20 changes: 20 additions & 0 deletions sync/plocker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,24 @@ func TestPartitionLocker(t *testing.T) {
wg.Wait()
require.Equalf(t, goroutines, counter, "it should have incremented the counter %d times", goroutines)
})

t.Run("Try to lock the same partition twice", func(t *testing.T) {

type l struct {
locker sync.PartitionLocker
}
var s l
s.locker = *sync.NewPartitionLocker()
var locks int
const id = "id"
s.locker.Lock(id)
go func() {
s.locker.Lock(id)
locks = locks + 1
s.locker.Unlock(id)
}()
require.Never(t, func() bool { return locks == 1 }, 100*time.Millisecond, 1*time.Millisecond)
s.locker.Unlock(id)
require.Eventually(t, func() bool { return locks == 1 }, 100*time.Millisecond, 1*time.Millisecond)
})
}
2 changes: 1 addition & 1 deletion testhelper/docker/resource/postgres.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ type PostgresResource struct {
func SetupPostgres(pool *dockertest.Pool, d cleaner, opts ...func(*postgres.Config)) (*PostgresResource, error) {
c := &postgres.Config{
Tag: "15-alpine",
ShmSize: 512 * bytesize.MB,
ShmSize: 128 * bytesize.MB,
}
for _, opt := range opts {
opt(c)
Expand Down

0 comments on commit 6ba6edb

Please sign in to comment.