mirror of
https://github.com/project-zot/zot.git
synced 2024-12-30 22:34:13 -05:00
fix(tests): consolidate routes tests (#892)
Signed-off-by: Petu Eusebiu <peusebiu@cisco.com>
This commit is contained in:
parent
d93c68af33
commit
76714d53f8
2 changed files with 24 additions and 0 deletions
|
@ -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…
Reference in a new issue