本文整理汇总了Golang中k8s/io/kubernetes/pkg/capabilities.SetForTests函数的典型用法代码示例。如果您正苦于以下问题:Golang SetForTests函数的具体用法?Golang SetForTests怎么用?Golang SetForTests使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SetForTests函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: init
func init() {
capabilities.SetForTests(capabilities.Capabilities{
AllowPrivileged: true,
})
flag.Set("v", "5")
capnslog.SetGlobalLogLevel(capnslog.DEBUG)
capnslog.SetFormatter(capnslog.NewGlogFormatter(os.Stderr))
}
开发者ID:RomainVabre,项目名称:origin,代码行数:8,代码来源:etcd.go
示例2: init
func init() {
capabilities.SetForTests(capabilities.Capabilities{
AllowPrivileged: true,
})
flag.Set("v", "5")
if len(os.Getenv("OS_TEST_VERBOSE_ETCD")) > 0 {
capnslog.SetGlobalLogLevel(capnslog.DEBUG)
capnslog.SetFormatter(capnslog.NewGlogFormatter(os.Stderr))
} else {
capnslog.SetGlobalLogLevel(capnslog.INFO)
capnslog.SetFormatter(capnslog.NewGlogFormatter(os.Stderr))
}
}
开发者ID:Xmagicer,项目名称:origin,代码行数:13,代码来源:etcd.go
示例3: TestExampleObjectSchemas
//.........这里部分代码省略.........
"admin-pod": &api.Pod{},
"admin-service": &api.Service{},
"driver-service": &api.Service{},
"rc": &api.ReplicationController{},
},
"../docs/user-guide/secrets": {
"secret-pod": &api.Pod{},
"secret": &api.Secret{},
"secret-env-pod": &api.Pod{},
},
"../examples/spark": {
"spark-master-controller": &api.ReplicationController{},
"spark-master-service": &api.Service{},
"spark-webui": &api.Service{},
"spark-worker-controller": &api.ReplicationController{},
"zeppelin-controller": &api.ReplicationController{},
"zeppelin-service": &api.Service{},
},
"../examples/spark/spark-gluster": {
"spark-master-service": &api.Service{},
"spark-master-controller": &api.ReplicationController{},
"spark-worker-controller": &api.ReplicationController{},
"glusterfs-endpoints": &api.Endpoints{},
},
"../examples/storm": {
"storm-nimbus-service": &api.Service{},
"storm-nimbus": &api.Pod{},
"storm-worker-controller": &api.ReplicationController{},
"zookeeper-service": &api.Service{},
"zookeeper": &api.Pod{},
},
"../examples/cephfs/": {
"cephfs": &api.Pod{},
"cephfs-with-secret": &api.Pod{},
},
"../examples/fibre_channel": {
"fc": &api.Pod{},
},
"../examples/extensions": {
"deployment": &extensions.Deployment{},
},
"../examples/javaweb-tomcat-sidecar": {
"javaweb": &api.Pod{},
"javaweb-2": &api.Pod{},
},
"../examples/job/work-queue-1": {
"job": &extensions.Job{},
},
"../examples/job/work-queue-2": {
"redis-pod": &api.Pod{},
"redis-service": &api.Service{},
"job": &extensions.Job{},
},
}
capabilities.SetForTests(capabilities.Capabilities{
AllowPrivileged: true,
})
for path, expected := range cases {
tested := 0
err := walkJSONFiles(path, func(name, path string, data []byte) {
expectedType, found := expected[name]
if !found {
t.Errorf("%s: %s does not have a test case defined", path, name)
return
}
tested++
if expectedType == nil {
t.Logf("skipping : %s/%s\n", path, name)
return
}
if strings.Contains(name, "scheduler-policy-config") {
if err := runtime.DecodeInto(schedulerapilatest.Codec, data, expectedType); err != nil {
t.Errorf("%s did not decode correctly: %v\n%s", path, err, string(data))
return
}
//TODO: Add validate method for &schedulerapi.Policy
} else {
codec, err := testapi.GetCodecForObject(expectedType)
if err != nil {
t.Errorf("Could not get codec for %s: %s", expectedType, err)
}
if err := runtime.DecodeInto(codec, data, expectedType); err != nil {
t.Errorf("%s did not decode correctly: %v\n%s", path, err, string(data))
return
}
if errors := validateObject(expectedType); len(errors) > 0 {
t.Errorf("%s did not validate correctly: %v", path, errors)
}
}
})
if err != nil {
t.Errorf("Expected no error, Got %v", err)
}
if tested != len(expected) {
t.Errorf("Directory %v: Expected %d examples, Got %d", path, len(expected), tested)
}
}
}
开发者ID:koori02,项目名称:kubernetes,代码行数:101,代码来源:examples_test.go
示例4: TestExampleObjectSchemas
//.........这里部分代码省略.........
},
"../examples/storage/redis": {
"redis-controller": &api.ReplicationController{},
"redis-master": &api.Pod{},
"redis-proxy": &api.Pod{},
"redis-sentinel-controller": &api.ReplicationController{},
"redis-sentinel-service": &api.Service{},
},
"../examples/storage/rethinkdb": {
"admin-pod": &api.Pod{},
"admin-service": &api.Service{},
"driver-service": &api.Service{},
"rc": &api.ReplicationController{},
},
"../examples/spark": {
"namespace-spark-cluster": &api.Namespace{},
"spark-master-controller": &api.ReplicationController{},
"spark-master-service": &api.Service{},
"spark-webui": &api.Service{},
"spark-worker-controller": &api.ReplicationController{},
"zeppelin-controller": &api.ReplicationController{},
"zeppelin-service": &api.Service{},
},
"../examples/spark/spark-gluster": {
"spark-master-service": &api.Service{},
"spark-master-controller": &api.ReplicationController{},
"spark-worker-controller": &api.ReplicationController{},
"glusterfs-endpoints": &api.Endpoints{},
},
"../examples/storm": {
"storm-nimbus-service": &api.Service{},
"storm-nimbus": &api.Pod{},
"storm-worker-controller": &api.ReplicationController{},
"zookeeper-service": &api.Service{},
"zookeeper": &api.Pod{},
},
"../examples/volumes/cephfs/": {
"cephfs": &api.Pod{},
"cephfs-with-secret": &api.Pod{},
},
"../examples/volumes/fibre_channel": {
"fc": &api.Pod{},
},
"../examples/javaweb-tomcat-sidecar": {
"javaweb": &api.Pod{},
"javaweb-2": &api.Pod{},
},
"../examples/volumes/azure_file": {
"azure": &api.Pod{},
},
"../examples/volumes/azure_disk": {
"azure": &api.Pod{},
},
}
capabilities.SetForTests(capabilities.Capabilities{
AllowPrivileged: true,
})
for path, expected := range cases {
tested := 0
err := walkJSONFiles(path, func(name, path string, data []byte) {
expectedType, found := expected[name]
if !found {
t.Errorf("%s: %s does not have a test case defined", path, name)
return
}
tested++
if expectedType == nil {
t.Logf("skipping : %s/%s\n", path, name)
return
}
if strings.Contains(name, "scheduler-policy-config") {
if err := runtime.DecodeInto(schedulerapilatest.Codec, data, expectedType); err != nil {
t.Errorf("%s did not decode correctly: %v\n%s", path, err, string(data))
return
}
//TODO: Add validate method for &schedulerapi.Policy
} else {
codec, err := testapi.GetCodecForObject(expectedType)
if err != nil {
t.Errorf("Could not get codec for %s: %s", expectedType, err)
}
if err := runtime.DecodeInto(codec, data, expectedType); err != nil {
t.Errorf("%s did not decode correctly: %v\n%s", path, err, string(data))
return
}
if errors := validateObject(expectedType); len(errors) > 0 {
t.Errorf("%s did not validate correctly: %v", path, errors)
}
}
})
if err != nil {
t.Errorf("Expected no error, Got %v", err)
}
if tested != len(expected) {
t.Errorf("Directory %v: Expected %d examples, Got %d", path, len(expected), tested)
}
}
}
开发者ID:ncdc,项目名称:kubernetes,代码行数:101,代码来源:examples_test.go
示例5: init
func init() {
capabilities.SetForTests(capabilities.Capabilities{
AllowPrivileged: true,
})
flag.Set("v", "5")
}
开发者ID:johnmccawley,项目名称:origin,代码行数:6,代码来源:etcd.go
示例6: TestExampleObjectSchemas
//.........这里部分代码省略.........
},
"../docs/admin/namespaces": {
"namespace-dev": {&api.Namespace{}},
"namespace-prod": {&api.Namespace{}},
},
"../docs/admin/limitrange": {
"invalid-pod": {&api.Pod{}},
"limits": {&api.LimitRange{}},
"namespace": {&api.Namespace{}},
"valid-pod": {&api.Pod{}},
},
"../docs/user-guide/logging-demo": {
"synthetic_0_25lps": {&api.Pod{}},
"synthetic_10lps": {&api.Pod{}},
},
"../docs/user-guide/node-selection": {
"pod": {&api.Pod{}},
"pod-with-node-affinity": {&api.Pod{}},
"pod-with-pod-affinity": {&api.Pod{}},
},
"../docs/admin/resourcequota": {
"best-effort": {&api.ResourceQuota{}},
"compute-resources": {&api.ResourceQuota{}},
"limits": {&api.LimitRange{}},
"namespace": {&api.Namespace{}},
"not-best-effort": {&api.ResourceQuota{}},
"object-counts": {&api.ResourceQuota{}},
},
"../docs/user-guide/secrets": {
"secret-pod": {&api.Pod{}},
"secret": {&api.Secret{}},
"secret-env-pod": {&api.Pod{}},
},
"../docs/tutorials/stateful-application": {
"gce-volume": {&api.PersistentVolume{}},
"mysql-deployment": {&api.Service{}, &api.PersistentVolumeClaim{}, &extensions.Deployment{}},
"mysql-services": {&api.Service{}, &api.Service{}},
"mysql-configmap": {&api.ConfigMap{}},
"mysql-statefulset": {&apps.StatefulSet{}},
"web": {&api.Service{}, &apps.StatefulSet{}},
"zookeeper": {&api.Service{}, &api.ConfigMap{}, &policy.PodDisruptionBudget{}, &apps.StatefulSet{}},
},
}
capabilities.SetForTests(capabilities.Capabilities{
AllowPrivileged: true,
})
for path, expected := range cases {
tested := 0
numExpected := 0
err := walkConfigFiles(path, func(name, path string, docs [][]byte) {
expectedTypes, found := expected[name]
if !found {
t.Errorf("%s: %s does not have a test case defined", path, name)
return
}
numExpected += len(expectedTypes)
if len(expectedTypes) != len(docs) {
t.Errorf("%s: number of expected types (%v) doesn't match number of docs in YAML (%v)", path, len(expectedTypes), len(docs))
return
}
for i, data := range docs {
expectedType := expectedTypes[i]
tested++
if expectedType == nil {
t.Logf("skipping : %s/%s\n", path, name)
return
}
if strings.Contains(name, "scheduler-policy-config") {
if err := runtime.DecodeInto(schedulerapilatest.Codec, data, expectedType); err != nil {
t.Errorf("%s did not decode correctly: %v\n%s", path, err, string(data))
return
}
// TODO: Add validate method for
// &schedulerapi.Policy, and remove this
// special case
} else {
codec, err := testapi.GetCodecForObject(expectedType)
if err != nil {
t.Errorf("Could not get codec for %s: %s", expectedType, err)
}
if err := runtime.DecodeInto(codec, data, expectedType); err != nil {
t.Errorf("%s did not decode correctly: %v\n%s", path, err, string(data))
return
}
if errors := validateObject(expectedType); len(errors) > 0 {
t.Errorf("%s did not validate correctly: %v", path, errors)
}
}
}
})
if err != nil {
t.Errorf("Expected no error, Got %v on Path %v", err, path)
}
if tested != numExpected {
t.Errorf("Directory %v: Expected %d examples, Got %d", path, len(expected), tested)
}
}
}
开发者ID:kubernetes,项目名称:kubernetes.github.io,代码行数:101,代码来源:examples_test.go
注:本文中的k8s/io/kubernetes/pkg/capabilities.SetForTests函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论