From bf44f5df28d63891339761ac3d58d9aba23834eb Mon Sep 17 00:00:00 2001 From: "Dr. Stefan Schimanski" Date: Sat, 11 Jul 2015 11:07:14 +0200 Subject: [PATCH] Add DeclineOffer return value to mock driver in mesos scheduler test Depending on timing the mesos scheduler might call DeclineOffer: The default ttl of an offer in mesos scheduler is 5sec. If the tests run longer, the old, unused offers are declined, leading to an mock error. Probably fixes GoogleCloudPlatform/kubernetes#10795 --- contrib/mesos/pkg/scheduler/plugin_test.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/contrib/mesos/pkg/scheduler/plugin_test.go b/contrib/mesos/pkg/scheduler/plugin_test.go index 19ccf22c8ff..d6dc121d14e 100644 --- a/contrib/mesos/pkg/scheduler/plugin_test.go +++ b/contrib/mesos/pkg/scheduler/plugin_test.go @@ -440,6 +440,8 @@ func TestPlugin_LifeCycle(t *testing.T) { } mockDriver.On("LaunchTasks", mAny("[]*mesosproto.OfferID"), mAny("[]*mesosproto.TaskInfo"), mAny("*mesosproto.Filters")). Return(mesos.Status_DRIVER_RUNNING, nil).Run(launchTasksCalledFunc) + mockDriver.On("DeclineOffer", mAny("*mesosproto.OfferID"), mAny("*mesosproto.Filters")). + Return(mesos.Status_DRIVER_RUNNING, nil) // elect master with mock driver driverFactory := ha.DriverFactory(func() (bindings.SchedulerDriver, error) {