50
pkg/server/agents/testing/fake_agent_factory.go
Normal file
50
pkg/server/agents/testing/fake_agent_factory.go
Normal file
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
Copyright 2017 The Kubernetes Authors.
|
||||
|
||||
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 testing
|
||||
|
||||
import (
|
||||
"io"
|
||||
|
||||
"github.com/kubernetes-incubator/cri-containerd/pkg/server/agents"
|
||||
)
|
||||
|
||||
// FakeAgent is a fake agent for test.
|
||||
type FakeAgent struct{}
|
||||
|
||||
// Start always return nil not.
|
||||
// TODO(random-liu): Inject error and test error.
|
||||
func (f *FakeAgent) Start() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// FakeAgentFactory is a fake agent factory for test.
|
||||
type FakeAgentFactory struct{}
|
||||
|
||||
// NewFakeAgentFactory creates fake agent factory.
|
||||
func NewFakeAgentFactory() agents.AgentFactory {
|
||||
return &FakeAgentFactory{}
|
||||
}
|
||||
|
||||
// NewSandboxLogger creates a fake agent as sandbox logger.
|
||||
func (*FakeAgentFactory) NewSandboxLogger(rc io.ReadCloser) agents.Agent {
|
||||
return &FakeAgent{}
|
||||
}
|
||||
|
||||
// NewContainerLogger creates a fake agent as container logger.
|
||||
func (*FakeAgentFactory) NewContainerLogger(string, agents.StreamType, io.ReadCloser) agents.Agent {
|
||||
return &FakeAgent{}
|
||||
}
|
||||
Reference in New Issue
Block a user