Example #1
0
		awsClient.DescribeStackCall.Returns.Status = "CREATE_COMPLETE"
		awsClient.DescribeStackCall.Returns.StackID = "some-stack-id"
		awsClient.URLForObjectCall.Returns.URL = "some-url"

		awsClient.GetHostsFromStackIDCall.Returns.Hosts = map[string]string{
			"host-a": "running",
			"host-b": "stopped",
			"host-c": "who-knows",
			"host-d": "running",
		}

		webClient.GetCall.Returns.Body = []byte("some pem bytes")
	})

	It("should run the command on all running VMs", func() {
		err := c.RunOnVMs(classroomName, "some command to run")
		Expect(err).NotTo(HaveOccurred())

		Expect(parallelRunner.ConnectAndRunCall.Receives.Hosts).To(ConsistOf([]string{"host-a", "host-d"}))
		Expect(parallelRunner.ConnectAndRunCall.Receives.Command).To(Equal("some command to run"))
		Expect(parallelRunner.ConnectAndRunCall.Receives.Options).To(Equal(&shell.ConnectionOptions{
			Port:          1234,
			Username:      "******",
			PrivateKeyPEM: []byte("some pem bytes"),
		}))
	})

	It("should get the SSH key from S3", func() {
		err := c.RunOnVMs(classroomName, "some command to run")
		Expect(err).NotTo(HaveOccurred())