ac6e8d1194
Container interface is being extended right now, because we build new things on top of it, such as bootstrap containers. Current version of it, was delivered as MVP and is used only in ISOGEN. During MVP stage we didn't bother too much about the pointers and readability. However now when we built something new on top of it, we want to make sure that it we dont make matters worse, and building on solid foundation. The pointers are not needed in any way, and they are dereferenced on top of that, context.Context is an interface, and there is very limited theoretical use of pointers to interfaces. Change-Id: Iee1eeb89f058aa8e994cba685b49085707362ee1
41 lines
1.1 KiB
Go
41 lines
1.1 KiB
Go
/*
|
|
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
|
|
|
|
https://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 container
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestNewContainer(t *testing.T) {
|
|
assert := assert.New(t)
|
|
|
|
ctx := context.Background()
|
|
|
|
t.Run("not-supported-container", func(t *testing.T) {
|
|
cnt, err := NewContainer(ctx, "test_drv", "")
|
|
assert.Equal(nil, cnt)
|
|
assert.Equal(ErrContainerDrvNotSupported{Driver: "test_drv"}, err)
|
|
})
|
|
|
|
t.Run("empty-container", func(t *testing.T) {
|
|
cnt, err := NewContainer(ctx, "", "")
|
|
assert.Equal(nil, cnt)
|
|
assert.Equal(ErrNoContainerDriver{}, err)
|
|
})
|
|
}
|