Skip to content

Commit

Permalink
Update code (#40)
Browse files Browse the repository at this point in the history
* - Removing deprecated calls
- Fixing some typos

* - Removing deprecated calls
- Fixing some typos
- Adding test go matrix in github action

---------

Co-authored-by: John Roesler <[email protected]>
  • Loading branch information
manuelarte and JohnRoesler authored Nov 18, 2024
1 parent da0154d commit 8cae5b9
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 10 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/go_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,20 @@ jobs:
matrix:
go-version:
- "1.20"
- "1.21"
- "1.22"
name: lint and test
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: golangci-lint
uses: golangci/[email protected]
with:
version: v1.51.2
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: golangci-lint
uses: golangci/[email protected]
with:
version: v1.59.1
- name: test
run: make test
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ If you find a bug then please let the project know by opening an issue after doi

- Do a quick search of the existing issues to make sure the bug isn't already reported
- Try and make a minimal list of steps that can reliably reproduce the bug you are experiencing
- Collect as much information as you can to help identify what the issue is (project version, configuration files, etc)
- Collect as much information as you can to help identify what the issue is (project version, configuration files, etc.)

## Suggesting Enhancements

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[![golangci-lint](https://github.com/go-co-op/gocron-gorm-lock/actions/workflows/go_test.yml/badge.svg)](https://github.com/go-co-op/gocron-gorm-lock/actions/workflows/go_test.yml)
# gocron-gorm-lock
A gocron locker implementation using gorm

Expand Down
2 changes: 1 addition & 1 deletion SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
The current plan is to maintain version 1 as long as possible incorporating any necessary security patches.

| Version | Supported |
| ------- | ------------------ |
|---------|--------------------|
| 1.x.x | :white_check_mark: |

## Reporting a Vulnerability
Expand Down
11 changes: 7 additions & 4 deletions gorm_lock_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
)

func TestNewGormLocker_Validation(t *testing.T) {
t.Parallel()
tests := map[string]struct {
db *gorm.DB
worker string
Expand All @@ -26,7 +27,9 @@ func TestNewGormLocker_Validation(t *testing.T) {
}

for name, tc := range tests {
name, tc := name, tc
t.Run(name, func(t *testing.T) {
t.Parallel()
_, err := NewGormLocker(tc.db, tc.worker)
if assert.Error(t, err) {
assert.ErrorContains(t, err, tc.err)
Expand All @@ -37,7 +40,7 @@ func TestNewGormLocker_Validation(t *testing.T) {

func TestEnableDistributedLocking(t *testing.T) {
ctx := context.Background()
postgresContainer, err := testcontainerspostgres.RunContainer(ctx,
postgresContainer, err := testcontainerspostgres.Run(ctx, "docker.io/postgres:16-alpine",
testcontainers.WithWaitStrategy(wait.ForLog("database system is ready to accept connections").
WithOccurrence(2).WithStartupTimeout(5*time.Second)))
require.NoError(t, err)
Expand Down Expand Up @@ -97,7 +100,7 @@ func TestEnableDistributedLocking(t *testing.T) {

func TestEnableDistributedLocking_DifferentJob(t *testing.T) {
ctx := context.Background()
postgresContainer, err := testcontainerspostgres.RunContainer(ctx,
postgresContainer, err := testcontainerspostgres.Run(ctx, "docker.io/postgres:16-alpine",
testcontainers.WithWaitStrategy(wait.ForLog("database system is ready to accept connections").
WithOccurrence(2).WithStartupTimeout(5*time.Second)))
require.NoError(t, err)
Expand Down Expand Up @@ -182,7 +185,7 @@ func TestEnableDistributedLocking_DifferentJob(t *testing.T) {

func TestJobReturningExceptionWhenUnique(t *testing.T) {
ctx := context.Background()
postgresContainer, err := testcontainerspostgres.RunContainer(ctx,
postgresContainer, err := testcontainerspostgres.Run(ctx, "docker.io/postgres:16-alpine",
testcontainers.WithWaitStrategy(wait.ForLog("database system is ready to accept connections").
WithOccurrence(2).WithStartupTimeout(5*time.Second)))
require.NoError(t, err)
Expand Down Expand Up @@ -220,7 +223,7 @@ func TestJobReturningExceptionWhenUnique(t *testing.T) {

func TestHandleTTL(t *testing.T) {
ctx := context.Background()
postgresContainer, err := testcontainerspostgres.RunContainer(ctx,
postgresContainer, err := testcontainerspostgres.Run(ctx, "docker.io/postgres:16-alpine",
testcontainers.WithWaitStrategy(wait.ForLog("database system is ready to accept connections").
WithOccurrence(2).WithStartupTimeout(5*time.Second)))
require.NoError(t, err)
Expand Down

0 comments on commit 8cae5b9

Please sign in to comment.