Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions cmd/rep/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,21 +179,21 @@ func main() {
)

members := grouper.Members{
{"presence", cellPresence},
{"http_server", httpServer},
{"https_server", httpsServer},
{"evacuation-cleanup", cleanup},
{"bulker", bulker},
{"event-consumer", harmonizer.NewEventConsumer(logger, opGenerator, queue)},
{"evacuator", evacuator},
{"request-metrics-notifier", requestMetrics},
{Name: "presence", Runner: cellPresence},
{Name: "http_server", Runner: httpServer},
{Name: "https_server", Runner: httpsServer},
{Name: "evacuation-cleanup", Runner: cleanup},
{Name: "bulker", Runner: bulker},
{Name: "event-consumer", Runner: harmonizer.NewEventConsumer(logger, opGenerator, queue)},
{Name: "evacuator", Runner: evacuator},
{Name: "request-metrics-notifier", Runner: requestMetrics},
}

members = append(executorMembers, members...)

if repConfig.DebugAddress != "" {
members = append(grouper.Members{
{"debug-server", debugserver.Runner(repConfig.DebugAddress, reconfigurableSink)},
{Name: "debug-server", Runner: debugserver.Runner(repConfig.DebugAddress, reconfigurableSink)},
}, members...)
}

Expand Down
16 changes: 10 additions & 6 deletions cmd/rep/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,12 +232,16 @@ var _ = Describe("The Rep", func() {
runner.Start()
})

AfterEach(func(done Done) {
close(flushEvents)
runner.KillWithFire()
fakeGarden.Close()
close(done)
// ginkgomon.Kill(locketProcess)
AfterEach(func() {
done := make(chan interface{})
go func() {
close(flushEvents)
runner.KillWithFire()
fakeGarden.Close()
close(done)
ginkgomon.Kill(locketProcess)
}()
Eventually(done).Should(BeClosed())
})

Context("the rep doesn't start", func() {
Expand Down
54 changes: 28 additions & 26 deletions evacuation/cleanup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,36 +163,38 @@ var _ = Describe("EvacuationCleanup", func() {
})

Describe("deleting running containers", func() {
It("should delete all of the containers that are still running", func() {
fakeExecutorClient.ListContainersReturnsOnCall(1,
[]executor.Container{
{
Guid: "container1",
State: executor.StateRunning,
RunInfo: executor.RunInfo{LogConfig: executor.LogConfig{Guid: "log-guid-1", SourceName: "source-name-1", Index: 0}},
},
{Guid: "container2",
State: executor.StateCompleted,
RunInfo: executor.RunInfo{LogConfig: executor.LogConfig{Guid: "log-guid-2", SourceName: "source-name-2", Index: 1}},
Context("When containers fail to exit initially", func() {
BeforeEach(func() {
fakeExecutorClient.ListContainersReturnsOnCall(1,
[]executor.Container{
{
Guid: "container1",
State: executor.StateRunning,
RunInfo: executor.RunInfo{LogConfig: executor.LogConfig{Guid: "log-guid-1", SourceName: "source-name-1", Index: 0}},
},
{Guid: "container2",
State: executor.StateCompleted,
RunInfo: executor.RunInfo{LogConfig: executor.LogConfig{Guid: "log-guid-2", SourceName: "source-name-2", Index: 1}},
},
},
},
nil,
)
fakeExecutorClient.ListContainersReturnsOnCall(2, []executor.Container{}, nil)

Consistently(errCh).ShouldNot(Receive())
fakeClock.Increment(time.Second * 1)
nil,
)
fakeExecutorClient.ListContainersReturnsOnCall(3, []executor.Container{}, nil)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason you changed the call count from 2 to 3?

I actually ran this test locally, once with the value set to 3, again with the value set to 2, and again with the line removed entirely, and all three runs passed 🤔

Might be best to just delete this line? I suspect counterfeiter returns empty values for calls with indexes that weren't specified ahead of time in stubs.

})
It("should delete all of the containers that are still running", func() {
Consistently(errCh).ShouldNot(Receive())
fakeClock.Increment(time.Second * 1)

Eventually(errCh).Should(Receive(nil))
Expect(fakeExecutorClient.ListContainersCallCount()).To(Equal(3))
Expect(fakeExecutorClient.DeleteContainerCallCount()).To(Equal(2))
Eventually(errCh).Should(Receive(nil))
Expect(fakeExecutorClient.ListContainersCallCount()).To(Equal(3))
Expect(fakeExecutorClient.DeleteContainerCallCount()).To(Equal(2))

_, c1 := fakeExecutorClient.DeleteContainerArgsForCall(0)
_, c2 := fakeExecutorClient.DeleteContainerArgsForCall(1)
containers := []string{c1, c2}
Expect(containers).To(ConsistOf("container1", "container2"))
_, c1 := fakeExecutorClient.DeleteContainerArgsForCall(0)
_, c2 := fakeExecutorClient.DeleteContainerArgsForCall(1)
containers := []string{c1, c2}
Expect(containers).To(ConsistOf("container1", "container2"))
})
})

It("emits app logs indicating evacuation timeout", func() {
Eventually(fakeMetronClient.SendAppLogCallCount).Should(Equal(2))
msg, containerSource, tags := fakeMetronClient.SendAppLogArgsForCall(0)
Expand Down
2 changes: 0 additions & 2 deletions evacuation/evacuation.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,6 @@ func (e *Evacuator) Run(signals <-chan os.Signal, ready chan<- struct{}) error {
logger.Info("signaled", lager.Data{"signal": signal.String()})
return nil
}

return nil
}

func (e *Evacuator) evacuate(logger lager.Logger, doneCh chan<- struct{}) {
Expand Down
2 changes: 0 additions & 2 deletions harmonizer/event_consumer.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,4 @@ func (consumer *EventConsumer) Run(signals <-chan os.Signal, ready chan<- struct
return nil
}
}

return nil
}
2 changes: 1 addition & 1 deletion rootfs_providers.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ func (provider FixedSetRootFSProvider) MarshalJSON() ([]byte, error) {

func (provider *FixedSetRootFSProvider) UnmarshalJSON(payload []byte) error {
type fixed struct {
Set StringSet `json"set"`
Set StringSet `json:"set"`
}

var f fixed
Expand Down