kubelet/dockertools: Refactor image pulling for pod infra container.

Replace the trunk of pull image code with dockerManagner.pullImage().
Also add tests to verify the image pulling/pulled events.
This commit is contained in:
Yifan Gu
2015-06-08 17:53:24 -07:00
parent eb0fb43453
commit 053db8dba7
4 changed files with 77 additions and 52 deletions

View File

@@ -17,16 +17,24 @@ limitations under the License.
package record
import (
"fmt"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/util"
)
// FakeRecorder is used as a fake during tests.
type FakeRecorder struct{}
type FakeRecorder struct {
Events []string
}
func (f *FakeRecorder) Event(object runtime.Object, reason, message string) {}
func (f *FakeRecorder) Event(object runtime.Object, reason, message string) {
f.Events = append(f.Events, fmt.Sprintf("%s %s", reason, message))
}
func (f *FakeRecorder) Eventf(object runtime.Object, reason, messageFmt string, args ...interface{}) {}
func (f *FakeRecorder) Eventf(object runtime.Object, reason, messageFmt string, args ...interface{}) {
f.Events = append(f.Events, fmt.Sprintf(reason+" "+messageFmt, args...))
}
func (f *FakeRecorder) PastEventf(object runtime.Object, timestamp util.Time, reason, messageFmt string, args ...interface{}) {
}