20888: Applies suggested improvements.
[arvados.git] / lib / dispatchcloud / dispatcher_test.go
index 273a3836dc4f8f65a82a0ef40c2d8b6d0bfab162..a981d83a26c8aae993660413b97f088ec3fdb9b8 100644 (file)
@@ -49,8 +49,10 @@ func (s *DispatcherSuite) SetUpTest(c *check.C) {
        s.stubDriver = &test.StubDriver{
                HostKey:                   hostpriv,
                AuthorizedKeys:            []ssh.PublicKey{dispatchpub},
+               ErrorRateCreate:           0.1,
                ErrorRateDestroy:          0.1,
                MinTimeBetweenCreateCalls: time.Millisecond,
+               QuotaMaxInstances:         10,
        }
 
        // We need the postgresql connection info from the integration
@@ -69,6 +71,7 @@ func (s *DispatcherSuite) SetUpTest(c *check.C) {
                        DispatchPrivateKey:     string(dispatchprivraw),
                        StaleLockTimeout:       arvados.Duration(5 * time.Millisecond),
                        RuntimeEngine:          "stub",
+                       MaxDispatchAttempts:    10,
                        CloudVMs: arvados.CloudVMsConfig{
                                Driver:               "test",
                                SyncInterval:         arvados.Duration(10 * time.Millisecond),
@@ -77,6 +80,7 @@ func (s *DispatcherSuite) SetUpTest(c *check.C) {
                                TimeoutProbe:         arvados.Duration(15 * time.Millisecond),
                                TimeoutShutdown:      arvados.Duration(5 * time.Millisecond),
                                MaxCloudOpsPerSecond: 500,
+                               InitialQuotaEstimate: 8,
                                PollInterval:         arvados.Duration(5 * time.Millisecond),
                                ProbeInterval:        arvados.Duration(5 * time.Millisecond),
                                MaxProbesPerSecond:   1000,
@@ -234,9 +238,9 @@ func (s *DispatcherSuite) TestDispatchToStubDriver(c *check.C) {
                select {
                case <-done:
                        // loop will end because len(waiting)==0
-               case <-time.After(3 * time.Second):
+               case <-time.After(5 * time.Second):
                        if len(waiting) >= waswaiting {
-                               c.Fatalf("timed out; no progress in 3s while waiting for %d containers: %q", len(waiting), waiting)
+                               c.Fatalf("timed out; no progress in s while waiting for %d containers: %q", len(waiting), waiting)
                        }
                }
        }
@@ -364,6 +368,7 @@ func (s *DispatcherSuite) TestInstancesAPI(c *check.C) {
        sr := getInstances()
        c.Check(len(sr.Items), check.Equals, 0)
 
+       s.stubDriver.ErrorRateCreate = 0
        ch := s.disp.pool.Subscribe()
        defer s.disp.pool.Unsubscribe(ch)
        ok := s.disp.pool.Create(test.InstanceType(1))