OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package memory | 5 package memory |
6 | 6 |
7 import ( | 7 import ( |
8 "fmt" | 8 "fmt" |
9 "math/rand" | 9 "math/rand" |
10 "net/http" | 10 "net/http" |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 Convey("No other features are available, however", func(
) { | 363 Convey("No other features are available, however", func(
) { |
364 So(dsS.Get(c).RunInTransaction(func(c context.Co
ntext) error { | 364 So(dsS.Get(c).RunInTransaction(func(c context.Co
ntext) error { |
365 So(tqS.Get(c).Delete(t, "").Error(), Sho
uldContainSubstring, "cannot DeleteMulti from a transaction") | 365 So(tqS.Get(c).Delete(t, "").Error(), Sho
uldContainSubstring, "cannot DeleteMulti from a transaction") |
366 So(tqS.Get(c).Purge("").Error(), ShouldC
ontainSubstring, "cannot Purge from a transaction") | 366 So(tqS.Get(c).Purge("").Error(), ShouldC
ontainSubstring, "cannot Purge from a transaction") |
367 _, err := tqS.Get(c).Stats("") | 367 _, err := tqS.Get(c).Stats("") |
368 So(err.Error(), ShouldContainSubstring,
"cannot Stats from a transaction") | 368 So(err.Error(), ShouldContainSubstring,
"cannot Stats from a transaction") |
369 return nil | 369 return nil |
370 }, nil), ShouldBeNil) | 370 }, nil), ShouldBeNil) |
371 }) | 371 }) |
372 | 372 |
| 373 Convey("can get the non-transactional taskqueue context
though", func() { |
| 374 So(dsS.Get(c).RunInTransaction(func(c context.Co
ntext) error { |
| 375 So(tqS.GetNoTxn(c).Delete(t, ""), Should
BeNil) |
| 376 So(tqS.GetNoTxn(c).Purge(""), ShouldBeNi
l) |
| 377 _, err := tqS.GetNoTxn(c).Stats("") |
| 378 So(err, ShouldBeNil) |
| 379 return nil |
| 380 }, nil), ShouldBeNil) |
| 381 }) |
| 382 |
373 Convey("adding a new task only happens if we don't errou
t", func() { | 383 Convey("adding a new task only happens if we don't errou
t", func() { |
374 So(dsS.Get(c).RunInTransaction(func(c context.Co
ntext) error { | 384 So(dsS.Get(c).RunInTransaction(func(c context.Co
ntext) error { |
375 t3 := tq.NewTask("/sandwitch/victory") | 385 t3 := tq.NewTask("/sandwitch/victory") |
376 So(tqS.Get(c).Add(t3, ""), ShouldBeNil) | 386 So(tqS.Get(c).Add(t3, ""), ShouldBeNil) |
377 return fmt.Errorf("nooooo") | 387 return fmt.Errorf("nooooo") |
378 }, nil), ShouldErrLike, "nooooo") | 388 }, nil), ShouldErrLike, "nooooo") |
379 | 389 |
380 So(tqt.GetScheduledTasks()["default"][t.Name], S
houldResemble, t) | 390 So(tqt.GetScheduledTasks()["default"][t.Name], S
houldResemble, t) |
381 So(tqt.GetTombstonedTasks()["default"][t2.Name],
ShouldResemble, t2) | 391 So(tqt.GetTombstonedTasks()["default"][t2.Name],
ShouldResemble, t2) |
382 So(tqt.GetTransactionTasks()["default"], ShouldB
eNil) | 392 So(tqt.GetTransactionTasks()["default"], ShouldB
eNil) |
(...skipping 12 matching lines...) Expand all Loading... |
395 }() | 405 }() |
396 | 406 |
397 So(tqt.GetScheduledTasks()["default"][t.Name], S
houldResemble, t) | 407 So(tqt.GetScheduledTasks()["default"][t.Name], S
houldResemble, t) |
398 So(tqt.GetTombstonedTasks()["default"][t2.Name],
ShouldResemble, t2) | 408 So(tqt.GetTombstonedTasks()["default"][t2.Name],
ShouldResemble, t2) |
399 So(tqt.GetTransactionTasks()["default"], ShouldB
eNil) | 409 So(tqt.GetTransactionTasks()["default"], ShouldB
eNil) |
400 }) | 410 }) |
401 | 411 |
402 }) | 412 }) |
403 }) | 413 }) |
404 } | 414 } |
OLD | NEW |