Commit b50e0b70 authored by Alessio Caiazza's avatar Alessio Caiazza

Merge branch 'jv-less-testify-assert' into 'master'

Replace some cases of testify/assert with require NO CHANGELOG

See merge request gitlab-org/gitlab-workhorse!600
parents ad3b4ab0 f492173c
...@@ -10,7 +10,7 @@ import ( ...@@ -10,7 +10,7 @@ import (
"testing" "testing"
"time" "time"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/redis" "gitlab.com/gitlab-org/gitlab-workhorse/internal/redis"
) )
...@@ -33,7 +33,7 @@ func expectHandlerWithWatcher(t *testing.T, watchHandler WatchKeyHandler, data s ...@@ -33,7 +33,7 @@ func expectHandlerWithWatcher(t *testing.T, watchHandler WatchKeyHandler, data s
h.ServeHTTP(rw, req) h.ServeHTTP(rw, req)
assert.Equal(t, expectedHttpStatus, rw.Code, msgAndArgs...) require.Equal(t, expectedHttpStatus, rw.Code, msgAndArgs...)
} }
func expectHandler(t *testing.T, data string, contentType string, expectedHttpStatus int, msgAndArgs ...interface{}) { func expectHandler(t *testing.T, data string, contentType string, expectedHttpStatus int, msgAndArgs ...interface{}) {
...@@ -79,7 +79,7 @@ func expectWatcherToBeExecuted(t *testing.T, watchKeyStatus redis.WatchKeyStatus ...@@ -79,7 +79,7 @@ func expectWatcherToBeExecuted(t *testing.T, watchKeyStatus redis.WatchKeyStatus
parsableData := `{"token":"token","last_update":"last_update"}` parsableData := `{"token":"token","last_update":"last_update"}`
expectHandlerWithWatcher(t, watchKeyHandler, parsableData, "application/json", httpStatus, msgAndArgs...) expectHandlerWithWatcher(t, watchKeyHandler, parsableData, "application/json", httpStatus, msgAndArgs...)
assert.True(t, executed, msgAndArgs...) require.True(t, executed, msgAndArgs...)
} }
func TestRegisterHandlerWatcherError(t *testing.T) { func TestRegisterHandlerWatcherError(t *testing.T) {
......
...@@ -6,7 +6,6 @@ import ( ...@@ -6,7 +6,6 @@ import (
"os" "os"
"testing" "testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"gocloud.dev/blob/azureblob" "gocloud.dev/blob/azureblob"
) )
...@@ -110,10 +109,10 @@ func TestTestURLOpenersForParams(t *testing.T) { ...@@ -110,10 +109,10 @@ func TestTestURLOpenersForParams(t *testing.T) {
err := setOptionsFromURLParams(test.query, &o.Options) err := setOptionsFromURLParams(test.query, &o.Options)
if test.wantErr { if test.wantErr {
assert.NotNil(t, err) require.NotNil(t, err)
} else { } else {
assert.Nil(t, err) require.Nil(t, err)
assert.Equal(t, test.wantOpts, o.Options) require.Equal(t, test.wantOpts, o.Options)
} }
}) })
} }
......
...@@ -10,7 +10,6 @@ import ( ...@@ -10,7 +10,6 @@ import (
"testing" "testing"
"time" "time"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"google.golang.org/grpc" "google.golang.org/grpc"
...@@ -81,6 +80,6 @@ func startSmartHTTPServer(t testing.TB, s gitalypb.SmartHTTPServiceServer) (stri ...@@ -81,6 +80,6 @@ func startSmartHTTPServer(t testing.TB, s gitalypb.SmartHTTPServiceServer) (stri
return fmt.Sprintf("%s://%s", ln.Addr().Network(), ln.Addr().String()), func() { return fmt.Sprintf("%s://%s", ln.Addr().Network(), ln.Addr().String()), func() {
srv.GracefulStop() srv.GracefulStop()
assert.NoError(t, os.RemoveAll(tmp), "error removing temp dir %q", tmp) require.NoError(t, os.RemoveAll(tmp), "error removing temp dir %q", tmp)
} }
} }
...@@ -7,7 +7,6 @@ import ( ...@@ -7,7 +7,6 @@ import (
"testing" "testing"
"testing/iotest" "testing/iotest"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
) )
...@@ -27,7 +26,7 @@ func TestCountingResponseWriterStatus(t *testing.T) { ...@@ -27,7 +26,7 @@ func TestCountingResponseWriterStatus(t *testing.T) {
crw := NewCountingResponseWriter(&testResponseWriter{}) crw := NewCountingResponseWriter(&testResponseWriter{})
crw.WriteHeader(123) crw.WriteHeader(123)
crw.WriteHeader(456) crw.WriteHeader(456)
assert.Equal(t, 123, crw.Status()) require.Equal(t, 123, crw.Status())
} }
func TestCountingResponseWriterCount(t *testing.T) { func TestCountingResponseWriterCount(t *testing.T) {
...@@ -36,7 +35,7 @@ func TestCountingResponseWriterCount(t *testing.T) { ...@@ -36,7 +35,7 @@ func TestCountingResponseWriterCount(t *testing.T) {
_, err := crw.Write(bytes.Repeat([]byte{'.'}, n)) _, err := crw.Write(bytes.Repeat([]byte{'.'}, n))
require.NoError(t, err) require.NoError(t, err)
} }
assert.Equal(t, int64(63), crw.Count()) require.Equal(t, int64(63), crw.Count())
} }
func TestCountingResponseWriterWrite(t *testing.T) { func TestCountingResponseWriterWrite(t *testing.T) {
...@@ -47,5 +46,5 @@ func TestCountingResponseWriterWrite(t *testing.T) { ...@@ -47,5 +46,5 @@ func TestCountingResponseWriterWrite(t *testing.T) {
_, err := io.Copy(crw, iotest.OneByteReader(bytes.NewReader(testData))) _, err := io.Copy(crw, iotest.OneByteReader(bytes.NewReader(testData)))
require.NoError(t, err) require.NoError(t, err)
assert.Equal(t, string(testData), string(trw.data)) require.Equal(t, string(testData), string(trw.data))
} }
...@@ -9,7 +9,6 @@ import ( ...@@ -9,7 +9,6 @@ import (
"testing" "testing"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
) )
...@@ -39,7 +38,7 @@ func TestFixRemoteAddr(t *testing.T) { ...@@ -39,7 +38,7 @@ func TestFixRemoteAddr(t *testing.T) {
FixRemoteAddr(req) FixRemoteAddr(req)
assert.Equal(t, tc.expected, req.RemoteAddr) require.Equal(t, tc.expected, req.RemoteAddr)
} }
} }
...@@ -92,8 +91,8 @@ func TestReadRequestBody(t *testing.T) { ...@@ -92,8 +91,8 @@ func TestReadRequestBody(t *testing.T) {
req, _ := http.NewRequest("POST", "/test", bytes.NewBuffer(data)) req, _ := http.NewRequest("POST", "/test", bytes.NewBuffer(data))
result, err := ReadRequestBody(rw, req, 1000) result, err := ReadRequestBody(rw, req, 1000)
assert.NoError(t, err) require.NoError(t, err)
assert.Equal(t, data, result) require.Equal(t, data, result)
} }
func TestReadRequestBodyLimit(t *testing.T) { func TestReadRequestBodyLimit(t *testing.T) {
...@@ -102,7 +101,7 @@ func TestReadRequestBodyLimit(t *testing.T) { ...@@ -102,7 +101,7 @@ func TestReadRequestBodyLimit(t *testing.T) {
req, _ := http.NewRequest("POST", "/test", bytes.NewBuffer(data)) req, _ := http.NewRequest("POST", "/test", bytes.NewBuffer(data))
_, err := ReadRequestBody(rw, req, 2) _, err := ReadRequestBody(rw, req, 2)
assert.Error(t, err) require.Error(t, err)
} }
func TestCloneRequestWithBody(t *testing.T) { func TestCloneRequestWithBody(t *testing.T) {
...@@ -111,26 +110,26 @@ func TestCloneRequestWithBody(t *testing.T) { ...@@ -111,26 +110,26 @@ func TestCloneRequestWithBody(t *testing.T) {
req, _ := http.NewRequest("POST", "/test", bytes.NewBuffer(input)) req, _ := http.NewRequest("POST", "/test", bytes.NewBuffer(input))
newReq := CloneRequestWithNewBody(req, newInput) newReq := CloneRequestWithNewBody(req, newInput)
assert.NotEqual(t, req, newReq) require.NotEqual(t, req, newReq)
assert.NotEqual(t, req.Body, newReq.Body) require.NotEqual(t, req.Body, newReq.Body)
assert.NotEqual(t, len(newInput), newReq.ContentLength) require.NotEqual(t, len(newInput), newReq.ContentLength)
var buffer bytes.Buffer var buffer bytes.Buffer
io.Copy(&buffer, newReq.Body) io.Copy(&buffer, newReq.Body)
assert.Equal(t, newInput, buffer.Bytes()) require.Equal(t, newInput, buffer.Bytes())
} }
func TestApplicationJson(t *testing.T) { func TestApplicationJson(t *testing.T) {
req, _ := http.NewRequest("POST", "/test", nil) req, _ := http.NewRequest("POST", "/test", nil)
req.Header.Set("Content-Type", "application/json") req.Header.Set("Content-Type", "application/json")
assert.True(t, IsApplicationJson(req), "expected to match 'application/json' as 'application/json'") require.True(t, IsApplicationJson(req), "expected to match 'application/json' as 'application/json'")
req.Header.Set("Content-Type", "application/json; charset=utf-8") req.Header.Set("Content-Type", "application/json; charset=utf-8")
assert.True(t, IsApplicationJson(req), "expected to match 'application/json; charset=utf-8' as 'application/json'") require.True(t, IsApplicationJson(req), "expected to match 'application/json; charset=utf-8' as 'application/json'")
req.Header.Set("Content-Type", "text/plain") req.Header.Set("Content-Type", "text/plain")
assert.False(t, IsApplicationJson(req), "expected not to match 'text/plain' as 'application/json'") require.False(t, IsApplicationJson(req), "expected not to match 'text/plain' as 'application/json'")
} }
func TestFail500WorksWithNils(t *testing.T) { func TestFail500WorksWithNils(t *testing.T) {
...@@ -140,8 +139,8 @@ func TestFail500WorksWithNils(t *testing.T) { ...@@ -140,8 +139,8 @@ func TestFail500WorksWithNils(t *testing.T) {
Fail500(w, nil, nil) Fail500(w, nil, nil)
assert.Equal(t, http.StatusInternalServerError, w.Code) require.Equal(t, http.StatusInternalServerError, w.Code)
assert.Equal(t, "Internal server error\n", body.String()) require.Equal(t, "Internal server error\n", body.String())
} }
func TestLogError(t *testing.T) { func TestLogError(t *testing.T) {
......
...@@ -6,7 +6,7 @@ import ( ...@@ -6,7 +6,7 @@ import (
"time" "time"
"github.com/rafaeljusto/redigomock" "github.com/rafaeljusto/redigomock"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/require"
) )
const ( const (
...@@ -76,8 +76,8 @@ func TestWatchKeySeenChange(t *testing.T) { ...@@ -76,8 +76,8 @@ func TestWatchKeySeenChange(t *testing.T) {
go func() { go func() {
val, err := WatchKey(runnerKey, "something", time.Second) val, err := WatchKey(runnerKey, "something", time.Second)
assert.NoError(t, err, "Expected no error") require.NoError(t, err, "Expected no error")
assert.Equal(t, WatchKeyStatusSeenChange, val, "Expected value to change") require.Equal(t, WatchKeyStatusSeenChange, val, "Expected value to change")
wg.Done() wg.Done()
}() }()
...@@ -96,8 +96,8 @@ func TestWatchKeyNoChange(t *testing.T) { ...@@ -96,8 +96,8 @@ func TestWatchKeyNoChange(t *testing.T) {
go func() { go func() {
val, err := WatchKey(runnerKey, "something", time.Second) val, err := WatchKey(runnerKey, "something", time.Second)
assert.NoError(t, err, "Expected no error") require.NoError(t, err, "Expected no error")
assert.Equal(t, WatchKeyStatusNoChange, val, "Expected notification without change to value") require.Equal(t, WatchKeyStatusNoChange, val, "Expected notification without change to value")
wg.Done() wg.Done()
}() }()
...@@ -112,8 +112,8 @@ func TestWatchKeyTimeout(t *testing.T) { ...@@ -112,8 +112,8 @@ func TestWatchKeyTimeout(t *testing.T) {
conn.Command("GET", runnerKey).Expect("something") conn.Command("GET", runnerKey).Expect("something")
val, err := WatchKey(runnerKey, "something", time.Millisecond) val, err := WatchKey(runnerKey, "something", time.Millisecond)
assert.NoError(t, err, "Expected no error") require.NoError(t, err, "Expected no error")
assert.Equal(t, WatchKeyStatusTimeout, val, "Expected value to not change") require.Equal(t, WatchKeyStatusTimeout, val, "Expected value to not change")
// Clean up watchers since Process isn't doing that for us (not running) // Clean up watchers since Process isn't doing that for us (not running)
deleteWatchers(runnerKey) deleteWatchers(runnerKey)
...@@ -126,8 +126,8 @@ func TestWatchKeyAlreadyChanged(t *testing.T) { ...@@ -126,8 +126,8 @@ func TestWatchKeyAlreadyChanged(t *testing.T) {
conn.Command("GET", runnerKey).Expect("somethingelse") conn.Command("GET", runnerKey).Expect("somethingelse")
val, err := WatchKey(runnerKey, "something", time.Second) val, err := WatchKey(runnerKey, "something", time.Second)
assert.NoError(t, err, "Expected no error") require.NoError(t, err, "Expected no error")
assert.Equal(t, WatchKeyStatusAlreadyChanged, val, "Expected value to have already changed") require.Equal(t, WatchKeyStatusAlreadyChanged, val, "Expected value to have already changed")
// Clean up watchers since Process isn't doing that for us (not running) // Clean up watchers since Process isn't doing that for us (not running)
deleteWatchers(runnerKey) deleteWatchers(runnerKey)
...@@ -151,8 +151,8 @@ func TestWatchKeyMassivelyParallel(t *testing.T) { ...@@ -151,8 +151,8 @@ func TestWatchKeyMassivelyParallel(t *testing.T) {
for i := 0; i < runTimes; i++ { for i := 0; i < runTimes; i++ {
go func() { go func() {
val, err := WatchKey(runnerKey, "something", time.Second) val, err := WatchKey(runnerKey, "something", time.Second)
assert.NoError(t, err, "Expected no error") require.NoError(t, err, "Expected no error")
assert.Equal(t, WatchKeyStatusSeenChange, val, "Expected value to change") require.Equal(t, WatchKeyStatusSeenChange, val, "Expected value to change")
wg.Done() wg.Done()
}() }()
} }
......
...@@ -7,7 +7,7 @@ import ( ...@@ -7,7 +7,7 @@ import (
"github.com/gomodule/redigo/redis" "github.com/gomodule/redigo/redis"
"github.com/rafaeljusto/redigomock" "github.com/rafaeljusto/redigomock"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/config" "gitlab.com/gitlab-org/gitlab-workhorse/internal/config"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/helper" "gitlab.com/gitlab-org/gitlab-workhorse/internal/helper"
...@@ -16,12 +16,12 @@ import ( ...@@ -16,12 +16,12 @@ import (
func mockRedisServer(t *testing.T, connectReceived *bool) string { func mockRedisServer(t *testing.T, connectReceived *bool) string {
ln, err := net.Listen("tcp", "127.0.0.1:0") ln, err := net.Listen("tcp", "127.0.0.1:0")
assert.Nil(t, err) require.Nil(t, err)
go func() { go func() {
defer ln.Close() defer ln.Close()
conn, err := ln.Accept() conn, err := ln.Accept()
assert.Nil(t, err) require.Nil(t, err)
*connectReceived = true *connectReceived = true
conn.Write([]byte("OK\n")) conn.Write([]byte("OK\n"))
}() }()
...@@ -68,10 +68,10 @@ func TestDefaultDialFunc(t *testing.T) { ...@@ -68,10 +68,10 @@ func TestDefaultDialFunc(t *testing.T) {
dialer := DefaultDialFunc(cfg, true) dialer := DefaultDialFunc(cfg, true)
conn, err := dialer() conn, err := dialer()
assert.Nil(t, err) require.Nil(t, err)
conn.Receive() conn.Receive()
assert.True(t, connectReceived) require.True(t, connectReceived)
}) })
} }
} }
...@@ -79,17 +79,18 @@ func TestDefaultDialFunc(t *testing.T) { ...@@ -79,17 +79,18 @@ func TestDefaultDialFunc(t *testing.T) {
func TestConfigureNoConfig(t *testing.T) { func TestConfigureNoConfig(t *testing.T) {
pool = nil pool = nil
Configure(nil, nil) Configure(nil, nil)
assert.Nil(t, pool, "Pool should be nil") require.Nil(t, pool, "Pool should be nil")
} }
func TestConfigureMinimalConfig(t *testing.T) { func TestConfigureMinimalConfig(t *testing.T) {
cfg := &config.RedisConfig{URL: config.TomlURL{}, Password: ""} cfg := &config.RedisConfig{URL: config.TomlURL{}, Password: ""}
Configure(cfg, DefaultDialFunc) Configure(cfg, DefaultDialFunc)
if assert.NotNil(t, pool, "Pool should not be nil") {
assert.Equal(t, 1, pool.MaxIdle) require.NotNil(t, pool, "Pool should not be nil")
assert.Equal(t, 1, pool.MaxActive) require.Equal(t, 1, pool.MaxIdle)
assert.Equal(t, 3*time.Minute, pool.IdleTimeout) require.Equal(t, 1, pool.MaxActive)
} require.Equal(t, 3*time.Minute, pool.IdleTimeout)
pool = nil pool = nil
} }
...@@ -104,24 +105,25 @@ func TestConfigureFullConfig(t *testing.T) { ...@@ -104,24 +105,25 @@ func TestConfigureFullConfig(t *testing.T) {
ReadTimeout: &r, ReadTimeout: &r,
} }
Configure(cfg, DefaultDialFunc) Configure(cfg, DefaultDialFunc)
if assert.NotNil(t, pool, "Pool should not be nil") {
assert.Equal(t, i, pool.MaxIdle) require.NotNil(t, pool, "Pool should not be nil")
assert.Equal(t, a, pool.MaxActive) require.Equal(t, i, pool.MaxIdle)
assert.Equal(t, 3*time.Minute, pool.IdleTimeout) require.Equal(t, a, pool.MaxActive)
} require.Equal(t, 3*time.Minute, pool.IdleTimeout)
pool = nil pool = nil
} }
func TestGetConnFail(t *testing.T) { func TestGetConnFail(t *testing.T) {
conn := Get() conn := Get()
assert.Nil(t, conn, "Expected `conn` to be nil") require.Nil(t, conn, "Expected `conn` to be nil")
} }
func TestGetConnPass(t *testing.T) { func TestGetConnPass(t *testing.T) {
_, teardown := setupMockPool() _, teardown := setupMockPool()
defer teardown() defer teardown()
conn := Get() conn := Get()
assert.NotNil(t, conn, "Expected `conn` to be non-nil") require.NotNil(t, conn, "Expected `conn` to be non-nil")
} }
func TestGetStringPass(t *testing.T) { func TestGetStringPass(t *testing.T) {
...@@ -129,22 +131,22 @@ func TestGetStringPass(t *testing.T) { ...@@ -129,22 +131,22 @@ func TestGetStringPass(t *testing.T) {
defer teardown() defer teardown()
conn.Command("GET", "foobar").Expect("baz") conn.Command("GET", "foobar").Expect("baz")
str, err := GetString("foobar") str, err := GetString("foobar")
if assert.NoError(t, err, "Expected `err` to be nil") {
var value string require.NoError(t, err, "Expected `err` to be nil")
assert.IsType(t, value, str, "Expected value to be a string") var value string
assert.Equal(t, "baz", str, "Expected it to be equal") require.IsType(t, value, str, "Expected value to be a string")
} require.Equal(t, "baz", str, "Expected it to be equal")
} }
func TestGetStringFail(t *testing.T) { func TestGetStringFail(t *testing.T) {
_, err := GetString("foobar") _, err := GetString("foobar")
assert.Error(t, err, "Expected error when not connected to redis") require.Error(t, err, "Expected error when not connected to redis")
} }
func TestSentinelConnNoSentinel(t *testing.T) { func TestSentinelConnNoSentinel(t *testing.T) {
s := sentinelConn("", []config.TomlURL{}) s := sentinelConn("", []config.TomlURL{})
assert.Nil(t, s, "Sentinel without urls should return nil") require.Nil(t, s, "Sentinel without urls should return nil")
} }
func TestSentinelConnDialURL(t *testing.T) { func TestSentinelConnDialURL(t *testing.T) {
...@@ -173,18 +175,18 @@ func TestSentinelConnDialURL(t *testing.T) { ...@@ -173,18 +175,18 @@ func TestSentinelConnDialURL(t *testing.T) {
} }
s := sentinelConn("foobar", sentinelUrls) s := sentinelConn("foobar", sentinelUrls)
assert.Equal(t, len(addrs), len(s.Addrs)) require.Equal(t, len(addrs), len(s.Addrs))
for i := range addrs { for i := range addrs {
assert.Equal(t, addrs[i], s.Addrs[i]) require.Equal(t, addrs[i], s.Addrs[i])
} }
conn, err := s.Dial(s.Addrs[0]) conn, err := s.Dial(s.Addrs[0])
assert.Nil(t, err) require.Nil(t, err)
conn.Receive() conn.Receive()
assert.True(t, connectReceived) require.True(t, connectReceived)
}) })
} }
} }
...@@ -199,21 +201,21 @@ func TestSentinelConnTwoURLs(t *testing.T) { ...@@ -199,21 +201,21 @@ func TestSentinelConnTwoURLs(t *testing.T) {
} }
s := sentinelConn("foobar", sentinelUrls) s := sentinelConn("foobar", sentinelUrls)
assert.Equal(t, len(addrs), len(s.Addrs)) require.Equal(t, len(addrs), len(s.Addrs))
for i := range addrs { for i := range addrs {
assert.Equal(t, addrs[i], s.Addrs[i]) require.Equal(t, addrs[i], s.Addrs[i])
} }
} }
func TestDialOptionsBuildersPassword(t *testing.T) { func TestDialOptionsBuildersPassword(t *testing.T) {
dopts := dialOptionsBuilder(&config.RedisConfig{Password: "foo"}, false) dopts := dialOptionsBuilder(&config.RedisConfig{Password: "foo"}, false)
assert.Equal(t, 1, len(dopts)) require.Equal(t, 1, len(dopts))
} }
func TestDialOptionsBuildersSetTimeouts(t *testing.T) { func TestDialOptionsBuildersSetTimeouts(t *testing.T) {
dopts := dialOptionsBuilder(nil, true) dopts := dialOptionsBuilder(nil, true)
assert.Equal(t, 2, len(dopts)) require.Equal(t, 2, len(dopts))
} }
func TestDialOptionsBuildersSetTimeoutsConfig(t *testing.T) { func TestDialOptionsBuildersSetTimeoutsConfig(t *testing.T) {
...@@ -222,11 +224,11 @@ func TestDialOptionsBuildersSetTimeoutsConfig(t *testing.T) { ...@@ -222,11 +224,11 @@ func TestDialOptionsBuildersSetTimeoutsConfig(t *testing.T) {
WriteTimeout: &config.TomlDuration{Duration: time.Second * time.Duration(15)}, WriteTimeout: &config.TomlDuration{Duration: time.Second * time.Duration(15)},
} }
dopts := dialOptionsBuilder(cfg, true) dopts := dialOptionsBuilder(cfg, true)
assert.Equal(t, 2, len(dopts)) require.Equal(t, 2, len(dopts))
} }
func TestDialOptionsBuildersSelectDB(t *testing.T) { func TestDialOptionsBuildersSelectDB(t *testing.T) {
db := 3 db := 3
dopts := dialOptionsBuilder(&config.RedisConfig{DB: &db}, false) dopts := dialOptionsBuilder(&config.RedisConfig{DB: &db}, false)
assert.Equal(t, 1, len(dopts)) require.Equal(t, 1, len(dopts))
} }
...@@ -11,7 +11,6 @@ import ( ...@@ -11,7 +11,6 @@ import (
"os" "os"
"testing" "testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/zipartifacts" "gitlab.com/gitlab-org/gitlab-workhorse/internal/zipartifacts"
...@@ -99,5 +98,5 @@ func TestErrNotAZip(t *testing.T) { ...@@ -99,5 +98,5 @@ func TestErrNotAZip(t *testing.T) {
defer cancel() defer cancel()
_, err = zipartifacts.OpenArchive(ctx, f.Name()) _, err = zipartifacts.OpenArchive(ctx, f.Name())
assert.Equal(t, zipartifacts.ErrorCode[zipartifacts.CodeNotZip], err, "OpenArchive requires a zip file") require.Equal(t, zipartifacts.ErrorCode[zipartifacts.CodeNotZip], err, "OpenArchive requires a zip file")
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment