mirror of
https://github.com/hibiken/asynq.git
synced 2025-09-19 05:17:30 +08:00
Extract rdb to internal package
This commit is contained in:
@@ -1,13 +1,14 @@
|
||||
package asynq
|
||||
|
||||
import (
|
||||
"github.com/hibiken/asynq/internal/rdb"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestClient(t *testing.T) {
|
||||
r := setup(t)
|
||||
client := &Client{rdb: r}
|
||||
client := &Client{rdb.NewRDB(r)}
|
||||
|
||||
tests := []struct {
|
||||
task *Task
|
||||
@@ -31,7 +32,7 @@ func TestClient(t *testing.T) {
|
||||
|
||||
for _, tc := range tests {
|
||||
// clean up db before each test case.
|
||||
if err := r.client.FlushDB().Err(); err != nil {
|
||||
if err := r.FlushDB().Err(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
@@ -41,12 +42,12 @@ func TestClient(t *testing.T) {
|
||||
continue
|
||||
}
|
||||
|
||||
if l := r.client.LLen(defaultQueue).Val(); l != tc.wantQueueSize {
|
||||
t.Errorf("%q has length %d, want %d", defaultQueue, l, tc.wantQueueSize)
|
||||
if l := r.LLen(rdb.DefaultQueue).Val(); l != tc.wantQueueSize {
|
||||
t.Errorf("%q has length %d, want %d", rdb.DefaultQueue, l, tc.wantQueueSize)
|
||||
}
|
||||
|
||||
if l := r.client.ZCard(scheduled).Val(); l != tc.wantScheduledSize {
|
||||
t.Errorf("%q has length %d, want %d", scheduled, l, tc.wantScheduledSize)
|
||||
if l := r.ZCard(rdb.Scheduled).Val(); l != tc.wantScheduledSize {
|
||||
t.Errorf("%q has length %d, want %d", rdb.Scheduled, l, tc.wantScheduledSize)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user