OLD | NEW |
1 // Copyright 2015 The LUCI Authors. All rights reserved. | 1 // Copyright 2015 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 dscache | 5 package dscache |
6 | 6 |
7 import ( | 7 import ( |
8 "bytes" | 8 "bytes" |
9 "encoding/binary" | 9 "encoding/binary" |
10 "errors" | 10 "errors" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 | 85 |
86 Convey("enabled cases", func() { | 86 Convey("enabled cases", func() { |
87 c = FilterRDS(c, shardsForKey) | 87 c = FilterRDS(c, shardsForKey) |
88 ds := datastore.Get(c) | 88 ds := datastore.Get(c) |
89 So(dsUnder, ShouldNotBeNil) | 89 So(dsUnder, ShouldNotBeNil) |
90 So(ds, ShouldNotBeNil) | 90 So(ds, ShouldNotBeNil) |
91 So(mc, ShouldNotBeNil) | 91 So(mc, ShouldNotBeNil) |
92 | 92 |
93 Convey("basically works", func() { | 93 Convey("basically works", func() { |
94 pm := datastore.PropertyMap{ | 94 pm := datastore.PropertyMap{ |
95 » » » » » "BigData": {datastore.MkProperty([]byte(
""))}, | 95 » » » » » "BigData": datastore.MkProperty([]byte("
")), |
96 » » » » » "Value": {datastore.MkProperty("hi")}, | 96 » » » » » "Value": datastore.MkProperty("hi"), |
97 } | 97 } |
98 encoded := append([]byte{0}, serialize.ToBytes(p
m)...) | 98 encoded := append([]byte{0}, serialize.ToBytes(p
m)...) |
99 | 99 |
100 o := object{ID: 1, Value: "hi"} | 100 o := object{ID: 1, Value: "hi"} |
101 So(ds.Put(&o), ShouldBeNil) | 101 So(ds.Put(&o), ShouldBeNil) |
102 | 102 |
103 o = object{ID: 1} | 103 o = object{ID: 1} |
104 So(dsUnder.Get(&o), ShouldBeNil) | 104 So(dsUnder.Get(&o), ShouldBeNil) |
105 So(o.Value, ShouldEqual, "hi") | 105 So(o.Value, ShouldEqual, "hi") |
106 | 106 |
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 InstanceEnabledStatic = false | 452 InstanceEnabledStatic = false |
453 defer func() { | 453 defer func() { |
454 InstanceEnabledStatic = true | 454 InstanceEnabledStatic = true |
455 }() | 455 }() |
456 | 456 |
457 c := context.Background() | 457 c := context.Background() |
458 newC := FilterRDS(c, nil) | 458 newC := FilterRDS(c, nil) |
459 So(newC, ShouldEqual, c) | 459 So(newC, ShouldEqual, c) |
460 }) | 460 }) |
461 } | 461 } |
OLD | NEW |