Пример #1
0
						"host": "some-registry-host",
						"port": 12345,
						"username": "******",
						"password": "******"
					}
				}`)
				Expect(err).NotTo(HaveOccurred())
			})

			AfterEach(func() {
				err := os.Remove(configFilePath)
				Expect(err).NotTo(HaveOccurred())
			})

			It("loads the config from the given path", func() {
				config, err := helpers.LoadConfig(configFilePath)
				Expect(err).NotTo(HaveOccurred())
				Expect(config).To(Equal(helpers.Config{
					BOSH: helpers.ConfigBOSH{
						Target:         "some-bosh-target",
						Username:       "******",
						Password:       "******",
						DirectorCACert: "some-ca-cert",
					},
					AWS: helpers.ConfigAWS{
						Subnet:                "some-awssubnet",
						AccessKeyID:           "some-access-key-id",
						SecretAccessKey:       "some-secret-access-key",
						DefaultKeyName:        "some-default-key-name",
						DefaultSecurityGroups: []string{"some-default-security-group"},
						Region:                "some-region",
Пример #2
0
var (
	config helpers.Config
	client bosh.Client
)

func TestDeploy(t *testing.T) {
	RegisterFailHandler(Fail)
	RunSpecs(t, "precheck")
}

var _ = BeforeSuite(func() {
	configPath, err := helpers.ConfigPath()
	Expect(err).NotTo(HaveOccurred())

	config, err = helpers.LoadConfig(configPath)
	Expect(err).NotTo(HaveOccurred())

	client = bosh.NewClient(bosh.Config{
		URL:              fmt.Sprintf("https://%s:25555", config.BOSH.Target),
		Username:         config.BOSH.Username,
		Password:         config.BOSH.Password,
		AllowInsecureSSL: true,
	})
})

var _ = Describe("precheck", func() {
	It("confirms that there are no conflicting deployments", func() {
		deployments, err := client.Deployments()
		Expect(err).NotTo(HaveOccurred())