Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
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
2 changes: 1 addition & 1 deletion auctioncellrep/auction_cell_rep.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

"code.cloudfoundry.org/bbs/models"
"code.cloudfoundry.org/executor"
"code.cloudfoundry.org/lager"
"code.cloudfoundry.org/lager/v3"
"code.cloudfoundry.org/rep"
"code.cloudfoundry.org/rep/evacuation/evacuation_context"
)
Expand Down
2 changes: 1 addition & 1 deletion auctioncellrep/auction_cell_rep_suite_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package auctioncellrep_test

import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

"testing"
Expand Down
4 changes: 2 additions & 2 deletions auctioncellrep/auction_cell_rep_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import (
"code.cloudfoundry.org/executor"
"code.cloudfoundry.org/executor/containermetrics"
fake_client "code.cloudfoundry.org/executor/fakes"
"code.cloudfoundry.org/lager/lagertest"
"code.cloudfoundry.org/lager/v3/lagertest"
"code.cloudfoundry.org/rep"
"code.cloudfoundry.org/rep/auctioncellrep"
fakes "code.cloudfoundry.org/rep/auctioncellrep/auctioncellrepfakes"
"code.cloudfoundry.org/rep/evacuation/evacuation_context/fake_evacuation_context"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion auctioncellrep/batch_container_allocator.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"strconv"

"code.cloudfoundry.org/executor"
"code.cloudfoundry.org/lager"
"code.cloudfoundry.org/lager/v3"
"code.cloudfoundry.org/rep"
)

Expand Down
4 changes: 2 additions & 2 deletions auctioncellrep/batch_container_allocator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import (
"code.cloudfoundry.org/bbs/models"
"code.cloudfoundry.org/executor"
fake_client "code.cloudfoundry.org/executor/fakes"
"code.cloudfoundry.org/lager/lagertest"
"code.cloudfoundry.org/lager/v3/lagertest"
"code.cloudfoundry.org/rep"
"code.cloudfoundry.org/rep/auctioncellrep"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gbytes"
)
Expand Down
2 changes: 1 addition & 1 deletion auctioncellrep/helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package auctioncellrep_test

import (
"code.cloudfoundry.org/rep/auctioncellrep"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)

Expand Down
2 changes: 1 addition & 1 deletion client.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"time"

"code.cloudfoundry.org/bbs/models"
"code.cloudfoundry.org/lager"
"code.cloudfoundry.org/lager/v3"
"code.cloudfoundry.org/tlsconfig"
"github.com/tedsuo/rata"
)
Expand Down
4 changes: 2 additions & 2 deletions client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import (

"code.cloudfoundry.org/bbs/models"
cfhttp "code.cloudfoundry.org/cfhttp/v2"
"code.cloudfoundry.org/lager/lagertest"
"code.cloudfoundry.org/lager/v3/lagertest"
"code.cloudfoundry.org/rep"
"code.cloudfoundry.org/routing-info/internalroutes"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gbytes"
"github.com/onsi/gomega/ghttp"
Expand Down
2 changes: 1 addition & 1 deletion cmd/gocurl/main_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"os"
"path"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gexec"
"github.com/onsi/gomega/ghttp"
Expand Down
2 changes: 1 addition & 1 deletion cmd/gocurl/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"time"

"code.cloudfoundry.org/tlsconfig"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/ghttp"
)
Expand Down
2 changes: 1 addition & 1 deletion cmd/rep/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
loggingclient "code.cloudfoundry.org/diego-logging-client"
"code.cloudfoundry.org/durationjson"
executorinit "code.cloudfoundry.org/executor/initializer"
"code.cloudfoundry.org/lager/lagerflags"
"code.cloudfoundry.org/lager/v3/lagerflags"
"code.cloudfoundry.org/locket"
"code.cloudfoundry.org/rep"
)
Expand Down
2 changes: 1 addition & 1 deletion cmd/rep/config/config_suite_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package config_test

import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

"testing"
Expand Down
4 changes: 2 additions & 2 deletions cmd/rep/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ import (
loggingclient "code.cloudfoundry.org/diego-logging-client"
"code.cloudfoundry.org/durationjson"
executorinit "code.cloudfoundry.org/executor/initializer"
"code.cloudfoundry.org/lager/lagerflags"
"code.cloudfoundry.org/lager/v3/lagerflags"
"code.cloudfoundry.org/locket"
"code.cloudfoundry.org/rep/cmd/rep/config"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)

Expand Down
22 changes: 11 additions & 11 deletions cmd/rep/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ import (
"code.cloudfoundry.org/executor"
executorinit "code.cloudfoundry.org/executor/initializer"
"code.cloudfoundry.org/go-loggregator/v8/runtimeemitter"
"code.cloudfoundry.org/lager"
"code.cloudfoundry.org/lager/lagerflags"
"code.cloudfoundry.org/lager/v3"
"code.cloudfoundry.org/lager/v3/lagerflags"
"code.cloudfoundry.org/localip"
"code.cloudfoundry.org/locket"
"code.cloudfoundry.org/locket/lock"
Expand Down 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
8 changes: 4 additions & 4 deletions cmd/rep/main_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@ import (
"code.cloudfoundry.org/durationjson"
"code.cloudfoundry.org/go-loggregator/v8/rpc/loggregator_v2"
"code.cloudfoundry.org/inigo/helpers/portauthority"
"code.cloudfoundry.org/lager/lagerflags"
"code.cloudfoundry.org/lager/lagertest"
"code.cloudfoundry.org/lager/v3/lagerflags"
"code.cloudfoundry.org/lager/v3/lagertest"
"code.cloudfoundry.org/locket"
locketconfig "code.cloudfoundry.org/locket/cmd/locket/config"
locketrunner "code.cloudfoundry.org/locket/cmd/locket/testrunner"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gexec"
"github.com/onsi/gomega/ghttp"
"github.com/tedsuo/ifrit"
"github.com/tedsuo/ifrit/ginkgomon"
ginkgomon "github.com/tedsuo/ifrit/ginkgomon_v2"
"google.golang.org/grpc/grpclog"
)

Expand Down
26 changes: 15 additions & 11 deletions cmd/rep/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,22 @@ import (
"code.cloudfoundry.org/executor/initializer/configuration"
"code.cloudfoundry.org/garden"
"code.cloudfoundry.org/garden/transport"
"code.cloudfoundry.org/lager"
"code.cloudfoundry.org/lager/lagerflags"
"code.cloudfoundry.org/lager/lagertest"
"code.cloudfoundry.org/lager/v3"
"code.cloudfoundry.org/lager/v3/lagerflags"
"code.cloudfoundry.org/lager/v3/lagertest"
"code.cloudfoundry.org/locket"
locketrunner "code.cloudfoundry.org/locket/cmd/locket/testrunner"
locketmodels "code.cloudfoundry.org/locket/models"
"code.cloudfoundry.org/rep"
"code.cloudfoundry.org/rep/cmd/rep/config"
"code.cloudfoundry.org/rep/cmd/rep/testrunner"
"code.cloudfoundry.org/tlsconfig"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gbytes"
. "github.com/onsi/gomega/gexec"
"github.com/onsi/gomega/ghttp"
"github.com/tedsuo/ifrit/ginkgomon"
ginkgomon "github.com/tedsuo/ifrit/ginkgomon_v2"
)

var runner *testrunner.Runner
Expand Down 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
2 changes: 1 addition & 1 deletion cmd/rep/testrunner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

"code.cloudfoundry.org/rep/cmd/rep/config"

"github.com/onsi/ginkgo"
"github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gexec"
)
Expand Down
2 changes: 1 addition & 1 deletion conversion_helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"code.cloudfoundry.org/executor"
"code.cloudfoundry.org/rep"
"code.cloudfoundry.org/routing-info/internalroutes"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)

Expand Down
2 changes: 1 addition & 1 deletion evacuation/cleanup.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"code.cloudfoundry.org/clock"
loggingclient "code.cloudfoundry.org/diego-logging-client"
"code.cloudfoundry.org/executor"
"code.cloudfoundry.org/lager"
"code.cloudfoundry.org/lager/v3"
)

const (
Expand Down
62 changes: 32 additions & 30 deletions evacuation/cleanup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ import (
mfakes "code.cloudfoundry.org/diego-logging-client/testhelpers"
"code.cloudfoundry.org/executor"
"code.cloudfoundry.org/executor/fakes"
"code.cloudfoundry.org/lager"
"code.cloudfoundry.org/lager/lagertest"
"code.cloudfoundry.org/lager/v3"
"code.cloudfoundry.org/lager/v3/lagertest"
"code.cloudfoundry.org/rep/evacuation"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gbytes"
"github.com/tedsuo/ifrit"
"github.com/tedsuo/ifrit/ginkgomon"
ginkgomon "github.com/tedsuo/ifrit/ginkgomon_v2"
)

var _ = Describe("EvacuationCleanup", func() {
Expand Down 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
4 changes: 1 addition & 3 deletions evacuation/evacuation.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

"code.cloudfoundry.org/clock"
"code.cloudfoundry.org/executor"
"code.cloudfoundry.org/lager"
"code.cloudfoundry.org/lager/v3"
"code.cloudfoundry.org/rep/evacuation/evacuation_context"
)

Expand Down 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
Loading