certificateValidator iam.CertificateValidator certFilePath string keyFilePath string chainFilePath string certNonPEMFilePath string keyNonPEMFilePath string chainNonPEMFilePath string otherKeyFilePath string otherCertFilePath string otherChainFilePath string ) BeforeEach(func() { var err error certificateValidator = iam.NewCertificateValidator() chainFilePath, err = testhelpers.WriteContentsToTempFile(testhelpers.BBL_CHAIN) Expect(err).NotTo(HaveOccurred()) certFilePath, err = testhelpers.WriteContentsToTempFile(testhelpers.BBL_CERT) Expect(err).NotTo(HaveOccurred()) keyFilePath, err = testhelpers.WriteContentsToTempFile(testhelpers.BBL_KEY) Expect(err).NotTo(HaveOccurred()) otherChainFilePath, err = testhelpers.WriteContentsToTempFile(testhelpers.OTHER_BBL_CHAIN) Expect(err).NotTo(HaveOccurred()) otherCertFilePath, err = testhelpers.WriteContentsToTempFile(testhelpers.OTHER_BBL_CERT) Expect(err).NotTo(HaveOccurred()) otherKeyFilePath, err = testhelpers.WriteContentsToTempFile(testhelpers.OTHER_BBL_KEY)
) BeforeEach(func() { fakeBOSH = &fakeBOSHDirector{} fakeBOSHServer = httptest.NewServer(http.HandlerFunc(func(responseWriter http.ResponseWriter, request *http.Request) { fakeBOSH.ServeHTTP(responseWriter, request) })) fakeAWS = awsbackend.New(fakeBOSHServer.URL) fakeAWSServer = httptest.NewServer(awsfaker.New(fakeAWS)) var err error tempDirectory, err = ioutil.TempDir("", "") Expect(err).NotTo(HaveOccurred()) lbCertPath, err = testhelpers.WriteContentsToTempFile(testhelpers.BBL_CERT) Expect(err).NotTo(HaveOccurred()) lbChainPath, err = testhelpers.WriteContentsToTempFile(testhelpers.BBL_CHAIN) Expect(err).NotTo(HaveOccurred()) lbKeyPath, err = testhelpers.WriteContentsToTempFile(testhelpers.BBL_KEY) Expect(err).NotTo(HaveOccurred()) }) Describe("unsupported-deploy-bosh-on-aws-for-concourse", func() { Context("when the cloudformation stack does not exist", func() { var stack awsbackend.Stack It("creates a stack and a keypair", func() { deployBOSHOnAWSForConcourse(fakeAWSServer.URL, tempDirectory, 0)
) BeforeEach(func() { var err error configuration, err := integration.LoadConfig() Expect(err).NotTo(HaveOccurred()) bbl = actors.NewBBL(configuration.StateFileDir, pathToBBL, configuration) aws = actors.NewAWS(configuration) state = integration.NewState(configuration.StateFileDir) }) It("is able to deploy concourse", func() { bbl.Up() certPath, err := testhelpers.WriteContentsToTempFile(testhelpers.BBL_CERT) Expect(err).NotTo(HaveOccurred()) keyPath, err := testhelpers.WriteContentsToTempFile(testhelpers.BBL_KEY) Expect(err).NotTo(HaveOccurred()) bbl.CreateLB("concourse", certPath, keyPath, "") boshClient := bosh.NewClient(bosh.Config{ URL: bbl.DirectorAddress(), Username: bbl.DirectorUsername(), Password: bbl.DirectorPassword(), AllowInsecureSSL: true, }) err = downloadAndUploadRelease(boshClient, ConcourseReleaseURL)
}) It("creates, updates and deletes an LB with the specified cert and key", func() { bbl.Up() stackName := state.StackName() directorAddress := bbl.DirectorAddress() directorUsername := bbl.DirectorUsername() directorPassword := bbl.DirectorPassword() Expect(aws.StackExists(stackName)).To(BeTrue()) Expect(aws.LoadBalancers(stackName)).To(BeEmpty()) Expect(bosh.DirectorExists(directorAddress, directorUsername, directorPassword)).To(BeTrue()) certPath, err := testhelpers.WriteContentsToTempFile(testhelpers.BBL_CERT) Expect(err).NotTo(HaveOccurred()) chainPath, err := testhelpers.WriteContentsToTempFile(testhelpers.BBL_CHAIN) Expect(err).NotTo(HaveOccurred()) keyPath, err := testhelpers.WriteContentsToTempFile(testhelpers.BBL_KEY) Expect(err).NotTo(HaveOccurred()) otherCertPath, err := testhelpers.WriteContentsToTempFile(testhelpers.OTHER_BBL_CERT) Expect(err).NotTo(HaveOccurred()) otherKeyPath, err := testhelpers.WriteContentsToTempFile(testhelpers.OTHER_BBL_KEY) Expect(err).NotTo(HaveOccurred()) bbl.CreateLB("concourse", certPath, keyPath, chainPath)
infrastructureManager.ExistsCall.Returns.Exists = true incomingState = storage.State{ Stack: storage.Stack{ LBType: "concourse", CertificateName: "some-certificate-name", }, BOSH: storage.BOSH{ DirectorAddress: "some-director-address", DirectorUsername: "******", DirectorPassword: "******", }, } certFilePath, err = testhelpers.WriteContentsToTempFile("some-certificate-contents") Expect(err).NotTo(HaveOccurred()) keyFilePath, err = testhelpers.WriteContentsToTempFile("some-key-contents") Expect(err).NotTo(HaveOccurred()) chainFilePath, err = testhelpers.WriteContentsToTempFile("some-chain-contents") Expect(err).NotTo(HaveOccurred()) command = commands.NewUpdateLBs(awsCredentialValidator, certificateManager, availabilityZoneRetriever, infrastructureManager, boshClientProvider, logger, certificateValidator) }) Describe("Execute", func() { It("creates the new certificate with private key", func() { updateLBs(certFilePath, keyFilePath, "", storage.State{
BeforeEach(func() { fakeBOSH = &fakeBOSHDirector{} fakeBOSHServer = httptest.NewServer(http.HandlerFunc(func(responseWriter http.ResponseWriter, request *http.Request) { fakeBOSH.ServeHTTP(responseWriter, request) })) fakeAWS = awsbackend.New(fakeBOSHServer.URL) fakeAWSServer = httptest.NewServer(awsfaker.New(fakeAWS)) var err error tempDirectory, err = ioutil.TempDir("", "") Expect(err).NotTo(HaveOccurred()) deployBOSHOnAWSForConcourse(fakeAWSServer.URL, tempDirectory, 0) lbCertPath, err = testhelpers.WriteContentsToTempFile(testhelpers.BBL_CERT) Expect(err).NotTo(HaveOccurred()) lbChainPath, err = testhelpers.WriteContentsToTempFile(testhelpers.BBL_CHAIN) Expect(err).NotTo(HaveOccurred()) lbKeyPath, err = testhelpers.WriteContentsToTempFile(testhelpers.BBL_KEY) Expect(err).NotTo(HaveOccurred()) otherLBCertPath, err = testhelpers.WriteContentsToTempFile(testhelpers.OTHER_BBL_CERT) Expect(err).NotTo(HaveOccurred()) otherLBChainPath, err = testhelpers.WriteContentsToTempFile(testhelpers.OTHER_BBL_CHAIN) Expect(err).NotTo(HaveOccurred()) otherLBKeyPath, err = testhelpers.WriteContentsToTempFile(testhelpers.OTHER_BBL_KEY)