Files
swift/go/objectserver/objengine_test.go
Michael Barton ca9591de34 go: conf.d support + some refactoring
Refactor how configs are loaded and passed to daemons.

Add conf.d support. So you can have an /etc/swift/object-server.conf.d
or /etc/swift/object-server/1.conf.d, and any .conf files under it
will be loaded as one config.

conf.d files are combined in filename lexigraphical order, with any
sections in later files replace existing section entries.

Change-Id: I78d7e5449cd0b62df9dfdb25616a2d4c91159f8c
2016-05-03 15:58:47 +00:00

45 lines
1.2 KiB
Go

// Copyright (c) 2015 Rackspace
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
// implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package objectserver
import (
"errors"
"flag"
"testing"
"github.com/openstack/swift/go/hummingbird"
"github.com/stretchr/testify/require"
)
func TestObjectEngineRegistry(t *testing.T) {
testErr := errors.New("Not implemented")
constructor := func(hummingbird.Config, *flag.FlagSet) (ObjectEngine, error) {
return nil, testErr
}
RegisterObjectEngine("test", constructor)
fconstructor, err := FindEngine("test")
require.Nil(t, err)
eng, err := fconstructor(hummingbird.Config{}, nil)
require.Nil(t, eng)
require.Equal(t, err, testErr)
fconstructor, err = FindEngine("hopefullynotfound")
require.Nil(t, fconstructor)
require.NotNil(t, err)
}