buildID, savedInput := fakeDB.SaveBuildInputArgsForCall(0)
					Ω(buildID).Should(Equal(42))
					Ω(savedInput).Should(Equal(db.BuildInput{
						Name: "some-input",
						VersionedResource: db.VersionedResource{
							PipelineName: "some-pipeline",
							Resource:     "some-input-resource",
							Type:         "some-type",
							Version:      db.Version{"result": "version"},
							Metadata:     []db.MetadataField{{"result", "metadata"}},
						},
					}))
				})

				It("saves a finish-get event", func() {
					Ω(fakeDB.SaveBuildEventCallCount()).Should(Equal(1))

					buildID, savedEvent := fakeDB.SaveBuildEventArgsForCall(0)
					Ω(buildID).Should(Equal(42))
					Ω(savedEvent).Should(Equal(event.FinishGet{
						Origin: event.Origin{
							Type:     event.OriginTypeGet,
							Name:     "some-input",
							Location: location,
						},
						Plan: event.GetPlan{
							Name:     "some-input",
							Resource: "some-input-resource",
							Type:     "some-type",
							Version:  atc.Version{"some": "version"},
						},
					Version:  atc.Version{"result": "version"},
					Metadata: []atc.MetadataField{{"result", "metadata"}},
				}
			})

			Context("when exit status is not 0", func() {
				JustBeforeEach(func() {
					inputDelegate.Completed(exec.ExitStatus(12), nil)
				})

				It("does not save the build's input", func() {
					Expect(fakeDB.SaveBuildInputCallCount()).To(Equal(0))
				})

				It("saves a finish-get event", func() {
					Expect(fakeDB.SaveBuildEventCallCount()).To(Equal(1))

					buildID, savedEvent := fakeDB.SaveBuildEventArgsForCall(0)
					Expect(buildID).To(Equal(42))
					Expect(savedEvent).To(Equal(event.FinishGet{
						Origin: event.Origin{
							Type:     event.OriginTypeGet,
							Name:     "some-input",
							Location: location,
						},
						Plan: event.GetPlan{
							Name:     "some-input",
							Resource: "some-input-resource",
							Type:     "some-type",
							Version:  atc.Version{"some": "version"},
						},