本文整理匯總了Golang中bosh/agent/action.IsAsynchronous函數的典型用法代碼示例。如果您正苦於以下問題:Golang IsAsynchronous函數的具體用法?Golang IsAsynchronous怎麽用?Golang IsAsynchronous使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了IsAsynchronous函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: init
func init() {
Describe("Testing with Ginkgo", func() {
It("list disk should be synchronous", func() {
settings := &fakesettings.FakeSettingsService{}
platform := fakeplatform.NewFakePlatform()
action := NewListDisk(settings, platform)
assert.False(GinkgoT(), action.IsAsynchronous())
})
It("list disk run", func() {
settings := &fakesettings.FakeSettingsService{
Disks: boshsettings.Disks{
Persistent: map[string]string{
"volume-1": "/dev/sda",
"volume-2": "/dev/sdb",
"volume-3": "/dev/sdc",
},
},
}
platform := fakeplatform.NewFakePlatform()
platform.MountedDevicePaths = []string{"/dev/sdb", "/dev/sdc"}
action := NewListDisk(settings, platform)
value, err := action.Run()
assert.NoError(GinkgoT(), err)
boshassert.MatchesJsonString(GinkgoT(), value, `["volume-2","volume-3"]`)
})
})
}
示例2: init
func init() {
Describe("Testing with Ginkgo", func() {
It("migrate disk should be asynchronous", func() {
_, action := buildMigrateDiskAction()
Expect(action.IsAsynchronous()).To(BeTrue())
})
It("is not persistent", func() {
_, action := buildMigrateDiskAction()
Expect(action.IsPersistent()).To(BeFalse())
})
It("migrate disk action run", func() {
platform, action := buildMigrateDiskAction()
value, err := action.Run()
Expect(err).ToNot(HaveOccurred())
boshassert.MatchesJSONString(GinkgoT(), value, "{}")
Expect(platform.MigratePersistentDiskFromMountPoint).To(Equal("/foo/store"))
Expect(platform.MigratePersistentDiskToMountPoint).To(Equal("/foo/store_migration_target"))
})
})
}
示例3: init
func init() {
Describe("Testing with Ginkgo", func() {
It("mount disk should be asynchronous", func() {
settings := &fakesettings.FakeSettingsService{}
_, action := buildMountDiskAction(settings)
Expect(action.IsAsynchronous()).To(BeTrue())
})
It("is not persistent", func() {
settings := &fakesettings.FakeSettingsService{}
_, action := buildMountDiskAction(settings)
Expect(action.IsPersistent()).To(BeFalse())
})
It("mount disk", func() {
settings := &fakesettings.FakeSettingsService{}
settings.Disks.Persistent = map[string]string{"vol-123": "/dev/sdf"}
platform, mountDisk := buildMountDiskAction(settings)
result, err := mountDisk.Run("vol-123")
Expect(err).NotTo(HaveOccurred())
boshassert.MatchesJSONString(GinkgoT(), result, "{}")
Expect(settings.SettingsWereLoaded).To(BeTrue())
Expect(platform.MountPersistentDiskDevicePath).To(Equal("/dev/sdf"))
Expect(platform.MountPersistentDiskMountPoint).To(Equal("/foo/store"))
})
It("mount disk when store already mounted", func() {
settings := &fakesettings.FakeSettingsService{}
settings.Disks.Persistent = map[string]string{"vol-123": "/dev/sdf"}
platform, mountDisk := buildMountDiskAction(settings)
platform.IsMountPointResult = true
result, err := mountDisk.Run("vol-123")
Expect(err).NotTo(HaveOccurred())
boshassert.MatchesJSONString(GinkgoT(), result, "{}")
Expect(platform.IsMountPointPath).To(Equal("/foo/store"))
Expect(platform.MountPersistentDiskDevicePath).To(Equal("/dev/sdf"))
Expect(platform.MountPersistentDiskMountPoint).To(Equal("/foo/store_migration_target"))
})
It("mount disk when device path not found", func() {
settings := &fakesettings.FakeSettingsService{}
settings.Disks.Persistent = map[string]string{"vol-123": "/dev/sdf"}
_, mountDisk := buildMountDiskAction(settings)
_, err := mountDisk.Run("vol-456")
Expect(err).To(HaveOccurred())
})
})
}
示例4: init
func init() {
Describe("Testing with Ginkgo", func() {
It("ssh should be synchronous", func() {
settings := &fakesettings.FakeSettingsService{}
_, action := buildSshAction(settings)
Expect(action.IsAsynchronous()).To(BeFalse())
})
It("is not persistent", func() {
settings := &fakesettings.FakeSettingsService{}
_, action := buildSshAction(settings)
Expect(action.IsPersistent()).To(BeFalse())
})
It("ssh setup without default ip", func() {
settings := &fakesettings.FakeSettingsService{}
_, action := buildSshAction(settings)
params := SshParams{
User: "some-user",
Password: "some-pwd",
PublicKey: "some-key",
}
_, err := action.Run("setup", params)
Expect(err).To(HaveOccurred())
Expect(err.Error()).To(ContainSubstring("No default ip"))
})
It("ssh setup with username and password", func() {
testSshSetupWithGivenPassword(GinkgoT(), "some-password")
})
It("ssh setup without password", func() {
testSshSetupWithGivenPassword(GinkgoT(), "")
})
It("ssh run cleanup deletes ephemeral user", func() {
settings := &fakesettings.FakeSettingsService{}
platform, action := buildSshAction(settings)
params := SshParams{UserRegex: "^foobar.*"}
response, err := action.Run("cleanup", params)
Expect(err).ToNot(HaveOccurred())
Expect("^foobar.*").To(Equal(platform.DeleteEphemeralUsersMatchingRegex))
boshassert.MatchesJsonMap(GinkgoT(), response, map[string]interface{}{
"command": "cleanup",
"status": "success",
})
})
})
}
示例5: init
func init() {
Describe("Testing with Ginkgo", func() {
It("mount disk should be asynchronous", func() {
settings := &fakesettings.FakeSettingsService{}
_, action := buildMountDiskAction(settings)
assert.True(GinkgoT(), action.IsAsynchronous())
})
It("mount disk", func() {
settings := &fakesettings.FakeSettingsService{}
settings.Disks.Persistent = map[string]string{"vol-123": "/dev/sdf"}
platform, mountDisk := buildMountDiskAction(settings)
result, err := mountDisk.Run("vol-123")
assert.NoError(GinkgoT(), err)
boshassert.MatchesJsonString(GinkgoT(), result, "{}")
assert.True(GinkgoT(), settings.SettingsWereRefreshed)
assert.Equal(GinkgoT(), platform.MountPersistentDiskDevicePath, "/dev/sdf")
assert.Equal(GinkgoT(), platform.MountPersistentDiskMountPoint, "/foo/store")
})
It("mount disk when store already mounted", func() {
settings := &fakesettings.FakeSettingsService{}
settings.Disks.Persistent = map[string]string{"vol-123": "/dev/sdf"}
platform, mountDisk := buildMountDiskAction(settings)
platform.IsMountPointResult = true
result, err := mountDisk.Run("vol-123")
assert.NoError(GinkgoT(), err)
boshassert.MatchesJsonString(GinkgoT(), result, "{}")
assert.Equal(GinkgoT(), platform.IsMountPointPath, "/foo/store")
assert.Equal(GinkgoT(), platform.MountPersistentDiskDevicePath, "/dev/sdf")
assert.Equal(GinkgoT(), platform.MountPersistentDiskMountPoint, "/foo/store_migration_target")
})
It("mount disk when device path not found", func() {
settings := &fakesettings.FakeSettingsService{}
settings.Disks.Persistent = map[string]string{"vol-123": "/dev/sdf"}
_, mountDisk := buildMountDiskAction(settings)
_, err := mountDisk.Run("vol-456")
assert.Error(GinkgoT(), err)
})
})
}
示例6: init
func init() {
Describe("Testing with Ginkgo", func() {
It("unmount disk should be asynchronous", func() {
platform := fakeplatform.NewFakePlatform()
action := buildUnmountDiskAction(platform)
Expect(action.IsAsynchronous()).To(BeTrue())
})
It("is not persistent", func() {
platform := fakeplatform.NewFakePlatform()
action := buildUnmountDiskAction(platform)
Expect(action.IsPersistent()).To(BeFalse())
})
It("unmount disk when the disk is mounted", func() {
platform := fakeplatform.NewFakePlatform()
platform.UnmountPersistentDiskDidUnmount = true
unmountDisk := buildUnmountDiskAction(platform)
result, err := unmountDisk.Run("vol-123")
Expect(err).ToNot(HaveOccurred())
boshassert.MatchesJSONString(GinkgoT(), result, `{"message":"Unmounted partition of /dev/sdf"}`)
Expect(platform.UnmountPersistentDiskDevicePath).To(Equal("/dev/sdf"))
})
It("unmount disk when the disk is not mounted", func() {
platform := fakeplatform.NewFakePlatform()
platform.UnmountPersistentDiskDidUnmount = false
mountDisk := buildUnmountDiskAction(platform)
result, err := mountDisk.Run("vol-123")
Expect(err).ToNot(HaveOccurred())
boshassert.MatchesJSONString(GinkgoT(), result, `{"message":"Partition of /dev/sdf is not mounted"}`)
Expect(platform.UnmountPersistentDiskDevicePath).To(Equal("/dev/sdf"))
})
It("unmount disk when device path not found", func() {
platform := fakeplatform.NewFakePlatform()
mountDisk := buildUnmountDiskAction(platform)
_, err := mountDisk.Run("vol-456")
Expect(err).To(HaveOccurred())
})
})
}
示例7: init
func init() {
Describe("Testing with Ginkgo", func() {
It("ping should be synchronous", func() {
action := NewPing()
assert.False(GinkgoT(), action.IsAsynchronous())
})
It("ping run returns pong", func() {
action := NewPing()
pong, err := action.Run()
assert.NoError(GinkgoT(), err)
assert.Equal(GinkgoT(), "pong", pong)
})
})
}
示例8: init
func init() {
Describe("Testing with Ginkgo", func() {
It("logs should be asynchronous", func() {
_, action := buildLogsAction()
Expect(action.IsAsynchronous()).To(BeTrue())
})
It("is not persistent", func() {
_, action := buildLogsAction()
Expect(action.IsPersistent()).To(BeFalse())
})
It("logs errs if given invalid log type", func() {
_, action := buildLogsAction()
_, err := action.Run("other-logs", []string{})
Expect(err).To(HaveOccurred())
})
It("agent logs with filters", func() {
filters := []string{"**/*.stdout.log", "**/*.stderr.log"}
expectedFilters := []string{"**/*.stdout.log", "**/*.stderr.log"}
testLogs(GinkgoT(), "agent", filters, expectedFilters)
})
It("agent logs without filters", func() {
filters := []string{}
expectedFilters := []string{"**/*"}
testLogs(GinkgoT(), "agent", filters, expectedFilters)
})
It("job logs without filters", func() {
filters := []string{}
expectedFilters := []string{"**/*.log"}
testLogs(GinkgoT(), "job", filters, expectedFilters)
})
It("job logs with filters", func() {
filters := []string{"**/*.stdout.log", "**/*.stderr.log"}
expectedFilters := []string{"**/*.stdout.log", "**/*.stderr.log"}
testLogs(GinkgoT(), "job", filters, expectedFilters)
})
})
}
示例9: init
func init() {
Describe("Testing with Ginkgo", func() {
It("unmount disk should be asynchronous", func() {
platform := fakeplatform.NewFakePlatform()
action := buildUnmountDiskAction(platform)
assert.True(GinkgoT(), action.IsAsynchronous())
})
It("unmount disk when the disk is mounted", func() {
platform := fakeplatform.NewFakePlatform()
platform.UnmountPersistentDiskDidUnmount = true
unmountDisk := buildUnmountDiskAction(platform)
result, err := unmountDisk.Run("vol-123")
assert.NoError(GinkgoT(), err)
boshassert.MatchesJsonString(GinkgoT(), result, `{"message":"Unmounted partition of /dev/sdf"}`)
assert.Equal(GinkgoT(), platform.UnmountPersistentDiskDevicePath, "/dev/sdf")
})
It("unmount disk when the disk is not mounted", func() {
platform := fakeplatform.NewFakePlatform()
platform.UnmountPersistentDiskDidUnmount = false
mountDisk := buildUnmountDiskAction(platform)
result, err := mountDisk.Run("vol-123")
assert.NoError(GinkgoT(), err)
boshassert.MatchesJsonString(GinkgoT(), result, `{"message":"Partition of /dev/sdf is not mounted"}`)
assert.Equal(GinkgoT(), platform.UnmountPersistentDiskDevicePath, "/dev/sdf")
})
It("unmount disk when device path not found", func() {
platform := fakeplatform.NewFakePlatform()
mountDisk := buildUnmountDiskAction(platform)
_, err := mountDisk.Run("vol-456")
assert.Error(GinkgoT(), err)
})
})
}
示例10: init
func init() {
Describe("Testing with Ginkgo", func() {
It("migrate disk should be asynchronous", func() {
_, action := buildMigrateDiskAction()
assert.True(GinkgoT(), action.IsAsynchronous())
})
It("migrate disk action run", func() {
platform, action := buildMigrateDiskAction()
value, err := action.Run()
assert.NoError(GinkgoT(), err)
boshassert.MatchesJsonString(GinkgoT(), value, "{}")
assert.Equal(GinkgoT(), platform.MigratePersistentDiskFromMountPoint, "/foo/store")
assert.Equal(GinkgoT(), platform.MigratePersistentDiskToMountPoint, "/foo/store_migration_target")
})
})
}
示例11: init
func init() {
Describe("Testing with Ginkgo", func() {
It("prepare network change should be synchronous", func() {
action, _ := buildPrepareAction()
assert.False(GinkgoT(), action.IsAsynchronous())
})
It("prepare network change", func() {
action, fs := buildPrepareAction()
fs.WriteToFile("/etc/udev/rules.d/70-persistent-net.rules", "")
resp, err := action.Run()
assert.NoError(GinkgoT(), err)
assert.Equal(GinkgoT(), "ok", resp)
assert.False(GinkgoT(), fs.FileExists("/etc/udev/rules.d/70-persistent-net.rules"))
})
})
}
示例12: init
func init() {
Describe("Testing with Ginkgo", func() {
var (
logger boshlog.Logger
platform *fakeplatform.FakePlatform
)
BeforeEach(func() {
platform = fakeplatform.NewFakePlatform()
logger = boshlog.NewLogger(boshlog.LEVEL_NONE)
})
It("list disk should be synchronous", func() {
settings := &fakesettings.FakeSettingsService{}
action := NewListDisk(settings, platform, logger)
Expect(action.IsAsynchronous()).To(BeFalse())
})
It("is not persistent", func() {
settings := &fakesettings.FakeSettingsService{}
action := NewListDisk(settings, platform, logger)
Expect(action.IsPersistent()).To(BeFalse())
})
It("list disk run", func() {
settings := &fakesettings.FakeSettingsService{
Disks: boshsettings.Disks{
Persistent: map[string]string{
"volume-1": "/dev/sda",
"volume-2": "/dev/sdb",
"volume-3": "/dev/sdc",
},
},
}
platform.MountedDevicePaths = []string{"/dev/sdb", "/dev/sdc"}
action := NewListDisk(settings, platform, logger)
value, err := action.Run()
Expect(err).ToNot(HaveOccurred())
boshassert.MatchesJsonString(GinkgoT(), value, `["volume-2","volume-3"]`)
})
})
}
示例13: init
func init() {
Describe("Ping", func() {
It("is synchronous", func() {
action := NewPing()
Expect(action.IsAsynchronous()).To(BeFalse())
})
It("is not persistent", func() {
action := NewPing()
Expect(action.IsPersistent()).To(BeFalse())
})
It("ping run returns pong", func() {
action := NewPing()
pong, err := action.Run()
Expect(err).ToNot(HaveOccurred())
Expect(pong).To(Equal("pong"))
})
})
}
示例14: init
func init() {
Describe("Testing with Ginkgo", func() {
It("logs should be asynchronous", func() {
_, action := buildLogsAction()
assert.True(GinkgoT(), action.IsAsynchronous())
})
It("logs errs if given invalid log type", func() {
_, action := buildLogsAction()
_, err := action.Run("other-logs", []string{})
assert.Error(GinkgoT(), err)
})
It("agent logs with filters", func() {
filters := []string{"**/*.stdout.log", "**/*.stderr.log"}
expectedFilters := []string{"**/*.stdout.log", "**/*.stderr.log"}
testLogs(GinkgoT(), "agent", filters, expectedFilters)
})
It("agent logs without filters", func() {
filters := []string{}
expectedFilters := []string{"**/*"}
testLogs(GinkgoT(), "agent", filters, expectedFilters)
})
It("job logs without filters", func() {
filters := []string{}
expectedFilters := []string{"**/*.log"}
testLogs(GinkgoT(), "job", filters, expectedFilters)
})
It("job logs with filters", func() {
filters := []string{"**/*.stdout.log", "**/*.stderr.log"}
expectedFilters := []string{"**/*.stdout.log", "**/*.stderr.log"}
testLogs(GinkgoT(), "job", filters, expectedFilters)
})
})
}
示例15: init
func init() {
Describe("Testing with Ginkgo", func() {
It("stop should be asynchronous", func() {
_, action := buildStopAction()
assert.True(GinkgoT(), action.IsAsynchronous())
})
It("stop run returns stopped", func() {
_, action := buildStopAction()
stopped, err := action.Run()
assert.NoError(GinkgoT(), err)
assert.Equal(GinkgoT(), "stopped", stopped)
})
It("stop run stops job supervisor services", func() {
jobSupervisor, action := buildStopAction()
_, err := action.Run()
assert.NoError(GinkgoT(), err)
assert.True(GinkgoT(), jobSupervisor.Stopped)
})
})
}