mirror of
https://github.com/project-zot/zot.git
synced 2025-02-03 23:09:41 -05:00
46 lines
1.2 KiB
Go
46 lines
1.2 KiB
Go
|
package deprecated_test
|
||
|
|
||
|
import (
|
||
|
"testing"
|
||
|
|
||
|
ispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||
|
. "github.com/smartystreets/goconvey/convey"
|
||
|
|
||
|
"zotregistry.io/zot/pkg/test/deprecated"
|
||
|
"zotregistry.io/zot/pkg/test/inject"
|
||
|
)
|
||
|
|
||
|
func TestGetImageComponents(t *testing.T) {
|
||
|
Convey("Inject failures for unreachable lines", t, func() {
|
||
|
injected := inject.InjectFailure(0)
|
||
|
if injected {
|
||
|
_, _, _, err := deprecated.GetImageComponents(100) //nolint:staticcheck
|
||
|
So(err, ShouldNotBeNil)
|
||
|
}
|
||
|
})
|
||
|
Convey("finishes successfully", t, func() {
|
||
|
_, _, _, err := deprecated.GetImageComponents(100) //nolint:staticcheck
|
||
|
So(err, ShouldBeNil)
|
||
|
})
|
||
|
}
|
||
|
|
||
|
func TestGetRandomImageComponents(t *testing.T) {
|
||
|
Convey("Inject failures for unreachable lines", t, func() {
|
||
|
injected := inject.InjectFailure(0)
|
||
|
if injected {
|
||
|
_, _, _, err := deprecated.GetRandomImageComponents(100) //nolint:staticcheck
|
||
|
So(err, ShouldNotBeNil)
|
||
|
}
|
||
|
})
|
||
|
}
|
||
|
|
||
|
func TestGetImageComponentsWithConfig(t *testing.T) {
|
||
|
Convey("Inject failures for unreachable lines", t, func() {
|
||
|
injected := inject.InjectFailure(0)
|
||
|
if injected {
|
||
|
_, _, _, err := deprecated.GetImageComponentsWithConfig(ispec.Image{}) //nolint:staticcheck
|
||
|
So(err, ShouldNotBeNil)
|
||
|
}
|
||
|
})
|
||
|
}
|