Fix linting issues
This commit is contained in:
parent
dd0545eed1
commit
5e8194e760
7 changed files with 15 additions and 13 deletions
|
@ -1,7 +1,6 @@
|
||||||
package s3manager_test
|
package s3manager_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
@ -97,7 +96,7 @@ func TestHandleBucketView(t *testing.T) {
|
||||||
listObjectsV2Func: func(string, string, bool, <-chan struct{}) <-chan minio.ObjectInfo {
|
listObjectsV2Func: func(string, string, bool, <-chan struct{}) <-chan minio.ObjectInfo {
|
||||||
objCh := make(chan minio.ObjectInfo)
|
objCh := make(chan minio.ObjectInfo)
|
||||||
go func() {
|
go func() {
|
||||||
objCh <- minio.ObjectInfo{Err: errors.New("The specified bucket does not exist")}
|
objCh <- minio.ObjectInfo{Err: errBucketDoesNotExist}
|
||||||
close(objCh)
|
close(objCh)
|
||||||
}()
|
}()
|
||||||
return objCh
|
return objCh
|
||||||
|
@ -111,7 +110,7 @@ func TestHandleBucketView(t *testing.T) {
|
||||||
listObjectsV2Func: func(string, string, bool, <-chan struct{}) <-chan minio.ObjectInfo {
|
listObjectsV2Func: func(string, string, bool, <-chan struct{}) <-chan minio.ObjectInfo {
|
||||||
objCh := make(chan minio.ObjectInfo)
|
objCh := make(chan minio.ObjectInfo)
|
||||||
go func() {
|
go func() {
|
||||||
objCh <- minio.ObjectInfo{Err: errors.New("mocked S3 error")}
|
objCh <- minio.ObjectInfo{Err: errS3}
|
||||||
close(objCh)
|
close(objCh)
|
||||||
}()
|
}()
|
||||||
return objCh
|
return objCh
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package s3manager_test
|
package s3manager_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/http/httptest"
|
"net/http/httptest"
|
||||||
|
@ -41,7 +40,7 @@ func TestHandleBucketsView(t *testing.T) {
|
||||||
{
|
{
|
||||||
it: "returns error if there is an S3 error",
|
it: "returns error if there is an S3 error",
|
||||||
listBucketsFunc: func() ([]minio.BucketInfo, error) {
|
listBucketsFunc: func() ([]minio.BucketInfo, error) {
|
||||||
return []minio.BucketInfo{}, errors.New("mocked S3 error")
|
return []minio.BucketInfo{}, errS3
|
||||||
},
|
},
|
||||||
expectedStatusCode: http.StatusInternalServerError,
|
expectedStatusCode: http.StatusInternalServerError,
|
||||||
expectedBodyContains: http.StatusText(http.StatusInternalServerError),
|
expectedBodyContains: http.StatusText(http.StatusInternalServerError),
|
||||||
|
|
|
@ -2,7 +2,6 @@ package s3manager_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"errors"
|
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/http/httptest"
|
"net/http/httptest"
|
||||||
|
@ -52,7 +51,7 @@ func TestHandleCreateBucket(t *testing.T) {
|
||||||
{
|
{
|
||||||
it: "returns error if there is an S3 error",
|
it: "returns error if there is an S3 error",
|
||||||
makeBucketFunc: func(string, string) error {
|
makeBucketFunc: func(string, string) error {
|
||||||
return errors.New("mocked S3 error")
|
return errS3
|
||||||
},
|
},
|
||||||
body: `{"name":"myBucket"}`,
|
body: `{"name":"myBucket"}`,
|
||||||
expectedStatusCode: http.StatusInternalServerError,
|
expectedStatusCode: http.StatusInternalServerError,
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package s3manager_test
|
package s3manager_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/http/httptest"
|
"net/http/httptest"
|
||||||
|
@ -31,7 +30,7 @@ func TestHandleDeleteBucket(t *testing.T) {
|
||||||
{
|
{
|
||||||
it: "returns error if there is an S3 error",
|
it: "returns error if there is an S3 error",
|
||||||
removeBucketFunc: func(string) error {
|
removeBucketFunc: func(string) error {
|
||||||
return errors.New("mocked S3 error")
|
return errS3
|
||||||
},
|
},
|
||||||
expectedStatusCode: http.StatusInternalServerError,
|
expectedStatusCode: http.StatusInternalServerError,
|
||||||
expectedBodyContains: http.StatusText(http.StatusInternalServerError),
|
expectedBodyContains: http.StatusText(http.StatusInternalServerError),
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package s3manager_test
|
package s3manager_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/http/httptest"
|
"net/http/httptest"
|
||||||
"strings"
|
"strings"
|
||||||
|
@ -30,7 +29,7 @@ func TestHandleDeleteObject(t *testing.T) {
|
||||||
{
|
{
|
||||||
it: "returns error if there is an S3 error",
|
it: "returns error if there is an S3 error",
|
||||||
removeObjectFunc: func(string, string) error {
|
removeObjectFunc: func(string, string) error {
|
||||||
return errors.New("mocked S3 error")
|
return errS3
|
||||||
},
|
},
|
||||||
expectedStatusCode: http.StatusInternalServerError,
|
expectedStatusCode: http.StatusInternalServerError,
|
||||||
expectedBodyContains: http.StatusText(http.StatusInternalServerError),
|
expectedBodyContains: http.StatusText(http.StatusInternalServerError),
|
||||||
|
|
8
internal/app/s3manager/errors_test.go
Normal file
8
internal/app/s3manager/errors_test.go
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
package s3manager_test
|
||||||
|
|
||||||
|
import "errors"
|
||||||
|
|
||||||
|
var (
|
||||||
|
errS3 = errors.New("mocked s3 error")
|
||||||
|
errBucketDoesNotExist = errors.New("The specified bucket does not exist") // nolint: stylecheck
|
||||||
|
)
|
|
@ -1,7 +1,6 @@
|
||||||
package s3manager_test
|
package s3manager_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
@ -28,7 +27,7 @@ func TestHandleGetObject(t *testing.T) {
|
||||||
{
|
{
|
||||||
it: "returns error if there is an S3 error",
|
it: "returns error if there is an S3 error",
|
||||||
getObjectFunc: func(string, string, minio.GetObjectOptions) (*minio.Object, error) {
|
getObjectFunc: func(string, string, minio.GetObjectOptions) (*minio.Object, error) {
|
||||||
return nil, errors.New("mocked S3 error")
|
return nil, errS3
|
||||||
},
|
},
|
||||||
bucketName: "testBucket",
|
bucketName: "testBucket",
|
||||||
objectName: "testObject",
|
objectName: "testObject",
|
||||||
|
|
Loading…
Reference in a new issue