
Currently mockContainer implementation is located under pkg/bootstrap/isogen and it's not possible to import it from other packages. This patch moves it to appropriate new package under testutil. Signed-off-by: Ruslan Aliev <raliev@mirantis.com> Relates-To : #432 Change-Id: I36510e8e065434de597e7316dfbe51da0825d343
68 lines
2.1 KiB
Go
Executable File
68 lines
2.1 KiB
Go
Executable File
/*
|
|
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 (
|
|
"io"
|
|
|
|
"opendev.org/airship/airshipctl/pkg/container"
|
|
)
|
|
|
|
// MockContainer implements Container for unit test purposes
|
|
type MockContainer struct {
|
|
MockImagePull func() error
|
|
MockRunCommand func() error
|
|
MockGetContainerLogs func() (io.ReadCloser, error)
|
|
MockRmContainer func() error
|
|
MockGetID func() string
|
|
MockWaitUntilFinished func() error
|
|
MockInspectContainer func() (container.State, error)
|
|
}
|
|
|
|
// ImagePull Container interface implementation for unit test purposes
|
|
func (mc *MockContainer) ImagePull() error {
|
|
return mc.MockImagePull()
|
|
}
|
|
|
|
// RunCommand Container interface implementation for unit test purposes
|
|
func (mc *MockContainer) RunCommand([]string, io.Reader, []string, []string) error {
|
|
return mc.MockRunCommand()
|
|
}
|
|
|
|
// GetContainerLogs Container interface implementation for unit test purposes
|
|
func (mc *MockContainer) GetContainerLogs() (io.ReadCloser, error) {
|
|
return mc.MockGetContainerLogs()
|
|
}
|
|
|
|
// RmContainer Container interface implementation for unit test purposes
|
|
func (mc *MockContainer) RmContainer() error {
|
|
return mc.MockRmContainer()
|
|
}
|
|
|
|
// GetID Container interface implementation for unit test purposes
|
|
func (mc *MockContainer) GetID() string {
|
|
return mc.MockGetID()
|
|
}
|
|
|
|
// WaitUntilFinished Container interface implementation for unit test purposes
|
|
func (mc *MockContainer) WaitUntilFinished() error {
|
|
return mc.MockWaitUntilFinished()
|
|
}
|
|
|
|
// InspectContainer Container interface implementation for unit test purposes
|
|
func (mc *MockContainer) InspectContainer() (container.State, error) {
|
|
return mc.MockInspectContainer()
|
|
}
|