本文整理汇总了Golang中github.com/cloudfoundry-incubator/ducati-daemon/fakes.Namespace.MarshalJSONReturns方法的典型用法代码示例。如果您正苦于以下问题:Golang Namespace.MarshalJSONReturns方法的具体用法?Golang Namespace.MarshalJSONReturns怎么用?Golang Namespace.MarshalJSONReturns使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/cloudfoundry-incubator/ducati-daemon/fakes.Namespace
的用法示例。
在下文中一共展示了Namespace.MarshalJSONReturns方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1:
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gbytes"
)
var _ = Describe("NamespaceWriter", func() {
var (
nsWriter *executor.NamespaceWriter
ns *fakes.Namespace
writer *fakes.Writer
logger *lagertest.TestLogger
)
BeforeEach(func() {
ns = &fakes.Namespace{}
ns.MarshalJSONReturns([]byte(`{ "namespace": "my-namespace", "inode": "some-inode" }`), nil)
ns.ExecuteStub = func(callback func(*os.File) error) error {
return callback(nil)
}
logger = lagertest.NewTestLogger("test")
writer = &fakes.Writer{}
nsWriter = &executor.NamespaceWriter{
Logger: logger,
Namespace: ns,
Writer: writer,
}
})
It("writes to the wrapped writer in the associated namespace", func() {
示例2:
locker *fakes.Locker
sub *fakes.Subscriber
ns *fakes.Namespace
vxlanLinkName string
resolver *fakes.Resolver
missWatcher watcher.MissWatcher
arpInserter *fakes.ARPInserter
)
BeforeEach(func() {
sub = &fakes.Subscriber{}
logger = lagertest.NewTestLogger("test")
locker = &fakes.Locker{}
ns = &fakes.Namespace{}
ns.MarshalJSONReturns([]byte("{}"), nil)
vxlanLinkName = "some-vxlan-name"
resolver = &fakes.Resolver{}
arpInserter = &fakes.ARPInserter{}
arpInserter.HandleResolvedNeighborsStub = func(ready chan error, _ namespace.Namespace, _ string, _ <-chan watcher.Neighbor) {
close(ready)
}
missWatcher = watcher.New(logger, sub, locker, resolver, arpInserter)
ns.ExecuteStub = func(callback func(ns *os.File) error) error {
err := callback(nil)
if err != nil {
return fmt.Errorf("callback failed: %s", err)