Skip to content

Commit 748f005

Browse files
Ariel Shtulgkorland
authored andcommitted
Auto ts coverage (#50)
* auto TS coverage
1 parent f16f9bb commit 748f005

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

client_test.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,18 @@ func TestAdd(t *testing.T) {
148148
assert.Equal(t, now, storedTimestamp)
149149
info, _ := client.Info(key)
150150
assert.Equal(t, now, info.LastTimestamp)
151+
152+
// Test with auto timestamp
153+
storedTimestamp1, _ := client.AddAutoTs(key, PI)
154+
time.Sleep(1 * time.Millisecond)
155+
storedTimestamp2, _ := client.AddAutoTs(key, PI)
156+
assert.True(t, storedTimestamp1 < storedTimestamp2)
157+
158+
// Test with auto timestamp with options
159+
storedTimestamp1, _ = client.AddAutoTsWithOptions(key, PI, CreateOptions{RetentionMSecs: defaultDuration})
160+
time.Sleep(1 * time.Millisecond)
161+
storedTimestamp2, _ = client.AddAutoTsWithOptions(key, PI, CreateOptions{RetentionMSecs: defaultDuration})
162+
assert.True(t, storedTimestamp1 < storedTimestamp2)
151163
}
152164

153165
func TestAddWithRetention(t *testing.T) {

0 commit comments

Comments
 (0)