本文整理汇总了Golang中k8s/io/kubernetes/pkg/client/testing/core.NewObjectTracker函数的典型用法代码示例。如果您正苦于以下问题:Golang NewObjectTracker函数的具体用法?Golang NewObjectTracker怎么用?Golang NewObjectTracker使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NewObjectTracker函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: NewSimpleClientset
// NewSimpleClientset returns a clientset that will respond with the provided objects.
// It's backed by a very simple object tracker that processes creates, updates and deletions as-is,
// without applying any validations and/or defaults. It shouldn't be considered a replacement
// for a real clientset and is mostly useful in simple unit tests.
func NewSimpleClientset(objects ...runtime.Object) *Clientset {
o := core.NewObjectTracker(api.Scheme, api.Codecs.UniversalDecoder())
for _, obj := range objects {
if err := o.Add(obj); err != nil {
panic(err)
}
}
fakePtr := core.Fake{}
fakePtr.AddReactor("*", "*", core.ObjectReaction(o, api.Registry.RESTMapper()))
fakePtr.AddWatchReactor("*", core.DefaultWatchReactor(watch.NewFake(), nil))
return &Clientset{fakePtr}
}
开发者ID:kubernetes,项目名称:kubernetes,代码行数:19,代码来源:clientset_generated.go
示例2: NewSimpleFake
// NewSimpleFake returns a client that will respond with the provided objects
func NewSimpleFake(objects ...runtime.Object) *Fake {
o := core.NewObjectTracker(kapi.Scheme, kapi.Codecs.UniversalDecoder())
for _, obj := range objects {
if err := o.Add(obj); err != nil {
panic(err)
}
}
fakeClient := &Fake{}
fakeClient.AddReactor("*", "*", core.ObjectReaction(o, registered.RESTMapper()))
fakeClient.AddWatchReactor("*", core.DefaultWatchReactor(watch.NewFake(), nil))
return fakeClient
}
开发者ID:xgwang-zte,项目名称:origin,代码行数:16,代码来源:fake.go
注:本文中的k8s/io/kubernetes/pkg/client/testing/core.NewObjectTracker函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论