refactor: migrate to new Gitea URL
Some checks failed
agola/nurse/Test and lint The run failed

This commit is contained in:
Peter Kurfer 2022-09-22 11:46:36 +02:00
parent 2abdd56bdf
commit c52912c5aa
No known key found for this signature in database
40 changed files with 114 additions and 99 deletions

View file

@ -1,7 +1,20 @@
version: v0
runs:
- name: Build
- name: Test and lint
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
runtime:
type: pod
@ -12,10 +25,31 @@ runs:
- image: code.icb4dc0.de/prskr/ci-images/dind:latest
privileged: true
steps:
- clone:
- restore_workspace:
dest_dir: .
- run:
name: Install Go tools
command: go install gotest.tools/gotestsum@latest
- run:
name: run all tests
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

View file

@ -5,7 +5,7 @@ linters-settings:
lines: 100
statements: 50
gci:
local-prefixes: code.1533b4dc0.de/prskr/nurse
local-prefixes: code.icb4dc0.de/prskr/nurse
goconst:
min-len: 2
min-occurrences: 2
@ -61,7 +61,6 @@ linters:
disable-all: true
enable:
- contextcheck
- deadcode
- dogsled
- dupl
- errcheck
@ -83,23 +82,21 @@ linters:
- gosec
# - gosimple
- govet
- ifshort
- importas
- ineffassign
- ireturn
- lll
- misspell
- nakedret
- nestif
- nilnil
- noctx
- nolintlint
- nosprintfhostport
- paralleltest
- prealloc
- predeclared
- promlinter
# - staticcheck
- structcheck
# - stylecheck
- tenv
- testpackage
@ -107,9 +104,8 @@ linters:
- typecheck
- unconvert
- unparam
- varcheck
- whitespace
# - unused
- unused
- wastedassign
issues:
@ -122,9 +118,6 @@ issues:
- gocognit
- gomnd
- govet
- path: magefiles/
linters:
- deadcode
run:
skip-files:

View file

@ -4,7 +4,7 @@ import (
"net/http"
"time"
"code.1533b4dc0.de/prskr/nurse/check"
"code.icb4dc0.de/prskr/nurse/check"
)
var _ http.Handler = (*CheckHandler)(nil)

View file

@ -5,8 +5,8 @@ import (
"go.uber.org/zap"
"code.1533b4dc0.de/prskr/nurse/check"
"code.1533b4dc0.de/prskr/nurse/config"
"code.icb4dc0.de/prskr/nurse/check"
"code.icb4dc0.de/prskr/nurse/config"
)
func PrepareMux(instance *config.Nurse, modLookup check.ModuleLookup, srvLookup config.ServerLookup) (http.Handler, error) {

View file

@ -4,8 +4,8 @@ import (
"context"
"errors"
"code.1533b4dc0.de/prskr/nurse/config"
"code.1533b4dc0.de/prskr/nurse/grammar"
"code.icb4dc0.de/prskr/nurse/config"
"code.icb4dc0.de/prskr/nurse/grammar"
)
var (

View file

@ -3,8 +3,8 @@ package check
import (
"golang.org/x/sync/errgroup"
"code.1533b4dc0.de/prskr/nurse/config"
"code.1533b4dc0.de/prskr/nurse/grammar"
"code.icb4dc0.de/prskr/nurse/config"
"code.icb4dc0.de/prskr/nurse/grammar"
)
var _ SystemChecker = Collection(nil)

View file

@ -1,8 +1,8 @@
package check
import (
"code.1533b4dc0.de/prskr/nurse/config"
"code.1533b4dc0.de/prskr/nurse/grammar"
"code.icb4dc0.de/prskr/nurse/config"
"code.icb4dc0.de/prskr/nurse/grammar"
)
func CheckForScript(script []grammar.Check, lkp ModuleLookup, srvLookup config.ServerLookup) (Collection, error) {

View file

@ -5,8 +5,8 @@ import (
"strings"
"sync"
"code.1533b4dc0.de/prskr/nurse/config"
"code.1533b4dc0.de/prskr/nurse/grammar"
"code.icb4dc0.de/prskr/nurse/config"
"code.icb4dc0.de/prskr/nurse/grammar"
)
type (

View file

@ -6,7 +6,7 @@ import (
"strings"
"time"
"code.1533b4dc0.de/prskr/nurse/grammar"
"code.icb4dc0.de/prskr/nurse/grammar"
)
type Route string

View file

@ -6,7 +6,7 @@ import (
"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

View file

@ -30,7 +30,6 @@ func WithServersFromEnv() Option {
})
}
//nolint:ireturn // required for interface implementation
func WithEndpointsFromEnv() Option {
return OptionFunc(func(n Nurse) (Nurse, error) {
envEndpoints, err := EndpointsFromEnv()
@ -53,7 +52,6 @@ func WithEndpointsFromEnv() Option {
})
}
//nolint:ireturn // required for interface implementation
func WithValuesFrom(other Nurse) Option {
return OptionFunc(func(n Nurse) (Nurse, error) {
return n.Merge(other), nil

View file

@ -5,8 +5,8 @@ import (
"github.com/maxatome/go-testdeep/td"
"code.1533b4dc0.de/prskr/nurse/config"
"code.1533b4dc0.de/prskr/nurse/internal/values"
"code.icb4dc0.de/prskr/nurse/config"
"code.icb4dc0.de/prskr/nurse/internal/values"
)
func TestParseFromURL(t *testing.T) {

2
go.mod
View file

@ -1,4 +1,4 @@
module code.1533b4dc0.de/prskr/nurse
module code.icb4dc0.de/prskr/nurse
go 1.19

8
go.sum
View file

@ -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/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/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/go.mod h1:h6/rDxQ5OUUxMEeTJYC3HZ/6Rh6uPVD0zLsdODEcwps=
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-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-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/go.mod h1:cyybsKvd6eL0RnXn6p/Grxp8F5bW7iYuBgsNCOHpMYE=
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-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-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/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=

View file

@ -3,8 +3,8 @@ package grammar_test
import (
"testing"
"code.1533b4dc0.de/prskr/nurse/grammar"
"code.1533b4dc0.de/prskr/nurse/internal/values"
"code.icb4dc0.de/prskr/nurse/grammar"
"code.icb4dc0.de/prskr/nurse/internal/values"
)
func TestParam_AsString(t *testing.T) {

View file

@ -5,8 +5,8 @@ import (
"github.com/maxatome/go-testdeep/td"
"code.1533b4dc0.de/prskr/nurse/grammar"
"code.1533b4dc0.de/prskr/nurse/internal/values"
"code.icb4dc0.de/prskr/nurse/grammar"
"code.icb4dc0.de/prskr/nurse/internal/values"
)
var wantParsedScript = td.Struct(new(grammar.Script), td.StructFields{

View file

@ -9,10 +9,10 @@ import (
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
"code.1533b4dc0.de/prskr/nurse/api"
"code.1533b4dc0.de/prskr/nurse/check"
"code.1533b4dc0.de/prskr/nurse/config"
"code.1533b4dc0.de/prskr/nurse/protocols/redis"
"code.icb4dc0.de/prskr/nurse/api"
"code.icb4dc0.de/prskr/nurse/check"
"code.icb4dc0.de/prskr/nurse/config"
"code.icb4dc0.de/prskr/nurse/protocols/redis"
)
var (

View file

@ -3,7 +3,7 @@ package http
import (
"net/http"
"code.1533b4dc0.de/prskr/nurse/check"
"code.icb4dc0.de/prskr/nurse/check"
)
func Module() *check.Module {

View file

@ -12,9 +12,9 @@ import (
"github.com/maxatome/go-testdeep/td"
"code.1533b4dc0.de/prskr/nurse/check"
"code.1533b4dc0.de/prskr/nurse/grammar"
httpcheck "code.1533b4dc0.de/prskr/nurse/protocols/http"
"code.icb4dc0.de/prskr/nurse/check"
"code.icb4dc0.de/prskr/nurse/grammar"
httpcheck "code.icb4dc0.de/prskr/nurse/protocols/http"
)
func TestChecks_Execute(t *testing.T) {

View file

@ -5,10 +5,10 @@ import (
"io"
"net/http"
"code.1533b4dc0.de/prskr/nurse/check"
"code.1533b4dc0.de/prskr/nurse/config"
"code.1533b4dc0.de/prskr/nurse/grammar"
"code.1533b4dc0.de/prskr/nurse/validation"
"code.icb4dc0.de/prskr/nurse/check"
"code.icb4dc0.de/prskr/nurse/config"
"code.icb4dc0.de/prskr/nurse/grammar"
"code.icb4dc0.de/prskr/nurse/validation"
)
type ClientInjectable interface {

View file

@ -7,8 +7,8 @@ import (
"github.com/valyala/bytebufferpool"
"code.1533b4dc0.de/prskr/nurse/grammar"
"code.1533b4dc0.de/prskr/nurse/validation"
"code.icb4dc0.de/prskr/nurse/grammar"
"code.icb4dc0.de/prskr/nurse/validation"
)
var _ validation.FromCall[*http.Response] = (*JSONPathValidator)(nil)

View file

@ -4,8 +4,8 @@ import (
"fmt"
"net/http"
"code.1533b4dc0.de/prskr/nurse/grammar"
"code.1533b4dc0.de/prskr/nurse/validation"
"code.icb4dc0.de/prskr/nurse/grammar"
"code.icb4dc0.de/prskr/nurse/validation"
)
var _ validation.FromCall[*http.Response] = (*StatusValidator)(nil)

View file

@ -3,7 +3,7 @@ package http
import (
"net/http"
"code.1533b4dc0.de/prskr/nurse/validation"
"code.icb4dc0.de/prskr/nurse/validation"
)
var registry = validation.NewRegistry[*http.Response]()

View file

@ -1,7 +1,7 @@
package redis
import (
"code.1533b4dc0.de/prskr/nurse/check"
"code.icb4dc0.de/prskr/nurse/check"
)
func Module() *check.Module {

View file

@ -11,10 +11,10 @@ import (
"github.com/google/uuid"
"github.com/maxatome/go-testdeep/td"
"code.1533b4dc0.de/prskr/nurse/check"
"code.1533b4dc0.de/prskr/nurse/config"
"code.1533b4dc0.de/prskr/nurse/grammar"
"code.1533b4dc0.de/prskr/nurse/protocols/redis"
"code.icb4dc0.de/prskr/nurse/check"
"code.icb4dc0.de/prskr/nurse/config"
"code.icb4dc0.de/prskr/nurse/grammar"
"code.icb4dc0.de/prskr/nurse/protocols/redis"
)
func TestChecks_Execute(t *testing.T) {

View file

@ -6,11 +6,10 @@ import (
"github.com/go-redis/redis/v8"
"github.com/mitchellh/mapstructure"
"code.1533b4dc0.de/prskr/nurse/config"
"code.1533b4dc0.de/prskr/nurse/grammar"
"code.icb4dc0.de/prskr/nurse/config"
"code.icb4dc0.de/prskr/nurse/grammar"
)
//nolint:ireturn // no other choice
func clientFromParam(p grammar.Param, srvLookup config.ServerLookup) (redis.UniversalClient, error) {
if srvName, err := p.AsString(); err != nil {
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) {
opts := &redis.UniversalOptions{
Addrs: srv.Hosts,

View file

@ -9,7 +9,7 @@ import (
"github.com/testcontainers/testcontainers-go"
"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 {

View file

@ -5,10 +5,10 @@ import (
"github.com/go-redis/redis/v8"
"code.1533b4dc0.de/prskr/nurse/check"
"code.1533b4dc0.de/prskr/nurse/config"
"code.1533b4dc0.de/prskr/nurse/grammar"
"code.1533b4dc0.de/prskr/nurse/validation"
"code.icb4dc0.de/prskr/nurse/check"
"code.icb4dc0.de/prskr/nurse/config"
"code.icb4dc0.de/prskr/nurse/grammar"
"code.icb4dc0.de/prskr/nurse/validation"
)
var _ check.SystemChecker = (*GetCheck)(nil)

View file

@ -6,10 +6,10 @@ import (
"github.com/go-redis/redis/v8"
"code.1533b4dc0.de/prskr/nurse/check"
"code.1533b4dc0.de/prskr/nurse/config"
"code.1533b4dc0.de/prskr/nurse/grammar"
"code.1533b4dc0.de/prskr/nurse/validation"
"code.icb4dc0.de/prskr/nurse/check"
"code.icb4dc0.de/prskr/nurse/config"
"code.icb4dc0.de/prskr/nurse/grammar"
"code.icb4dc0.de/prskr/nurse/validation"
)
var _ check.SystemChecker = (*PingCheck)(nil)

View file

@ -5,8 +5,8 @@ import (
"github.com/go-redis/redis/v8"
"code.1533b4dc0.de/prskr/nurse/grammar"
"code.1533b4dc0.de/prskr/nurse/validation"
"code.icb4dc0.de/prskr/nurse/grammar"
"code.icb4dc0.de/prskr/nurse/validation"
)
var (

View file

@ -1,6 +1,6 @@
package sql
import "code.1533b4dc0.de/prskr/nurse/check"
import "code.icb4dc0.de/prskr/nurse/check"
func Module() *check.Module {
m, err := check.NewModule(

View file

@ -10,10 +10,10 @@ import (
"github.com/maxatome/go-testdeep/td"
"code.1533b4dc0.de/prskr/nurse/check"
"code.1533b4dc0.de/prskr/nurse/config"
"code.1533b4dc0.de/prskr/nurse/grammar"
sqlchk "code.1533b4dc0.de/prskr/nurse/protocols/sql"
"code.icb4dc0.de/prskr/nurse/check"
"code.icb4dc0.de/prskr/nurse/config"
"code.icb4dc0.de/prskr/nurse/grammar"
sqlchk "code.icb4dc0.de/prskr/nurse/protocols/sql"
)
func TestChecks_Execute(t *testing.T) {

View file

@ -9,8 +9,8 @@ import (
"github.com/testcontainers/testcontainers-go"
"github.com/testcontainers/testcontainers-go/wait"
"code.1533b4dc0.de/prskr/nurse/config"
"code.1533b4dc0.de/prskr/nurse/internal/values"
"code.icb4dc0.de/prskr/nurse/config"
"code.icb4dc0.de/prskr/nurse/internal/values"
)
const (

View file

@ -4,8 +4,8 @@ import (
"database/sql"
"fmt"
"code.1533b4dc0.de/prskr/nurse/config"
"code.1533b4dc0.de/prskr/nurse/grammar"
"code.icb4dc0.de/prskr/nurse/config"
"code.icb4dc0.de/prskr/nurse/grammar"
)
func dbFromParam(p grammar.Param, srvLookup config.ServerLookup) (*sql.DB, error) {

View file

@ -4,8 +4,8 @@ import (
"database/sql"
"fmt"
"code.1533b4dc0.de/prskr/nurse/grammar"
"code.1533b4dc0.de/prskr/nurse/validation"
"code.icb4dc0.de/prskr/nurse/grammar"
"code.icb4dc0.de/prskr/nurse/validation"
)
var _ validation.FromCall[*sql.Rows] = (*RowsValidator)(nil)

View file

@ -6,10 +6,10 @@ import (
"go.uber.org/multierr"
"code.1533b4dc0.de/prskr/nurse/check"
"code.1533b4dc0.de/prskr/nurse/config"
"code.1533b4dc0.de/prskr/nurse/grammar"
"code.1533b4dc0.de/prskr/nurse/validation"
"code.icb4dc0.de/prskr/nurse/check"
"code.icb4dc0.de/prskr/nurse/config"
"code.icb4dc0.de/prskr/nurse/grammar"
"code.icb4dc0.de/prskr/nurse/validation"
)
var _ check.SystemChecker = (*SelectCheck)(nil)

View file

@ -6,7 +6,7 @@ import (
_ "github.com/go-sql-driver/mysql"
_ "github.com/jackc/pgx/v5/stdlib"
"code.1533b4dc0.de/prskr/nurse/validation"
"code.icb4dc0.de/prskr/nurse/validation"
)
var registry = validation.NewRegistry[*sql.Rows]()

View file

@ -3,7 +3,7 @@ package validation_test
import (
"testing"
"code.1533b4dc0.de/prskr/nurse/validation"
"code.icb4dc0.de/prskr/nurse/validation"
)
type jsonPathValidator_EqualsTestCase[V validation.Value] struct {

View file

@ -3,7 +3,7 @@ package validation_test
import (
"testing"
"code.1533b4dc0.de/prskr/nurse/validation"
"code.icb4dc0.de/prskr/nurse/validation"
)
type testCase interface {

View file

@ -5,8 +5,8 @@ import (
"strings"
"sync"
"code.1533b4dc0.de/prskr/nurse/check"
"code.1533b4dc0.de/prskr/nurse/grammar"
"code.icb4dc0.de/prskr/nurse/check"
"code.icb4dc0.de/prskr/nurse/grammar"
)
type (