16 Commits

Author SHA1 Message Date
Renovate add66f7268 fix(deps): update module github.com/stretchr/testify to v1.9.0 2024-03-01 12:56:52 +00:00
Renovate 0e64561a0b chore(deps): update golang docker tag to v1.22 2024-02-24 13:49:01 +01:00
Renovate dd7462897e Add renovate.json 2024-02-23 23:27:30 +01:00
argoyle 8fab5ff4b7 chore(deps): bump github.com/stretchr/testify from 1.8.3 to 1.8.4
Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.8.3 to 1.8.4.
- [Release notes](https://github.com/stretchr/testify/releases)
- [Commits](https://github.com/stretchr/testify/compare/v1.8.3...v1.8.4)
2023-05-30 19:07:28 +00:00
argoyle c659ddd2f9 chore(deps): bump github.com/stretchr/testify from 1.8.2 to 1.8.3
Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.8.2 to 1.8.3.
- [Release notes](https://github.com/stretchr/testify/releases)
- [Commits](https://github.com/stretchr/testify/compare/v1.8.2...v1.8.3)
2023-05-20 08:59:12 +02:00
argoyle 47c83d1a02 ci: replace golint with golangci-lint 2023-05-20 08:57:01 +02:00
argoyle 7f85b25a31 chore(deps): bump github.com/stretchr/testify from 1.8.1 to 1.8.2
Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.8.1 to 1.8.2.
- [Release notes](https://github.com/stretchr/testify/releases)
- [Commits](https://github.com/stretchr/testify/compare/v1.8.1...v1.8.2)
2023-02-25 19:07:28 +00:00
argoyle b144473111 ci: switch to manual rebases for Dependabot 2023-02-10 11:25:01 +01:00
argoyle fff864a741 chore(deps): bump github.com/stretchr/testify from 1.8.0 to 1.8.1
Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.8.0 to 1.8.1.
- [Release notes](https://github.com/stretchr/testify/releases)
- [Commits](https://github.com/stretchr/testify/compare/v1.8.0...v1.8.1)
2022-10-24 19:07:13 +00:00
argoyle 7642d7e9c1 fix: ugly hack to ignore error trace 2022-06-30 08:29:20 +02:00
argoyle 359692e6ea chore(deps): bump github.com/stretchr/testify from 1.7.5 to 1.8.0
Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.7.5 to 1.8.0.
- [Release notes](https://github.com/stretchr/testify/releases)
- [Commits](https://github.com/stretchr/testify/compare/v1.7.5...v1.8.0)
2022-06-29 19:07:13 +00:00
argoyle 3a53016092 chore(deps): bump github.com/stretchr/testify from 1.7.4 to 1.7.5
Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.7.4 to 1.7.5.
- [Release notes](https://github.com/stretchr/testify/releases)
- [Commits](https://github.com/stretchr/testify/compare/v1.7.4...v1.7.5)
2022-06-24 19:07:14 +00:00
argoyle 30ee12f789 chore(deps): bump github.com/stretchr/testify from 1.7.3 to 1.7.4
Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.7.3 to 1.7.4.
- [Release notes](https://github.com/stretchr/testify/releases)
- [Commits](https://github.com/stretchr/testify/compare/v1.7.3...v1.7.4)
2022-06-21 19:07:15 +00:00
argoyle 56f1273747 chore(deps): bump github.com/stretchr/testify from 1.7.2 to 1.7.3
Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.7.2 to 1.7.3.
- [Release notes](https://github.com/stretchr/testify/releases)
- [Commits](https://github.com/stretchr/testify/compare/v1.7.2...v1.7.3)
2022-06-20 19:07:10 +00:00
argoyle d5e322ca9e chore: inline log.Interface and handle empty and nil slices the same 2022-06-17 09:54:48 +02:00
argoyle 18d12ed1b4 chore(deps): bump github.com/stretchr/testify from 1.6.1 to 1.7.2
Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.6.1 to 1.7.2.
- [Release notes](https://github.com/stretchr/testify/releases)
- [Commits](https://github.com/stretchr/testify/compare/v1.6.1...v1.7.2)
2022-06-16 19:07:34 +00:00
8 changed files with 41 additions and 24 deletions
+3 -3
View File
@@ -20,7 +20,7 @@
include:
- template: 'Workflows/MergeRequest-Pipelines.gitlab-ci.yml'
image: golang:1.15
image: golang:1.22
variables:
GOFLAGS: -mod=readonly
@@ -39,10 +39,10 @@ test:
dependencies:
- deps
script:
- go get golang.org/x/lint/golint
- curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.56.2
- go fmt $(go list ./...)
- go vet $(go list ./...)
- golint -set_exit_status ./...
- golangci-lint run
- CGO_ENABLED=1 go test -mod=readonly -race -coverprofile=coverage.txt -covermode=atomic -coverpkg=$(go list ./... | tr '\n' , | sed 's/,$//') ./...
- go tool cover -html=coverage.txt -o coverage.html
- go tool cover -func=coverage.txt
-12
View File
@@ -1,12 +0,0 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
version: 2
updates:
- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: "daily"
open-pull-requests-limit: 20
+2
View File
@@ -0,0 +1,2 @@
run:
allow-parallel-runners: true
+9 -2
View File
@@ -1,8 +1,15 @@
module gitlab.com/unboundsoftware/apex-mocks
go 1.15
go 1.20
require (
github.com/apex/log v1.9.0
github.com/stretchr/testify v1.6.1
github.com/stretchr/testify v1.9.0
)
require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/pkg/errors v0.8.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
+4 -2
View File
@@ -41,8 +41,9 @@ github.com/smartystreets/go-aws-auth v0.0.0-20180515143844-0c1422d1fdb9/go.mod h
github.com/smartystreets/gunit v1.0.0/go.mod h1:qwPWnhz6pn0NnRBP++URONOVyNkPyr4SauJk4cUOwJs=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/tj/assert v0.0.0-20171129193455-018094318fb0/go.mod h1:mZ9/Rh9oLWpLLDRpvE+3b7gP/C2YyLFYxNmcLnPTMe0=
github.com/tj/assert v0.0.3 h1:Df/BlaZ20mq6kuai7f5z2TvPFiwC3xaWJSDQNiIS3Rk=
github.com/tj/assert v0.0.3/go.mod h1:Ne6X72Q+TB1AteidzQncjw9PabbMp4PBMZ1k+vd1Pvk=
@@ -71,5 +72,6 @@ gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWD
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.0-20200605160147-a5ece683394c h1:grhR+C34yXImVGp7EzNk+DTIk+323eIUWOmEevy6bDo=
gopkg.in/yaml.v3 v3.0.0-20200605160147-a5ece683394c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
+7 -3
View File
@@ -31,7 +31,7 @@ import (
// Mock has a Logger for use in unit-testing
type Mock struct {
*sync.RWMutex
Logger log.Interface
log.Interface
Logged []string
}
@@ -48,8 +48,9 @@ var _ log.Handler = &Mock{}
// New instantiates a new Mock and sets the log.Handler to it
func New() *Mock {
mock := &Mock{
RWMutex: &sync.RWMutex{},
Logger: log.Log,
RWMutex: &sync.RWMutex{},
Interface: log.Log,
Logged: make([]string, 0),
}
log.SetHandler(mock)
return mock
@@ -60,5 +61,8 @@ func (m *Mock) Check(t testing.TB, wantLogged []string) {
t.Helper()
m.RLock()
defer m.RUnlock()
if wantLogged == nil {
wantLogged = []string{}
}
assert.Equal(t, wantLogged, m.Logged)
}
+10 -2
View File
@@ -21,6 +21,7 @@ package apex
import (
"fmt"
"regexp"
"sync"
"testing"
@@ -50,7 +51,7 @@ func TestMock_Check(t *testing.T) {
name: "different",
fields: fields{Logged: []string{"same"}},
args: args{wantLogged: []string{"different"}},
want: []string{"\n\tError Trace:\tmocks.go:63\n\t \t\t\t\tmocks_test.go:63\n\tError: \tNot equal: \n\t \texpected: []string{\"different\"}\n\t \tactual : []string{\"same\"}\n\t \t\n\t \tDiff:\n\t \t--- Expected\n\t \t+++ Actual\n\t \t@@ -1,3 +1,3 @@\n\t \t ([]string) (len=1) {\n\t \t- (string) (len=9) \"different\"\n\t \t+ (string) (len=4) \"same\"\n\t \t }\n\tTest: \t\n"},
want: []string{"\n\tError: \tNot equal: \n\t \texpected: []string{\"different\"}\n\t \tactual : []string{\"same\"}\n\t \t\n\t \tDiff:\n\t \t--- Expected\n\t \t+++ Actual\n\t \t@@ -1,3 +1,3 @@\n\t \t ([]string) (len=1) {\n\t \t- (string) (len=9) \"different\"\n\t \t+ (string) (len=4) \"same\"\n\t \t }\n\tTest: \t\n"},
},
}
for _, tt := range tests {
@@ -68,7 +69,7 @@ func TestMock_Check(t *testing.T) {
func TestNew(t *testing.T) {
logger := New()
logger.Logger.Info("logging")
logger.Info("logging")
logger.Check(t, []string{"info: logging"})
}
@@ -78,5 +79,12 @@ type MockT struct {
}
func (m *MockT) Errorf(format string, args ...interface{}) {
re, err := regexp.Compile(`(?s)^\tError Trace:.*(\tError:.*)$`)
assert.NoError(m, err)
for i, a := range args {
if s, ok := a.(string); ok {
args[i] = re.ReplaceAllString(s, "$1")
}
}
m.errors = append(m.errors, fmt.Sprintf(format, args...))
}
+6
View File
@@ -0,0 +1,6 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:recommended"
]
}