File tree Expand file tree Collapse file tree 3 files changed +44
-0
lines changed Expand file tree Collapse file tree 3 files changed +44
-0
lines changed Original file line number Diff line number Diff line change 11
11
[ " $status " -eq 1 ]
12
12
}
13
13
14
+ @test " Pass when using a non-default db" {
15
+ run tests/select-db.sh
16
+ [ " $status " -eq 0 ]
17
+ }
18
+
14
19
# https://github.com/yannh/redis-dump-go/issues/11
15
20
# https://github.com/yannh/redis-dump-go/issues/18
16
21
@test " Pass when importing a ZSET with 1M entries" {
Original file line number Diff line number Diff line change
1
+ #! /bin/sh -e
2
+
3
+ export DB=2
4
+
5
+ echo " -> Filling Redis with Mock Data..."
6
+ redis-cli -h redis -n $DB FLUSHDB
7
+ /generator -output resp -type strings -n 100 | redis-cli -h redis -n $DB --pipe
8
+ DBSIZE=` redis-cli -h redis -n $DB dbsize`
9
+
10
+ echo " -> Dumping DB..."
11
+ time /redis-dump-go -host redis -n 250 -db $DB -output resp > backup
12
+
13
+ echo " -> Flushing DB and restoring dump..."
14
+ redis-cli -h redis -n $DB FLUSHDB
15
+ redis-cli -h redis -n $DB --pipe < backup
16
+ NEWDBSIZE=` redis-cli -h redis -n $DB dbsize`
17
+ echo " Redis has $DBSIZE entries"
18
+
19
+ echo " -> Comparing DB sizes..."
20
+ if [ $DBSIZE -ne $NEWDBSIZE ]; then
21
+ echo " ERROR - restored DB has $NEWDBSIZE elements, expected $DBSIZE "
22
+ exit 1
23
+ else
24
+ echo " OK - $NEWDBSIZE elements"
25
+ exit 0
26
+ fi
Original file line number Diff line number Diff line change @@ -23,6 +23,19 @@ func TestFromFlags(t *testing.T) {
23
23
Output : "resp" ,
24
24
},
25
25
},
26
+ {
27
+ []string {"-db" , "2" },
28
+ Config {
29
+ Db : 2 ,
30
+ Host : "127.0.0.1" ,
31
+ Port : 6379 ,
32
+ Filter : "*" ,
33
+ BatchSize : 1000 ,
34
+ NWorkers : 10 ,
35
+ WithTTL : true ,
36
+ Output : "resp" ,
37
+ },
38
+ },
26
39
{
27
40
[]string {"-ttl=false" },
28
41
Config {
You can’t perform that action at this time.
0 commit comments