StorageDriver: Test case for #1698
Signed-off-by: Arthur Baars <arthur@semmle.com>
This commit is contained in:
parent
c8592da977
commit
ddec546466
4 changed files with 92 additions and 19 deletions
|
@ -29,7 +29,7 @@ import (
|
|||
"github.com/docker/distribution/reference"
|
||||
"github.com/docker/distribution/registry/api/errcode"
|
||||
"github.com/docker/distribution/registry/api/v2"
|
||||
_ "github.com/docker/distribution/registry/storage/driver/inmemory"
|
||||
_ "github.com/docker/distribution/registry/storage/driver/testdriver"
|
||||
"github.com/docker/distribution/testutil"
|
||||
"github.com/docker/libtrust"
|
||||
"github.com/gorilla/handlers"
|
||||
|
@ -219,7 +219,7 @@ func contains(elems []string, e string) bool {
|
|||
func TestURLPrefix(t *testing.T) {
|
||||
config := configuration.Configuration{
|
||||
Storage: configuration.Storage{
|
||||
"inmemory": configuration.Parameters{},
|
||||
"testdriver": configuration.Parameters{},
|
||||
},
|
||||
}
|
||||
config.HTTP.Prefix = "/test/"
|
||||
|
@ -296,7 +296,7 @@ func TestBlobDelete(t *testing.T) {
|
|||
func TestRelativeURL(t *testing.T) {
|
||||
config := configuration.Configuration{
|
||||
Storage: configuration.Storage{
|
||||
"inmemory": configuration.Parameters{},
|
||||
"testdriver": configuration.Parameters{},
|
||||
},
|
||||
}
|
||||
config.HTTP.Headers = headerConfig
|
||||
|
@ -1884,8 +1884,8 @@ type testEnv struct {
|
|||
func newTestEnvMirror(t *testing.T, deleteEnabled bool) *testEnv {
|
||||
config := configuration.Configuration{
|
||||
Storage: configuration.Storage{
|
||||
"inmemory": configuration.Parameters{},
|
||||
"delete": configuration.Parameters{"enabled": deleteEnabled},
|
||||
"testdriver": configuration.Parameters{},
|
||||
"delete": configuration.Parameters{"enabled": deleteEnabled},
|
||||
},
|
||||
Proxy: configuration.Proxy{
|
||||
RemoteURL: "http://example.com",
|
||||
|
@ -1899,8 +1899,8 @@ func newTestEnvMirror(t *testing.T, deleteEnabled bool) *testEnv {
|
|||
func newTestEnv(t *testing.T, deleteEnabled bool) *testEnv {
|
||||
config := configuration.Configuration{
|
||||
Storage: configuration.Storage{
|
||||
"inmemory": configuration.Parameters{},
|
||||
"delete": configuration.Parameters{"enabled": deleteEnabled},
|
||||
"testdriver": configuration.Parameters{},
|
||||
"delete": configuration.Parameters{"enabled": deleteEnabled},
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -2413,7 +2413,7 @@ func TestCheckContextNotifier(t *testing.T) {
|
|||
func TestProxyManifestGetByTag(t *testing.T) {
|
||||
truthConfig := configuration.Configuration{
|
||||
Storage: configuration.Storage{
|
||||
"inmemory": configuration.Parameters{},
|
||||
"testdriver": configuration.Parameters{},
|
||||
},
|
||||
}
|
||||
truthConfig.HTTP.Headers = headerConfig
|
||||
|
@ -2427,7 +2427,7 @@ func TestProxyManifestGetByTag(t *testing.T) {
|
|||
|
||||
proxyConfig := configuration.Configuration{
|
||||
Storage: configuration.Storage{
|
||||
"inmemory": configuration.Parameters{},
|
||||
"testdriver": configuration.Parameters{},
|
||||
},
|
||||
Proxy: configuration.Proxy{
|
||||
RemoteURL: truthEnv.server.URL,
|
||||
|
|
|
@ -16,7 +16,7 @@ import (
|
|||
_ "github.com/docker/distribution/registry/auth/silly"
|
||||
"github.com/docker/distribution/registry/storage"
|
||||
memorycache "github.com/docker/distribution/registry/storage/cache/memory"
|
||||
"github.com/docker/distribution/registry/storage/driver/inmemory"
|
||||
"github.com/docker/distribution/registry/storage/driver/testdriver"
|
||||
)
|
||||
|
||||
// TestAppDispatcher builds an application with a test dispatcher and ensures
|
||||
|
@ -24,7 +24,7 @@ import (
|
|||
// This only tests the dispatch mechanism. The underlying dispatchers must be
|
||||
// tested individually.
|
||||
func TestAppDispatcher(t *testing.T) {
|
||||
driver := inmemory.New()
|
||||
driver := testdriver.New()
|
||||
ctx := context.Background()
|
||||
registry, err := storage.NewRegistry(ctx, driver, storage.BlobDescriptorCacheProvider(memorycache.NewInMemoryBlobDescriptorCacheProvider()), storage.EnableDelete, storage.EnableRedirect)
|
||||
if err != nil {
|
||||
|
@ -142,7 +142,7 @@ func TestNewApp(t *testing.T) {
|
|||
ctx := context.Background()
|
||||
config := configuration.Configuration{
|
||||
Storage: configuration.Storage{
|
||||
"inmemory": nil,
|
||||
"testdriver": nil,
|
||||
},
|
||||
Auth: configuration.Auth{
|
||||
// For now, we simply test that new auth results in a viable
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue