(t *testing.T)
| 80 | } |
| 81 | |
| 82 | func TestExpireStructure_PEXPIREAT(t *testing.T) { |
| 83 | expire, _ := initExpire() |
| 84 | defer expire.db.Close() |
| 85 | |
| 86 | key := "test_key" |
| 87 | timestamp := time.Now().Add(time.Second*2).Unix() * 1000 |
| 88 | |
| 89 | // Test PEXPIREAT function |
| 90 | expireErr = expire.PEXPIREAT(key, timestamp) |
| 91 | assert.Nil(t, expireErr) |
| 92 | |
| 93 | // Wait for the key to expire |
| 94 | time.Sleep(time.Second * 3) |
| 95 | |
| 96 | // Check if the key has expired |
| 97 | ttl, err := expire.TTL(key) |
| 98 | assert.Nil(t, err) |
| 99 | assert.Equal(t, int64(-2), ttl) // -2 indicates that the key does not exist |
| 100 | } |
| 101 | |
| 102 | func TestExpireStructure_TTL(t *testing.T) { |
| 103 | expire, _ := initExpire() |
nothing calls this directly
no test coverage detected