This commit is contained in:
parent
2abdd56bdf
commit
c52912c5aa
40 changed files with 114 additions and 99 deletions
|
@ -1,7 +1,20 @@
|
||||||
version: v0
|
version: v0
|
||||||
runs:
|
runs:
|
||||||
- name: Build
|
- name: Test and lint
|
||||||
tasks:
|
tasks:
|
||||||
|
- name: Checkout code
|
||||||
|
runtime:
|
||||||
|
type: pod
|
||||||
|
containers:
|
||||||
|
- image: docker.io/alpine/git
|
||||||
|
steps:
|
||||||
|
- clone:
|
||||||
|
- save_to_workspace:
|
||||||
|
contents:
|
||||||
|
- source_dir: .
|
||||||
|
dest_dir: .
|
||||||
|
paths:
|
||||||
|
- '**'
|
||||||
- name: Test
|
- name: Test
|
||||||
runtime:
|
runtime:
|
||||||
type: pod
|
type: pod
|
||||||
|
@ -12,10 +25,31 @@ runs:
|
||||||
- image: code.icb4dc0.de/prskr/ci-images/dind:latest
|
- image: code.icb4dc0.de/prskr/ci-images/dind:latest
|
||||||
privileged: true
|
privileged: true
|
||||||
steps:
|
steps:
|
||||||
- clone:
|
- restore_workspace:
|
||||||
|
dest_dir: .
|
||||||
- run:
|
- run:
|
||||||
name: Install Go tools
|
name: Install Go tools
|
||||||
command: go install gotest.tools/gotestsum@latest
|
command: go install gotest.tools/gotestsum@latest
|
||||||
- run:
|
- run:
|
||||||
name: run all tests
|
name: run all tests
|
||||||
command: gotestsum -f pkgname-and-test-fails -- -race -shuffle=on ./...
|
command: gotestsum -f pkgname-and-test-fails -- -race -shuffle=on ./...
|
||||||
|
depends:
|
||||||
|
- Checkout code
|
||||||
|
|
||||||
|
- name: Lint code
|
||||||
|
runtime:
|
||||||
|
type: pod
|
||||||
|
arch: amd64
|
||||||
|
containers:
|
||||||
|
- image: docker.io/golangci/golangci-lint
|
||||||
|
environment:
|
||||||
|
GO111MODULE: "on"
|
||||||
|
CGO_ENABLED: "0"
|
||||||
|
steps:
|
||||||
|
- restore_workspace:
|
||||||
|
dest_dir: .
|
||||||
|
- run:
|
||||||
|
name: Run golangci-lint
|
||||||
|
command: golangci-lint run -v
|
||||||
|
depends:
|
||||||
|
- Checkout code
|
||||||
|
|
|
@ -5,7 +5,7 @@ linters-settings:
|
||||||
lines: 100
|
lines: 100
|
||||||
statements: 50
|
statements: 50
|
||||||
gci:
|
gci:
|
||||||
local-prefixes: code.1533b4dc0.de/prskr/nurse
|
local-prefixes: code.icb4dc0.de/prskr/nurse
|
||||||
goconst:
|
goconst:
|
||||||
min-len: 2
|
min-len: 2
|
||||||
min-occurrences: 2
|
min-occurrences: 2
|
||||||
|
@ -61,7 +61,6 @@ linters:
|
||||||
disable-all: true
|
disable-all: true
|
||||||
enable:
|
enable:
|
||||||
- contextcheck
|
- contextcheck
|
||||||
- deadcode
|
|
||||||
- dogsled
|
- dogsled
|
||||||
- dupl
|
- dupl
|
||||||
- errcheck
|
- errcheck
|
||||||
|
@ -83,23 +82,21 @@ linters:
|
||||||
- gosec
|
- gosec
|
||||||
# - gosimple
|
# - gosimple
|
||||||
- govet
|
- govet
|
||||||
- ifshort
|
|
||||||
- importas
|
- importas
|
||||||
- ineffassign
|
- ineffassign
|
||||||
- ireturn
|
|
||||||
- lll
|
- lll
|
||||||
- misspell
|
- misspell
|
||||||
- nakedret
|
- nakedret
|
||||||
- nestif
|
- nestif
|
||||||
- nilnil
|
- nilnil
|
||||||
- noctx
|
- noctx
|
||||||
|
- nolintlint
|
||||||
- nosprintfhostport
|
- nosprintfhostport
|
||||||
- paralleltest
|
- paralleltest
|
||||||
- prealloc
|
- prealloc
|
||||||
- predeclared
|
- predeclared
|
||||||
- promlinter
|
- promlinter
|
||||||
# - staticcheck
|
# - staticcheck
|
||||||
- structcheck
|
|
||||||
# - stylecheck
|
# - stylecheck
|
||||||
- tenv
|
- tenv
|
||||||
- testpackage
|
- testpackage
|
||||||
|
@ -107,9 +104,8 @@ linters:
|
||||||
- typecheck
|
- typecheck
|
||||||
- unconvert
|
- unconvert
|
||||||
- unparam
|
- unparam
|
||||||
- varcheck
|
|
||||||
- whitespace
|
- whitespace
|
||||||
# - unused
|
- unused
|
||||||
- wastedassign
|
- wastedassign
|
||||||
|
|
||||||
issues:
|
issues:
|
||||||
|
@ -122,9 +118,6 @@ issues:
|
||||||
- gocognit
|
- gocognit
|
||||||
- gomnd
|
- gomnd
|
||||||
- govet
|
- govet
|
||||||
- path: magefiles/
|
|
||||||
linters:
|
|
||||||
- deadcode
|
|
||||||
|
|
||||||
run:
|
run:
|
||||||
skip-files:
|
skip-files:
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"code.1533b4dc0.de/prskr/nurse/check"
|
"code.icb4dc0.de/prskr/nurse/check"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ http.Handler = (*CheckHandler)(nil)
|
var _ http.Handler = (*CheckHandler)(nil)
|
||||||
|
|
|
@ -5,8 +5,8 @@ import (
|
||||||
|
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
|
|
||||||
"code.1533b4dc0.de/prskr/nurse/check"
|
"code.icb4dc0.de/prskr/nurse/check"
|
||||||
"code.1533b4dc0.de/prskr/nurse/config"
|
"code.icb4dc0.de/prskr/nurse/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
func PrepareMux(instance *config.Nurse, modLookup check.ModuleLookup, srvLookup config.ServerLookup) (http.Handler, error) {
|
func PrepareMux(instance *config.Nurse, modLookup check.ModuleLookup, srvLookup config.ServerLookup) (http.Handler, error) {
|
||||||
|
|
|
@ -4,8 +4,8 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
|
|
||||||
"code.1533b4dc0.de/prskr/nurse/config"
|
"code.icb4dc0.de/prskr/nurse/config"
|
||||||
"code.1533b4dc0.de/prskr/nurse/grammar"
|
"code.icb4dc0.de/prskr/nurse/grammar"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
|
@ -3,8 +3,8 @@ package check
|
||||||
import (
|
import (
|
||||||
"golang.org/x/sync/errgroup"
|
"golang.org/x/sync/errgroup"
|
||||||
|
|
||||||
"code.1533b4dc0.de/prskr/nurse/config"
|
"code.icb4dc0.de/prskr/nurse/config"
|
||||||
"code.1533b4dc0.de/prskr/nurse/grammar"
|
"code.icb4dc0.de/prskr/nurse/grammar"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ SystemChecker = Collection(nil)
|
var _ SystemChecker = Collection(nil)
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package check
|
package check
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"code.1533b4dc0.de/prskr/nurse/config"
|
"code.icb4dc0.de/prskr/nurse/config"
|
||||||
"code.1533b4dc0.de/prskr/nurse/grammar"
|
"code.icb4dc0.de/prskr/nurse/grammar"
|
||||||
)
|
)
|
||||||
|
|
||||||
func CheckForScript(script []grammar.Check, lkp ModuleLookup, srvLookup config.ServerLookup) (Collection, error) {
|
func CheckForScript(script []grammar.Check, lkp ModuleLookup, srvLookup config.ServerLookup) (Collection, error) {
|
||||||
|
|
|
@ -5,8 +5,8 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"code.1533b4dc0.de/prskr/nurse/config"
|
"code.icb4dc0.de/prskr/nurse/config"
|
||||||
"code.1533b4dc0.de/prskr/nurse/grammar"
|
"code.icb4dc0.de/prskr/nurse/grammar"
|
||||||
)
|
)
|
||||||
|
|
||||||
type (
|
type (
|
||||||
|
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"code.1533b4dc0.de/prskr/nurse/grammar"
|
"code.icb4dc0.de/prskr/nurse/grammar"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Route string
|
type Route string
|
||||||
|
|
|
@ -6,7 +6,7 @@ import (
|
||||||
|
|
||||||
"github.com/maxatome/go-testdeep/td"
|
"github.com/maxatome/go-testdeep/td"
|
||||||
|
|
||||||
"code.1533b4dc0.de/prskr/nurse/config"
|
"code.icb4dc0.de/prskr/nurse/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
//nolint:paralleltest // not possible with env setup
|
//nolint:paralleltest // not possible with env setup
|
||||||
|
|
|
@ -30,7 +30,6 @@ func WithServersFromEnv() Option {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
//nolint:ireturn // required for interface implementation
|
|
||||||
func WithEndpointsFromEnv() Option {
|
func WithEndpointsFromEnv() Option {
|
||||||
return OptionFunc(func(n Nurse) (Nurse, error) {
|
return OptionFunc(func(n Nurse) (Nurse, error) {
|
||||||
envEndpoints, err := EndpointsFromEnv()
|
envEndpoints, err := EndpointsFromEnv()
|
||||||
|
@ -53,7 +52,6 @@ func WithEndpointsFromEnv() Option {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
//nolint:ireturn // required for interface implementation
|
|
||||||
func WithValuesFrom(other Nurse) Option {
|
func WithValuesFrom(other Nurse) Option {
|
||||||
return OptionFunc(func(n Nurse) (Nurse, error) {
|
return OptionFunc(func(n Nurse) (Nurse, error) {
|
||||||
return n.Merge(other), nil
|
return n.Merge(other), nil
|
||||||
|
|
|
@ -5,8 +5,8 @@ import (
|
||||||
|
|
||||||
"github.com/maxatome/go-testdeep/td"
|
"github.com/maxatome/go-testdeep/td"
|
||||||
|
|
||||||
"code.1533b4dc0.de/prskr/nurse/config"
|
"code.icb4dc0.de/prskr/nurse/config"
|
||||||
"code.1533b4dc0.de/prskr/nurse/internal/values"
|
"code.icb4dc0.de/prskr/nurse/internal/values"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestParseFromURL(t *testing.T) {
|
func TestParseFromURL(t *testing.T) {
|
||||||
|
|
2
go.mod
2
go.mod
|
@ -1,4 +1,4 @@
|
||||||
module code.1533b4dc0.de/prskr/nurse
|
module code.icb4dc0.de/prskr/nurse
|
||||||
|
|
||||||
go 1.19
|
go 1.19
|
||||||
|
|
||||||
|
|
8
go.sum
8
go.sum
|
@ -454,10 +454,6 @@ github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsI
|
||||||
github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg=
|
github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg=
|
||||||
github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b h1:C8S2+VttkHFdOOCXJe+YGfa4vHYwlt4Zx+IVXQ97jYg=
|
github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b h1:C8S2+VttkHFdOOCXJe+YGfa4vHYwlt4Zx+IVXQ97jYg=
|
||||||
github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b/go.mod h1:vsD4gTJCa9TptPL8sPkXrLZ+hDuNrZCnj29CQpr4X1E=
|
github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b/go.mod h1:vsD4gTJCa9TptPL8sPkXrLZ+hDuNrZCnj29CQpr4X1E=
|
||||||
github.com/jackc/pgx/v5 v5.0.0-beta.2 h1:qDodMLREJ41Gv3cxNOtz5HlayH1IAv0q2pHQHJIgHf0=
|
|
||||||
github.com/jackc/pgx/v5 v5.0.0-beta.2/go.mod h1:QJ8xU09HYKHOccHeisi/6sXeRG4dd3AxuV7cmKET4WA=
|
|
||||||
github.com/jackc/pgx/v5 v5.0.0-beta.3 h1:/fvyxKQQVrEgD6elYv2Fa0L16ytVn8Ll18k1XQ/yaGw=
|
|
||||||
github.com/jackc/pgx/v5 v5.0.0-beta.3/go.mod h1:QJ8xU09HYKHOccHeisi/6sXeRG4dd3AxuV7cmKET4WA=
|
|
||||||
github.com/jackc/pgx/v5 v5.0.0-beta.5 h1:7H5vxAbAN3zpEif3dpdsXvbhfIUb2NVIogwoMNZjlPg=
|
github.com/jackc/pgx/v5 v5.0.0-beta.5 h1:7H5vxAbAN3zpEif3dpdsXvbhfIUb2NVIogwoMNZjlPg=
|
||||||
github.com/jackc/pgx/v5 v5.0.0-beta.5/go.mod h1:h6/rDxQ5OUUxMEeTJYC3HZ/6Rh6uPVD0zLsdODEcwps=
|
github.com/jackc/pgx/v5 v5.0.0-beta.5/go.mod h1:h6/rDxQ5OUUxMEeTJYC3HZ/6Rh6uPVD0zLsdODEcwps=
|
||||||
github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
|
github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
|
||||||
|
@ -772,8 +768,6 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0
|
||||||
golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
|
golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
|
||||||
golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM=
|
golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM=
|
||||||
golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU=
|
golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU=
|
||||||
golang.org/x/exp v0.0.0-20220827204233-334a2380cb91 h1:tnebWN09GYg9OLPss1KXj8txwZc6X6uMr6VFdcGNbHw=
|
|
||||||
golang.org/x/exp v0.0.0-20220827204233-334a2380cb91/go.mod h1:cyybsKvd6eL0RnXn6p/Grxp8F5bW7iYuBgsNCOHpMYE=
|
|
||||||
golang.org/x/exp v0.0.0-20220907003533-145caa8ea1d0 h1:17k44ji3KFYG94XS5QEFC8pyuOlMh3IoR+vkmTZmJJs=
|
golang.org/x/exp v0.0.0-20220907003533-145caa8ea1d0 h1:17k44ji3KFYG94XS5QEFC8pyuOlMh3IoR+vkmTZmJJs=
|
||||||
golang.org/x/exp v0.0.0-20220907003533-145caa8ea1d0/go.mod h1:cyybsKvd6eL0RnXn6p/Grxp8F5bW7iYuBgsNCOHpMYE=
|
golang.org/x/exp v0.0.0-20220907003533-145caa8ea1d0/go.mod h1:cyybsKvd6eL0RnXn6p/Grxp8F5bW7iYuBgsNCOHpMYE=
|
||||||
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
|
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
|
||||||
|
@ -855,8 +849,6 @@ golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJ
|
||||||
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.0.0-20220819030929-7fc1605a5dde h1:ejfdSekXMDxDLbRrJMwUk6KnSLZ2McaUCVcIKM+N6jc=
|
|
||||||
golang.org/x/sync v0.0.0-20220819030929-7fc1605a5dde/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
|
||||||
golang.org/x/sync v0.0.0-20220907140024-f12130a52804 h1:0SH2R3f1b1VmIMG7BXbEZCBUu2dKmHschSmjqGUrW8A=
|
golang.org/x/sync v0.0.0-20220907140024-f12130a52804 h1:0SH2R3f1b1VmIMG7BXbEZCBUu2dKmHschSmjqGUrW8A=
|
||||||
golang.org/x/sync v0.0.0-20220907140024-f12130a52804/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20220907140024-f12130a52804/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
|
|
@ -3,8 +3,8 @@ package grammar_test
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"code.1533b4dc0.de/prskr/nurse/grammar"
|
"code.icb4dc0.de/prskr/nurse/grammar"
|
||||||
"code.1533b4dc0.de/prskr/nurse/internal/values"
|
"code.icb4dc0.de/prskr/nurse/internal/values"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestParam_AsString(t *testing.T) {
|
func TestParam_AsString(t *testing.T) {
|
||||||
|
|
|
@ -5,8 +5,8 @@ import (
|
||||||
|
|
||||||
"github.com/maxatome/go-testdeep/td"
|
"github.com/maxatome/go-testdeep/td"
|
||||||
|
|
||||||
"code.1533b4dc0.de/prskr/nurse/grammar"
|
"code.icb4dc0.de/prskr/nurse/grammar"
|
||||||
"code.1533b4dc0.de/prskr/nurse/internal/values"
|
"code.icb4dc0.de/prskr/nurse/internal/values"
|
||||||
)
|
)
|
||||||
|
|
||||||
var wantParsedScript = td.Struct(new(grammar.Script), td.StructFields{
|
var wantParsedScript = td.Struct(new(grammar.Script), td.StructFields{
|
||||||
|
|
8
main.go
8
main.go
|
@ -9,10 +9,10 @@ import (
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
"go.uber.org/zap/zapcore"
|
"go.uber.org/zap/zapcore"
|
||||||
|
|
||||||
"code.1533b4dc0.de/prskr/nurse/api"
|
"code.icb4dc0.de/prskr/nurse/api"
|
||||||
"code.1533b4dc0.de/prskr/nurse/check"
|
"code.icb4dc0.de/prskr/nurse/check"
|
||||||
"code.1533b4dc0.de/prskr/nurse/config"
|
"code.icb4dc0.de/prskr/nurse/config"
|
||||||
"code.1533b4dc0.de/prskr/nurse/protocols/redis"
|
"code.icb4dc0.de/prskr/nurse/protocols/redis"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
|
@ -3,7 +3,7 @@ package http
|
||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"code.1533b4dc0.de/prskr/nurse/check"
|
"code.icb4dc0.de/prskr/nurse/check"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Module() *check.Module {
|
func Module() *check.Module {
|
||||||
|
|
|
@ -12,9 +12,9 @@ import (
|
||||||
|
|
||||||
"github.com/maxatome/go-testdeep/td"
|
"github.com/maxatome/go-testdeep/td"
|
||||||
|
|
||||||
"code.1533b4dc0.de/prskr/nurse/check"
|
"code.icb4dc0.de/prskr/nurse/check"
|
||||||
"code.1533b4dc0.de/prskr/nurse/grammar"
|
"code.icb4dc0.de/prskr/nurse/grammar"
|
||||||
httpcheck "code.1533b4dc0.de/prskr/nurse/protocols/http"
|
httpcheck "code.icb4dc0.de/prskr/nurse/protocols/http"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestChecks_Execute(t *testing.T) {
|
func TestChecks_Execute(t *testing.T) {
|
||||||
|
|
|
@ -5,10 +5,10 @@ import (
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"code.1533b4dc0.de/prskr/nurse/check"
|
"code.icb4dc0.de/prskr/nurse/check"
|
||||||
"code.1533b4dc0.de/prskr/nurse/config"
|
"code.icb4dc0.de/prskr/nurse/config"
|
||||||
"code.1533b4dc0.de/prskr/nurse/grammar"
|
"code.icb4dc0.de/prskr/nurse/grammar"
|
||||||
"code.1533b4dc0.de/prskr/nurse/validation"
|
"code.icb4dc0.de/prskr/nurse/validation"
|
||||||
)
|
)
|
||||||
|
|
||||||
type ClientInjectable interface {
|
type ClientInjectable interface {
|
||||||
|
|
|
@ -7,8 +7,8 @@ import (
|
||||||
|
|
||||||
"github.com/valyala/bytebufferpool"
|
"github.com/valyala/bytebufferpool"
|
||||||
|
|
||||||
"code.1533b4dc0.de/prskr/nurse/grammar"
|
"code.icb4dc0.de/prskr/nurse/grammar"
|
||||||
"code.1533b4dc0.de/prskr/nurse/validation"
|
"code.icb4dc0.de/prskr/nurse/validation"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ validation.FromCall[*http.Response] = (*JSONPathValidator)(nil)
|
var _ validation.FromCall[*http.Response] = (*JSONPathValidator)(nil)
|
||||||
|
|
|
@ -4,8 +4,8 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"code.1533b4dc0.de/prskr/nurse/grammar"
|
"code.icb4dc0.de/prskr/nurse/grammar"
|
||||||
"code.1533b4dc0.de/prskr/nurse/validation"
|
"code.icb4dc0.de/prskr/nurse/validation"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ validation.FromCall[*http.Response] = (*StatusValidator)(nil)
|
var _ validation.FromCall[*http.Response] = (*StatusValidator)(nil)
|
||||||
|
|
|
@ -3,7 +3,7 @@ package http
|
||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"code.1533b4dc0.de/prskr/nurse/validation"
|
"code.icb4dc0.de/prskr/nurse/validation"
|
||||||
)
|
)
|
||||||
|
|
||||||
var registry = validation.NewRegistry[*http.Response]()
|
var registry = validation.NewRegistry[*http.Response]()
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package redis
|
package redis
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"code.1533b4dc0.de/prskr/nurse/check"
|
"code.icb4dc0.de/prskr/nurse/check"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Module() *check.Module {
|
func Module() *check.Module {
|
||||||
|
|
|
@ -11,10 +11,10 @@ import (
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/maxatome/go-testdeep/td"
|
"github.com/maxatome/go-testdeep/td"
|
||||||
|
|
||||||
"code.1533b4dc0.de/prskr/nurse/check"
|
"code.icb4dc0.de/prskr/nurse/check"
|
||||||
"code.1533b4dc0.de/prskr/nurse/config"
|
"code.icb4dc0.de/prskr/nurse/config"
|
||||||
"code.1533b4dc0.de/prskr/nurse/grammar"
|
"code.icb4dc0.de/prskr/nurse/grammar"
|
||||||
"code.1533b4dc0.de/prskr/nurse/protocols/redis"
|
"code.icb4dc0.de/prskr/nurse/protocols/redis"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestChecks_Execute(t *testing.T) {
|
func TestChecks_Execute(t *testing.T) {
|
||||||
|
|
|
@ -6,11 +6,10 @@ import (
|
||||||
"github.com/go-redis/redis/v8"
|
"github.com/go-redis/redis/v8"
|
||||||
"github.com/mitchellh/mapstructure"
|
"github.com/mitchellh/mapstructure"
|
||||||
|
|
||||||
"code.1533b4dc0.de/prskr/nurse/config"
|
"code.icb4dc0.de/prskr/nurse/config"
|
||||||
"code.1533b4dc0.de/prskr/nurse/grammar"
|
"code.icb4dc0.de/prskr/nurse/grammar"
|
||||||
)
|
)
|
||||||
|
|
||||||
//nolint:ireturn // no other choice
|
|
||||||
func clientFromParam(p grammar.Param, srvLookup config.ServerLookup) (redis.UniversalClient, error) {
|
func clientFromParam(p grammar.Param, srvLookup config.ServerLookup) (redis.UniversalClient, error) {
|
||||||
if srvName, err := p.AsString(); err != nil {
|
if srvName, err := p.AsString(); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -23,7 +22,6 @@ func clientFromParam(p grammar.Param, srvLookup config.ServerLookup) (redis.Univ
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//nolint:ireturn // no other choice
|
|
||||||
func ClientForServer(srv *config.Server) (redis.UniversalClient, error) {
|
func ClientForServer(srv *config.Server) (redis.UniversalClient, error) {
|
||||||
opts := &redis.UniversalOptions{
|
opts := &redis.UniversalOptions{
|
||||||
Addrs: srv.Hosts,
|
Addrs: srv.Hosts,
|
||||||
|
|
|
@ -9,7 +9,7 @@ import (
|
||||||
"github.com/testcontainers/testcontainers-go"
|
"github.com/testcontainers/testcontainers-go"
|
||||||
"github.com/testcontainers/testcontainers-go/wait"
|
"github.com/testcontainers/testcontainers-go/wait"
|
||||||
|
|
||||||
"code.1533b4dc0.de/prskr/nurse/config"
|
"code.icb4dc0.de/prskr/nurse/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
func PrepareRedisContainer(tb testing.TB) *config.Server {
|
func PrepareRedisContainer(tb testing.TB) *config.Server {
|
||||||
|
|
|
@ -5,10 +5,10 @@ import (
|
||||||
|
|
||||||
"github.com/go-redis/redis/v8"
|
"github.com/go-redis/redis/v8"
|
||||||
|
|
||||||
"code.1533b4dc0.de/prskr/nurse/check"
|
"code.icb4dc0.de/prskr/nurse/check"
|
||||||
"code.1533b4dc0.de/prskr/nurse/config"
|
"code.icb4dc0.de/prskr/nurse/config"
|
||||||
"code.1533b4dc0.de/prskr/nurse/grammar"
|
"code.icb4dc0.de/prskr/nurse/grammar"
|
||||||
"code.1533b4dc0.de/prskr/nurse/validation"
|
"code.icb4dc0.de/prskr/nurse/validation"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ check.SystemChecker = (*GetCheck)(nil)
|
var _ check.SystemChecker = (*GetCheck)(nil)
|
||||||
|
|
|
@ -6,10 +6,10 @@ import (
|
||||||
|
|
||||||
"github.com/go-redis/redis/v8"
|
"github.com/go-redis/redis/v8"
|
||||||
|
|
||||||
"code.1533b4dc0.de/prskr/nurse/check"
|
"code.icb4dc0.de/prskr/nurse/check"
|
||||||
"code.1533b4dc0.de/prskr/nurse/config"
|
"code.icb4dc0.de/prskr/nurse/config"
|
||||||
"code.1533b4dc0.de/prskr/nurse/grammar"
|
"code.icb4dc0.de/prskr/nurse/grammar"
|
||||||
"code.1533b4dc0.de/prskr/nurse/validation"
|
"code.icb4dc0.de/prskr/nurse/validation"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ check.SystemChecker = (*PingCheck)(nil)
|
var _ check.SystemChecker = (*PingCheck)(nil)
|
||||||
|
|
|
@ -5,8 +5,8 @@ import (
|
||||||
|
|
||||||
"github.com/go-redis/redis/v8"
|
"github.com/go-redis/redis/v8"
|
||||||
|
|
||||||
"code.1533b4dc0.de/prskr/nurse/grammar"
|
"code.icb4dc0.de/prskr/nurse/grammar"
|
||||||
"code.1533b4dc0.de/prskr/nurse/validation"
|
"code.icb4dc0.de/prskr/nurse/validation"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package sql
|
package sql
|
||||||
|
|
||||||
import "code.1533b4dc0.de/prskr/nurse/check"
|
import "code.icb4dc0.de/prskr/nurse/check"
|
||||||
|
|
||||||
func Module() *check.Module {
|
func Module() *check.Module {
|
||||||
m, err := check.NewModule(
|
m, err := check.NewModule(
|
||||||
|
|
|
@ -10,10 +10,10 @@ import (
|
||||||
|
|
||||||
"github.com/maxatome/go-testdeep/td"
|
"github.com/maxatome/go-testdeep/td"
|
||||||
|
|
||||||
"code.1533b4dc0.de/prskr/nurse/check"
|
"code.icb4dc0.de/prskr/nurse/check"
|
||||||
"code.1533b4dc0.de/prskr/nurse/config"
|
"code.icb4dc0.de/prskr/nurse/config"
|
||||||
"code.1533b4dc0.de/prskr/nurse/grammar"
|
"code.icb4dc0.de/prskr/nurse/grammar"
|
||||||
sqlchk "code.1533b4dc0.de/prskr/nurse/protocols/sql"
|
sqlchk "code.icb4dc0.de/prskr/nurse/protocols/sql"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestChecks_Execute(t *testing.T) {
|
func TestChecks_Execute(t *testing.T) {
|
||||||
|
|
|
@ -9,8 +9,8 @@ import (
|
||||||
"github.com/testcontainers/testcontainers-go"
|
"github.com/testcontainers/testcontainers-go"
|
||||||
"github.com/testcontainers/testcontainers-go/wait"
|
"github.com/testcontainers/testcontainers-go/wait"
|
||||||
|
|
||||||
"code.1533b4dc0.de/prskr/nurse/config"
|
"code.icb4dc0.de/prskr/nurse/config"
|
||||||
"code.1533b4dc0.de/prskr/nurse/internal/values"
|
"code.icb4dc0.de/prskr/nurse/internal/values"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
|
@ -4,8 +4,8 @@ import (
|
||||||
"database/sql"
|
"database/sql"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"code.1533b4dc0.de/prskr/nurse/config"
|
"code.icb4dc0.de/prskr/nurse/config"
|
||||||
"code.1533b4dc0.de/prskr/nurse/grammar"
|
"code.icb4dc0.de/prskr/nurse/grammar"
|
||||||
)
|
)
|
||||||
|
|
||||||
func dbFromParam(p grammar.Param, srvLookup config.ServerLookup) (*sql.DB, error) {
|
func dbFromParam(p grammar.Param, srvLookup config.ServerLookup) (*sql.DB, error) {
|
||||||
|
|
|
@ -4,8 +4,8 @@ import (
|
||||||
"database/sql"
|
"database/sql"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"code.1533b4dc0.de/prskr/nurse/grammar"
|
"code.icb4dc0.de/prskr/nurse/grammar"
|
||||||
"code.1533b4dc0.de/prskr/nurse/validation"
|
"code.icb4dc0.de/prskr/nurse/validation"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ validation.FromCall[*sql.Rows] = (*RowsValidator)(nil)
|
var _ validation.FromCall[*sql.Rows] = (*RowsValidator)(nil)
|
||||||
|
|
|
@ -6,10 +6,10 @@ import (
|
||||||
|
|
||||||
"go.uber.org/multierr"
|
"go.uber.org/multierr"
|
||||||
|
|
||||||
"code.1533b4dc0.de/prskr/nurse/check"
|
"code.icb4dc0.de/prskr/nurse/check"
|
||||||
"code.1533b4dc0.de/prskr/nurse/config"
|
"code.icb4dc0.de/prskr/nurse/config"
|
||||||
"code.1533b4dc0.de/prskr/nurse/grammar"
|
"code.icb4dc0.de/prskr/nurse/grammar"
|
||||||
"code.1533b4dc0.de/prskr/nurse/validation"
|
"code.icb4dc0.de/prskr/nurse/validation"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ check.SystemChecker = (*SelectCheck)(nil)
|
var _ check.SystemChecker = (*SelectCheck)(nil)
|
||||||
|
|
|
@ -6,7 +6,7 @@ import (
|
||||||
_ "github.com/go-sql-driver/mysql"
|
_ "github.com/go-sql-driver/mysql"
|
||||||
_ "github.com/jackc/pgx/v5/stdlib"
|
_ "github.com/jackc/pgx/v5/stdlib"
|
||||||
|
|
||||||
"code.1533b4dc0.de/prskr/nurse/validation"
|
"code.icb4dc0.de/prskr/nurse/validation"
|
||||||
)
|
)
|
||||||
|
|
||||||
var registry = validation.NewRegistry[*sql.Rows]()
|
var registry = validation.NewRegistry[*sql.Rows]()
|
||||||
|
|
|
@ -3,7 +3,7 @@ package validation_test
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"code.1533b4dc0.de/prskr/nurse/validation"
|
"code.icb4dc0.de/prskr/nurse/validation"
|
||||||
)
|
)
|
||||||
|
|
||||||
type jsonPathValidator_EqualsTestCase[V validation.Value] struct {
|
type jsonPathValidator_EqualsTestCase[V validation.Value] struct {
|
||||||
|
|
|
@ -3,7 +3,7 @@ package validation_test
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"code.1533b4dc0.de/prskr/nurse/validation"
|
"code.icb4dc0.de/prskr/nurse/validation"
|
||||||
)
|
)
|
||||||
|
|
||||||
type testCase interface {
|
type testCase interface {
|
||||||
|
|
|
@ -5,8 +5,8 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"code.1533b4dc0.de/prskr/nurse/check"
|
"code.icb4dc0.de/prskr/nurse/check"
|
||||||
"code.1533b4dc0.de/prskr/nurse/grammar"
|
"code.icb4dc0.de/prskr/nurse/grammar"
|
||||||
)
|
)
|
||||||
|
|
||||||
type (
|
type (
|
||||||
|
|
Loading…
Reference in a new issue