func main() { configuration, err := flags.ParseFlags(os.Args[1:]) if err != nil { fmt.Fprintf(os.Stderr, "\n\n%s\n", err) os.Exit(1) } boshConfig := bosh.Config{ URL: configuration.BoshDirector, Password: configuration.BoshPassword, Username: configuration.BoshUser, AllowInsecureSSL: true, } aws := clients.NewAWS(configuration.AWSAccessKeyID, configuration.AWSSecretAccessKey, configuration.AWSRegion, configuration.AWSEndpointOverride) bosh := clients.NewBOSH(bosh.NewClient(boshConfig), os.Stdout) subnetChecker := subnetchecker.NewSubnetChecker(aws) awsDeployer := awsdeployer.NewAWSDeployer(bosh, subnetChecker, os.Stdout) err = awsDeployer.Deploy(configuration.ManifestPath) if err != nil { fmt.Fprintf(os.Stderr, "\n\n%s\n", err) os.Exit(1) } os.Exit(0) }
var _ = Describe("AWSDeployer", func() { Describe("Deploy", func() { var ( fakeBOSH *fakes.BOSH fakeSubnetChecker *fakes.SubnetChecker awsDeployer awsdeployer.AWSDeployer stdout io.Writer ) BeforeEach(func() { fakeBOSH = &fakes.BOSH{} fakeSubnetChecker = &fakes.SubnetChecker{} stdout = ioutil.Discard awsDeployer = awsdeployer.NewAWSDeployer(clients.NewBOSH(fakeBOSH, stdout), fakeSubnetChecker, stdout) fakeSubnetChecker.CheckSubnetsCall.Returns.Bool = true }) It("deploys specified bosh manifest", func() { manifestFilename := createManifestFile("director_uuid: BOSH-DIRECTOR-UUID\nname: deployment-1") deploymentError := awsDeployer.Deploy(manifestFilename) Expect(deploymentError).NotTo(HaveOccurred()) Expect(fakeBOSH.DeployCall.CallCount).To(Equal(1)) Expect(fakeBOSH.DeployCall.Receives.Manifest).To(ContainSubstring("deployment-1")) }) It("replaces the bosh director uuid before deploying each manifest", func() { manifestFilename := createBasicManifestFile()