fix(tests): consolidate routes tests (#892)
Signed-off-by: Petu Eusebiu <peusebiu@cisco.com>
This commit is contained in:
parent
d93c68af33
commit
76714d53f8
@ -796,6 +796,9 @@ func TestRoutes(t *testing.T) {
|
||||
PutBlobChunkFn: func(repo, uuid string, from, to int64, body io.Reader) (int64, error) {
|
||||
return 100, ErrUnexpectedError
|
||||
},
|
||||
DeleteBlobUploadFn: func(repo, uuid string) error {
|
||||
return ErrUnexpectedError
|
||||
},
|
||||
},
|
||||
)
|
||||
So(status, ShouldEqual, http.StatusInternalServerError)
|
||||
@ -941,6 +944,9 @@ func TestRoutes(t *testing.T) {
|
||||
PutBlobChunkFn: func(repo, uuid string, from, to int64, body io.Reader) (int64, error) {
|
||||
return 0, ErrUnexpectedError
|
||||
},
|
||||
DeleteBlobUploadFn: func(repo, uuid string) error {
|
||||
return ErrUnexpectedError
|
||||
},
|
||||
},
|
||||
)
|
||||
So(status, ShouldEqual, http.StatusInternalServerError)
|
||||
@ -1041,6 +1047,9 @@ func TestRoutes(t *testing.T) {
|
||||
FinishBlobUploadFn: func(repo, uuid string, body io.Reader, digest string) error {
|
||||
return ErrUnexpectedError
|
||||
},
|
||||
DeleteBlobUploadFn: func(repo, uuid string) error {
|
||||
return ErrUnexpectedError
|
||||
},
|
||||
},
|
||||
)
|
||||
So(status, ShouldEqual, http.StatusInternalServerError)
|
||||
|
@ -9,6 +9,7 @@ import (
|
||||
"os"
|
||||
"path"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/opencontainers/go-digest"
|
||||
ispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
@ -140,6 +141,20 @@ func TestGetImageComponents(t *testing.T) {
|
||||
})
|
||||
}
|
||||
|
||||
func TestWaitTillTrivyDBDownloadStarted(t *testing.T) {
|
||||
Convey("finishes successfully", t, func() {
|
||||
tempDir := t.TempDir()
|
||||
go func() {
|
||||
test.WaitTillTrivyDBDownloadStarted(tempDir)
|
||||
}()
|
||||
|
||||
time.Sleep(test.SleepTime)
|
||||
|
||||
_, err := os.Create(path.Join(tempDir, "trivy.db"))
|
||||
So(err, ShouldBeNil)
|
||||
})
|
||||
}
|
||||
|
||||
func TestUploadImage(t *testing.T) {
|
||||
Convey("Post request results in an error", t, func() {
|
||||
port := test.GetFreePort()
|
||||
|
Loading…
x
Reference in New Issue
Block a user