Skip to content

Commit

Permalink
feature: support v2024.2
Browse files Browse the repository at this point in the history
Signed-off-by: Valery Piashchynski <piashchynski.valery@gmail.com>
  • Loading branch information
rustatian committed Jul 4, 2024
1 parent 8911719 commit 0152a04
Show file tree
Hide file tree
Showing 15 changed files with 182 additions and 65 deletions.
11 changes: 11 additions & 0 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

set -e -o pipefail

# https://github.com/koalaman/shellcheck/wiki/SC2039#redirect-both-stdout-and-stderr
if ! command -v golangci-lint 2>&1 /dev/null; then
echo "golangci-lint is not installed"
exit 1
fi

exec golangci-lint --build-tags=race run "$@"
2 changes: 1 addition & 1 deletion .github/workflows/linters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ jobs:
- name: Run linter
uses: golangci/golangci-lint-action@v6.0.1 # Action page: <https://github.com/golangci/golangci-lint-action>
with:
version: v1.56 # without patch version
version: v1.59 # without patch version
only-new-issues: false # show only new issues if it's a pull request
args: --timeout=10m --build-tags=race
10 changes: 1 addition & 9 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
name: resetter

on:
push:
branches:
- master
- stable
pull_request:
branches:
- master
- stable
on: [push, pull_request]

jobs:
resetter_test:
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@
# Dependency directories (remove the comment below to include it)
# vendor/
.idea
.DS_Store
.DS_Store
**/composer.lock
14 changes: 3 additions & 11 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,11 @@

run:
timeout: 1m
skip-dirs:
- .github
- .git
allow-parallel-runners: true

output:
format: colored-line-number # colored-line-number|line-number|json|tab|checkstyle|code-climate

linters-settings:
wsl:
allow-assign-and-anything: true
govet:
check-shadowing: true
golint:
min-confidence: 0.1
gocyclo:
min-complexity: 15
godot:
Expand All @@ -36,7 +26,6 @@ linters-settings:
range-loops: true
for-loops: true
nolintlint:
allow-leading-space: false
require-specific: true

linters: # All available linters list: <https://golangci-lint.run/usage/linters/>
Expand Down Expand Up @@ -76,6 +65,9 @@ linters: # All available linters list: <https://golangci-lint.run/usage/linters/
- whitespace # Tool for detection of leading and trailing whitespace

issues:
exclude-dirs:
- .github
- .git
exclude-rules:
- path: _test\.go
linters:
Expand Down
7 changes: 7 additions & 0 deletions githooks-installer.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh

set -e

cp ./.githooks/pre-commit .git/hooks/pre-commit

echo "DONE"
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/roadrunner-server/resetter/v4
module github.com/roadrunner-server/resetter/v5

go 1.22.4
go 1.22.5

require (
github.com/roadrunner-server/endure/v2 v2.4.5
Expand Down
2 changes: 1 addition & 1 deletion go.work
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
go 1.22.4
go 1.22.5

use (
.
Expand Down
121 changes: 115 additions & 6 deletions go.work.sum

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func (p *Plugin) Reset(name string) error {
return svc.Reset()
}

// Collects declares services to be collected.
// Collects declare services to be collected.
func (p *Plugin) Collects() []*dep.In {
return []*dep.In{
dep.Fits(func(pl any) {
Expand Down
20 changes: 11 additions & 9 deletions tests/go.mod
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
module tests

go 1.22.4
go 1.22.5

require (
github.com/roadrunner-server/config/v4 v4.9.2
github.com/roadrunner-server/config/v4 v4.9.3
github.com/roadrunner-server/endure/v2 v2.4.5
github.com/roadrunner-server/goridge/v3 v3.8.2
github.com/roadrunner-server/resetter/v4 v4.1.2
github.com/roadrunner-server/rpc/v4 v4.4.4
github.com/roadrunner-server/sdk/v4 v4.7.3
github.com/roadrunner-server/server/v4 v4.8.4
github.com/roadrunner-server/pool v1.0.0
github.com/roadrunner-server/resetter/v5 v5.0.0
github.com/roadrunner-server/rpc/v4 v4.4.5
github.com/roadrunner-server/server/v4 v4.8.5
github.com/stretchr/testify v1.9.0
go.uber.org/zap v1.27.0
)

replace github.com/roadrunner-server/resetter/v4 => ../
replace github.com/roadrunner-server/resetter/v5 => ../

require (
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
Expand All @@ -29,7 +29,9 @@ require (
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/roadrunner-server/errors v1.4.0 // indirect
github.com/roadrunner-server/tcplisten v1.4.0 // indirect
github.com/roadrunner-server/events v1.0.0 // indirect
github.com/roadrunner-server/sdk/v4 v4.8.0 // indirect
github.com/roadrunner-server/tcplisten v1.5.0 // indirect
github.com/sagikazarmark/locafero v0.6.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/shirou/gopsutil v3.21.11+incompatible // indirect
Expand All @@ -47,7 +49,7 @@ require (
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8 // indirect
golang.org/x/sync v0.7.0 // indirect
golang.org/x/sys v0.21.0 // indirect
golang.org/x/sys v0.22.0 // indirect
golang.org/x/text v0.16.0 // indirect
google.golang.org/protobuf v1.34.2 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
Expand Down
28 changes: 16 additions & 12 deletions tests/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -32,22 +32,26 @@ github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/roadrunner-server/config/v4 v4.9.2 h1:AvZj6b9Jz8dR1FB3Suugcn+8Cok2WnIla4iznbuwmKo=
github.com/roadrunner-server/config/v4 v4.9.2/go.mod h1:yYYIkw1u2Hq8521v/qoqDuOHwOKH9X8Mx+t+TWX7UME=
github.com/roadrunner-server/config/v4 v4.9.3 h1:YZ2OkNT8OLwG/ulc2+GcQJzCCclGe5sy/onnInAxGY4=
github.com/roadrunner-server/config/v4 v4.9.3/go.mod h1:fcIWS7ZlG5h4fg1uE97lE0BVZRTS+/gLuDdNLPRNoIY=
github.com/roadrunner-server/endure/v2 v2.4.5 h1:GoZm/1HjKCKm8TpaP/Pm2KbN0X9gLyN840cA3Fn/TCE=
github.com/roadrunner-server/endure/v2 v2.4.5/go.mod h1:83UvLdt+RNxELTSna+SZMWQiu+Thj6wOz6hmlp65XFI=
github.com/roadrunner-server/errors v1.4.0 h1:Odjg3VZrj1q5Y8ILwoN+JgERyv0pkhrWPNOM4h68iQ8=
github.com/roadrunner-server/errors v1.4.0/go.mod h1:78PvraAFj+Sxy5nDmo0S+h6rEMLFIDszWZxA3B0sPAs=
github.com/roadrunner-server/events v1.0.0 h1:r+DM2mVJbcJSxj7AoESvolgUQQYNcEjzKPdgTXz3lPI=
github.com/roadrunner-server/events v1.0.0/go.mod h1:KMcez/tib0yky9TR/0Ag8SZcgAn3kjzXWciZL/n2Hu8=
github.com/roadrunner-server/goridge/v3 v3.8.2 h1:4TpIJAMylMIVTva/L/STB4ZvYNVoQ77+Syr6abxj95c=
github.com/roadrunner-server/goridge/v3 v3.8.2/go.mod h1:7IIDW50j1saxnOxktFeUPpkSIfyvM/dYopTrbGWXboA=
github.com/roadrunner-server/rpc/v4 v4.4.4 h1:6uAG2Q/QDvOO/+fhGwnEjlCu1C57wtIRoOPxkHWDZMA=
github.com/roadrunner-server/rpc/v4 v4.4.4/go.mod h1:IYOiuBhE2LD/244uySz5s4aB7PFggt0BoN+Fsh1PEJY=
github.com/roadrunner-server/sdk/v4 v4.7.3 h1:w007xSk96SDFH/IJ3ZsP3AkU5opnw2/g+cBjQxd+WGA=
github.com/roadrunner-server/sdk/v4 v4.7.3/go.mod h1:pOHmaPzvxOn/xhKC9tHibHYSyNXWlUDQvp7pcRiuDGE=
github.com/roadrunner-server/server/v4 v4.8.4 h1:R9PUH+M09MmAdbCyIya1vaaZ+zD8l96CLrpe5YpcHCc=
github.com/roadrunner-server/server/v4 v4.8.4/go.mod h1:62B5R5WWVJsAGYeqPWnYD2w22mIwWfGYQZleRzzi7ho=
github.com/roadrunner-server/tcplisten v1.4.0 h1:yWo09zktv/CSV6VywLfw4pwNcUchgTiIrW4uIICtO5M=
github.com/roadrunner-server/tcplisten v1.4.0/go.mod h1:A6+VSnW2ETGnN/e/CMdP63ZXqQDaC0UDMU6QmyuB0yM=
github.com/roadrunner-server/pool v1.0.0 h1:9iA67WLrJGRuigbN8qR6Rrs4OMy/TfkG7gSOS8sl0oU=
github.com/roadrunner-server/pool v1.0.0/go.mod h1:fLWNBj17Bu/YAN61QoInLr3ieRifpg1qN/4LGJqPsKo=
github.com/roadrunner-server/rpc/v4 v4.4.5 h1:8Ojui6+lPy8deLyoZlarJ5/UYsq0XRTiaunjdtBrH2k=
github.com/roadrunner-server/rpc/v4 v4.4.5/go.mod h1:IYOiuBhE2LD/244uySz5s4aB7PFggt0BoN+Fsh1PEJY=
github.com/roadrunner-server/sdk/v4 v4.8.0 h1:MpvRRlqJCjjqeCYah5K1ce64Z9zFqnuTYa1SgdhKJ5Y=
github.com/roadrunner-server/sdk/v4 v4.8.0/go.mod h1:CD9AE/wsGfhI7nbx+Bl727oQiGjh62ExrRJ/DhBg91s=
github.com/roadrunner-server/server/v4 v4.8.5 h1:L/lCbPNthQsmjyu1XBBZlps+TmQ2rPTXtO37Dl3Qtz4=
github.com/roadrunner-server/server/v4 v4.8.5/go.mod h1:NCD4/SO5WJTwYipb7QfqcyXBfsQ0sp/DOHdfAK2egu8=
github.com/roadrunner-server/tcplisten v1.5.0 h1:kwJZAAjPt250fBpnglUJ9mKYlbMeKEXzHwOQ4dk205Q=
github.com/roadrunner-server/tcplisten v1.5.0/go.mod h1:QSPMB61jFvCcvuRLAMhVIcrJhA6QoJAG+rSkz/vsT04=
github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8=
github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4=
github.com/sagikazarmark/locafero v0.6.0 h1:ON7AQg37yzcRPU69mt7gwhFEBwxI6P9T4Qu3N51bwOk=
Expand Down Expand Up @@ -99,8 +103,8 @@ golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M=
golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws=
golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI=
golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4=
golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI=
google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg=
Expand Down
2 changes: 1 addition & 1 deletion tests/pkgs.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
github.com/roadrunner-server/amqp/v4,github.com/roadrunner-server/app-logger/v4,github.com/roadrunner-server/beanstalk/v4,github.com/roadrunner-server/boltdb/v4,github.com/roadrunner-server/centrifuge/v4,github.com/roadrunner-server/config/v4,github.com/roadrunner-server/fileserver/v4,github.com/roadrunner-server/grpc/v4,github.com/roadrunner-server/gzip/v4,github.com/roadrunner-server/headers/v4,github.com/roadrunner-server/http/v4,github.com/roadrunner-server/informer/v4,github.com/roadrunner-server/jobs/v4,github.com/roadrunner-server/kafka/v4,github.com/roadrunner-server/kv/v4,github.com/roadrunner-server/logger/v4,github.com/roadrunner-server/lock/v4,github.com/roadrunner-server/memcached/v4,github.com/roadrunner-server/memory/v4,github.com/roadrunner-server/metrics/v4,github.com/roadrunner-server/nats/v4,github.com/roadrunner-server/otel/v4,github.com/roadrunner-server/prometheus/v4,github.com/roadrunner-server/proxy_ip_parser/v4,github.com/roadrunner-server/redis/v4,github.com/roadrunner-server/resetter/v4,github.com/roadrunner-server/rpc/v4,github.com/roadrunner-server/send/v4,github.com/roadrunner-server/server/v4,github.com/roadrunner-server/service/v4,github.com/roadrunner-server/sqs/v4,github.com/roadrunner-server/static/v4,github.com/roadrunner-server/status/v4,github.com/roadrunner-server/tcp/v4
github.com/roadrunner-server/amqp/v5,github.com/roadrunner-server/app-logger/v5,github.com/roadrunner-server/beanstalk/v5,github.com/roadrunner-server/boltdb/v5,github.com/roadrunner-server/centrifuge/v5,github.com/roadrunner-server/config/v5,github.com/roadrunner-server/fileserver/v5,github.com/roadrunner-server/grpc/v5,github.com/roadrunner-server/gzip/v5,github.com/roadrunner-server/headers/v5,github.com/roadrunner-server/http/v5,github.com/roadrunner-server/informer/v5,github.com/roadrunner-server/jobs/v5,github.com/roadrunner-server/kafka/v5,github.com/roadrunner-server/kv/v5,github.com/roadrunner-server/logger/v5,github.com/roadrunner-server/lock/v5,github.com/roadrunner-server/memcached/v5,github.com/roadrunner-server/memory/v5,github.com/roadrunner-server/metrics/v5,github.com/roadrunner-server/nats/v5,github.com/roadrunner-server/otel/v5,github.com/roadrunner-server/prometheus/v5,github.com/roadrunner-server/proxy_ip_parser/v5,github.com/roadrunner-server/redis/v5,github.com/roadrunner-server/resetter/v5,github.com/roadrunner-server/rpc/v5,github.com/roadrunner-server/send/v5,github.com/roadrunner-server/server/v5,github.com/roadrunner-server/service/v5,github.com/roadrunner-server/sqs/v5,github.com/roadrunner-server/static/v5,github.com/roadrunner-server/status/v5,github.com/roadrunner-server/tcp/v5
5 changes: 2 additions & 3 deletions tests/resetter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
"github.com/roadrunner-server/config/v4"
"github.com/roadrunner-server/endure/v2"
goridgeRpc "github.com/roadrunner-server/goridge/v3/pkg/rpc"
"github.com/roadrunner-server/resetter/v4"
"github.com/roadrunner-server/resetter/v5"
rpcPlugin "github.com/roadrunner-server/rpc/v4"
"github.com/roadrunner-server/server/v4"
"github.com/stretchr/testify/assert"
Expand All @@ -28,9 +28,8 @@ func TestResetterInit(t *testing.T) {
cont := endure.New(slog.LevelDebug)

cfg := &config.Plugin{
Version: "2.9.0",
Version: "2024.2.0",
Path: ".rr-resetter.yaml",
Prefix: "rr",
}

l, oLogger := mocklogger.ZapTestLogger(zap.DebugLevel)
Expand Down
16 changes: 8 additions & 8 deletions tests/test_plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import (
"os/exec"
"time"

"github.com/roadrunner-server/sdk/v4/payload"
"github.com/roadrunner-server/sdk/v4/pool"
staticPool "github.com/roadrunner-server/sdk/v4/pool/static_pool"
"github.com/roadrunner-server/sdk/v4/worker"
"github.com/roadrunner-server/pool/payload"
"github.com/roadrunner-server/pool/pool"
staticPool "github.com/roadrunner-server/pool/pool/static_pool"
"github.com/roadrunner-server/pool/worker"
"go.uber.org/zap"
)

Expand All @@ -29,7 +29,7 @@ var testPoolConfig = &pool.Config{ //nolint:gochecknoglobals
type Configurer interface {
// UnmarshalKey takes a single key and unmarshal it into a Struct.
UnmarshalKey(name string, out any) error
// Has checks if config section exists.
// Has checks if a config section exists.
Has(name string) bool
}

Expand All @@ -41,13 +41,13 @@ type Server interface {
}

type Pool interface {
// Workers returns worker list associated with the pool.
// Workers return a worker list associated with the pool.
Workers() (workers []*worker.Process)
// Exec payload
Exec(ctx context.Context, p *payload.Payload, stopCh chan struct{}) (chan *staticPool.PExec, error)
// Reset kill all workers inside the watcher and replaces with new
// Reset kills all workers inside the watcher and replaces with new
Reset(ctx context.Context) error
// Destroy all underlying stack (but let them complete the task).
// Destroy all underlying stacks (but let them complete the task).
Destroy(ctx context.Context)
}

Expand Down

0 comments on commit 0152a04

Please sign in to comment.