1package gc_test
2
3import (
4	"context"
5
6	"github.com/concourse/concourse/atc/db/dbfakes"
7	"github.com/concourse/concourse/atc/gc"
8	. "github.com/onsi/ginkgo"
9	. "github.com/onsi/gomega"
10)
11
12var _ = Describe("ArtifactCollector", func() {
13	var collector GcCollector
14	var fakeArtifactLifecycle *dbfakes.FakeWorkerArtifactLifecycle
15
16	BeforeEach(func() {
17		fakeArtifactLifecycle = new(dbfakes.FakeWorkerArtifactLifecycle)
18
19		collector = gc.NewArtifactCollector(fakeArtifactLifecycle)
20	})
21
22	Describe("Run", func() {
23		It("tells the artifact lifecycle to remove expired artifacts", func() {
24			err := collector.Run(context.TODO())
25			Expect(err).NotTo(HaveOccurred())
26
27			Expect(fakeArtifactLifecycle.RemoveExpiredArtifactsCallCount()).To(Equal(1))
28		})
29	})
30})
31