Ejemplo n.º 1
0
	BeforeEach(func() {
		cloudFormationClient = &mocks.CloudFormationClient{}
		client = awsclient.Client{
			CloudFormation: cloudFormationClient,
		}

		cloudFormationClient.DescribeStackResourcesCall.Returns.Output = &cloudformation.DescribeStackResourcesOutput{
			StackResources: []*cloudformation.StackResource{
				newResource("SomeLogicalResourceID", "some-physical-resource-id"),
				newResource("SomeOtherLogicalResourceID", "some-other-physical-resource-id"),
			},
		}
	})

	It("should use the provided stack name to look up the stack resources", func() {
		_, err := client.GetStackResources("some-stack-name")
		Expect(err).NotTo(HaveOccurred())

		Expect(cloudFormationClient.DescribeStackResourcesCall.Receives.Input.StackName).To(Equal(aws.String("some-stack-name")))
	})

	It("should return all the resources", func() {
		resources, err := client.GetStackResources("some-stack-name")
		Expect(err).NotTo(HaveOccurred())

		Expect(resources).To(HaveKeyWithValue("SomeLogicalResourceID", "some-physical-resource-id"))
		Expect(resources).To(HaveKeyWithValue("SomeOtherLogicalResourceID", "some-other-physical-resource-id"))
	})

	It("should return pseudo-resources for account ID and region", func() {
		resources, err := client.GetStackResources("some-stack-name")