X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/01533060c76fde7a8a2c1e5c994bc5240390ff3e..refs/heads/20755-ec2-multiple-subnets:/lib/dispatchcloud/test/stub_driver.go diff --git a/lib/dispatchcloud/test/stub_driver.go b/lib/dispatchcloud/test/stub_driver.go index 037580f8d9..9bc1e4c8f7 100644 --- a/lib/dispatchcloud/test/stub_driver.go +++ b/lib/dispatchcloud/test/stub_driver.go @@ -46,7 +46,8 @@ type StubDriver struct { Queue *Queue // Frequency of artificially introduced errors on calls to - // Destroy. 0=always succeed, 1=always fail. + // Create and Destroy. 0=always succeed, 1=always fail. + ErrorRateCreate float64 ErrorRateDestroy float64 // If Create() or Instances() is called too frequently, return @@ -121,6 +122,9 @@ func (sis *StubInstanceSet) Create(it arvados.InstanceType, image cloud.ImageID, if sis.allowCreateCall.After(time.Now()) { return nil, RateLimitError{sis.allowCreateCall} } + if math_rand.Float64() < sis.driver.ErrorRateCreate { + return nil, fmt.Errorf("StubInstanceSet: rand < ErrorRateCreate %f", sis.driver.ErrorRateCreate) + } sis.allowCreateCall = time.Now().Add(sis.driver.MinTimeBetweenCreateCalls) ak := sis.driver.AuthorizedKeys if authKey != nil {