var (
	config               helpers.Config
	boshClient           bosh.Client
	consulReleaseVersion string
)

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

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

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

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

func lockedDeployments() ([]string, error) {
	var lockNames []string
	locks, err := boshClient.Locks()
	if err != nil {
						"username": "******",
						"password": "******"
					},
					"parallel_nodes": 4,
					"windows_clients": true
				}`)
				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{
						Subnets: []helpers.ConfigSubnet{
							{ID: "some-awssubnet-1", Range: "10.0.1.0/24", AZ: "some-az-1", SecurityGroup: "some-security-group-1"},
							{ID: "some-awssubnet-2", Range: "10.0.2.0/24", AZ: "some-az-2", SecurityGroup: "some-security-group-2"},
						},
						CloudConfigSubnets: []helpers.ConfigSubnet{
							{ID: "some-cloudconfig-awssubnet-1", Range: "10.0.3.0/24", AZ: "some-az-1", SecurityGroup: "some-security-group-1"},