| OLD | NEW |
| 1 // Copyright 2016 The LUCI Authors. All rights reserved. | 1 // Copyright 2016 The LUCI Authors. All rights reserved. |
| 2 // Use of this source code is governed under the Apache License, Version 2.0 | 2 // Use of this source code is governed under the Apache License, Version 2.0 |
| 3 // that can be found in the LICENSE file. | 3 // that can be found in the LICENSE file. |
| 4 | 4 |
| 5 package tsmon | 5 package tsmon |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "fmt" | 8 "fmt" |
| 9 "net/http" | 9 "net/http" |
| 10 "net/http/httptest" | 10 "net/http/httptest" |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 So(rec.Code, ShouldEqual, http.StatusOK) | 133 So(rec.Code, ShouldEqual, http.StatusOK) |
| 134 | 134 |
| 135 i, err := getOrCreateInstanceEntity(c) | 135 i, err := getOrCreateInstanceEntity(c) |
| 136 So(err, ShouldBeNil) | 136 So(err, ShouldBeNil) |
| 137 So(i.TaskNum, ShouldEqual, 1) | 137 So(i.TaskNum, ShouldEqual, 1) |
| 138 }) | 138 }) |
| 139 | 139 |
| 140 Convey("Expires old instances", t, func() { | 140 Convey("Expires old instances", t, func() { |
| 141 c, clock := buildGAETestContext() | 141 c, clock := buildGAETestContext() |
| 142 | 142 |
| 143 » » for _, count := range []int{1, housekeepingInstanceBatchSize + 1
} { | 143 » » for _, count := range []int{1, ds.Raw(c).Constraints().QueryBatc
hSize + 1} { |
| 144 Convey(fmt.Sprintf("Count: %d", count), func() { | 144 Convey(fmt.Sprintf("Count: %d", count), func() { |
| 145 insts := make([]*instance, count) | 145 insts := make([]*instance, count) |
| 146 keys := make([]*ds.Key, count) | 146 keys := make([]*ds.Key, count) |
| 147 for i := 0; i < count; i++ { | 147 for i := 0; i < count; i++ { |
| 148 insts[i] = &instance{ | 148 insts[i] = &instance{ |
| 149 ID: fmt.Sprintf("foobar
_%d", i), | 149 ID: fmt.Sprintf("foobar
_%d", i), |
| 150 TaskNum: i, | 150 TaskNum: i, |
| 151 LastUpdated: clock.Now(), | 151 LastUpdated: clock.Now(), |
| 152 } | 152 } |
| 153 keys[i] = ds.KeyForObj(c, insts[i]) | 153 keys[i] = ds.KeyForObj(c, insts[i]) |
| (...skipping 14 matching lines...) Expand all Loading... |
| 168 }) | 168 }) |
| 169 So(rec.Code, ShouldEqual, http.StatusOK) | 169 So(rec.Code, ShouldEqual, http.StatusOK) |
| 170 | 170 |
| 171 exists, err = ds.Exists(c, keys) | 171 exists, err = ds.Exists(c, keys) |
| 172 So(err, ShouldBeNil) | 172 So(err, ShouldBeNil) |
| 173 So(exists.Any(), ShouldBeFalse) | 173 So(exists.Any(), ShouldBeFalse) |
| 174 }) | 174 }) |
| 175 } | 175 } |
| 176 }) | 176 }) |
| 177 } | 177 } |
| OLD | NEW |