SettingsValue: boshsettings.Settings{AgentID: "fake-settings-2"},
				SettingsErr:   errors.New("fake-settings-err-2"),
			}
		})

		JustBeforeEach(func() {
			var err error
			source, err = NewMultiSettingsSource(source1, source2)
			Expect(err).ToNot(HaveOccurred())
		})

		Describe("PublicSSHKeyForUsername", func() {
			Context("when the first source returns public key", func() {
				BeforeEach(func() {
					source1.PublicKeyErr = nil
				})

				It("returns public key and public key error from the first source", func() {
					publicKey, err := source.PublicSSHKeyForUsername("fake-username")
					Expect(err).ToNot(HaveOccurred())
					Expect(publicKey).To(Equal("fake-public-key-1"))
				})
			})

			Context("when the second source returns public key", func() {
				BeforeEach(func() {
					source2.PublicKeyErr = nil
				})

				It("returns public key from the second source", func() {