File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed
Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -108,6 +108,38 @@ func TestDMap_Atomic_Decr(t *testing.T) {
108108 }
109109}
110110
111+ func TestDMap_Atomic_Honor_Current_TTL (t * testing.T ) {
112+ // See https://github.com/buraksezer/olric/pull/172
113+ cluster := testcluster .New (NewService )
114+ s := cluster .AddMember (nil ).(* Service )
115+ defer cluster .Shutdown ()
116+
117+ key := "decr"
118+
119+ dm , err := s .NewDMap ("atomic_test" )
120+ if err != nil {
121+ t .Fatalf ("Expected nil. Got: %v" , err )
122+ }
123+
124+ err = dm .PutEx (key , 10 , time .Hour )
125+ if err != nil {
126+ t .Fatalf ("Expected nil. Got: %v" , err )
127+ }
128+
129+ _ , err = dm .Decr (key , 1 )
130+ if err != nil {
131+ t .Fatalf ("Expected nil. Got: %v" , err )
132+ }
133+
134+ entry , err := dm .GetEntry (key )
135+ if err != nil {
136+ t .Fatalf ("Expected nil. Got: %v" , err )
137+ }
138+ if entry .TTL == 0 {
139+ t .Fatal ("entry.TTL cannot be zero" )
140+ }
141+ }
142+
111143func TestDMap_Atomic_GetPut (t * testing.T ) {
112144 cluster := testcluster .New (NewService )
113145 s := cluster .AddMember (nil ).(* Service )
You can’t perform that action at this time.
0 commit comments