Пример #1
0
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"))
		})
	})
}
Пример #2
0
func testSSHSetupWithGivenPassword(expectedPwd string) {
	settingsService := &fakesettings.FakeSettingsService{}
	settingsService.Settings.Networks = boshsettings.Networks{
		"fake-net": boshsettings.Network{IP: "ww.xx.yy.zz"},
	}

	platform, action := buildSSHAction(settingsService)

	params := SSHParams{
		User:      "******",
		PublicKey: "fake-public-key",
		Password:  expectedPwd,
	}

	response, err := action.Run("setup", params)
	Expect(err).ToNot(HaveOccurred())
	Expect(response).To(Equal(SSHResult{
		Command: "setup",
		Status:  "success",
		IP:      "ww.xx.yy.zz",
	}))

	Expect(platform.CreateUserUsername).To(Equal("fake-user"))
	Expect(platform.CreateUserPassword).To(Equal(expectedPwd))
	Expect(platform.CreateUserBasePath).To(Equal("/foo/bosh_ssh"))

	Expect(platform.AddUserToGroupsGroups["fake-user"]).To(Equal(
		[]string{boshsettings.VCAPUsername, boshsettings.AdminGroup},
	))

	Expect(platform.SetupSSHPublicKeys["fake-user"]).To(Equal("fake-public-key"))
}
Пример #3
0
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"))
		})
	})
}