@@ -34,12 +34,41 @@ func TestDumpCmd(t *testing.T) {
3434 Compressor : & compression.GzipCompressor {},
3535 DBConn : database.Connection {Host : "abc" },
3636 }, core.TimerOptions {Frequency : defaultFrequency , Begin : defaultBegin }},
37+ {"once flag" , []string {"--server" , "abc" , "--target" , "file:///foo/bar" , "--once" }, "" , false , core.DumpOptions {
38+ Targets : []storage.Storage {file .New (* fileTargetURL )},
39+ MaxAllowedPacket : defaultMaxAllowedPacket ,
40+ Compressor : & compression.GzipCompressor {},
41+ DBConn : database.Connection {Host : "abc" },
42+ }, core.TimerOptions {Frequency : defaultFrequency , Begin : defaultBegin , Once : true }},
43+ {"cron flag" , []string {"--server" , "abc" , "--target" , "file:///foo/bar" , "--cron" , "0 0 * * *" }, "" , false , core.DumpOptions {
44+ Targets : []storage.Storage {file .New (* fileTargetURL )},
45+ MaxAllowedPacket : defaultMaxAllowedPacket ,
46+ Compressor : & compression.GzipCompressor {},
47+ DBConn : database.Connection {Host : "abc" },
48+ }, core.TimerOptions {Frequency : defaultFrequency , Begin : defaultBegin , Cron : "0 0 * * *" }},
49+ {"begin flag" , []string {"--server" , "abc" , "--target" , "file:///foo/bar" , "--begin" , "1234" }, "" , false , core.DumpOptions {
50+ Targets : []storage.Storage {file .New (* fileTargetURL )},
51+ MaxAllowedPacket : defaultMaxAllowedPacket ,
52+ Compressor : & compression.GzipCompressor {},
53+ DBConn : database.Connection {Host : "abc" },
54+ }, core.TimerOptions {Frequency : defaultFrequency , Begin : "1234" }},
55+ {"frequency flag" , []string {"--server" , "abc" , "--target" , "file:///foo/bar" , "--frequency" , "10" }, "" , false , core.DumpOptions {
56+ Targets : []storage.Storage {file .New (* fileTargetURL )},
57+ MaxAllowedPacket : defaultMaxAllowedPacket ,
58+ Compressor : & compression.GzipCompressor {},
59+ DBConn : database.Connection {Host : "abc" },
60+ }, core.TimerOptions {Frequency : 10 , Begin : defaultBegin }},
3761 {"config file" , []string {"--config-file" , "testdata/config.yml" }, "" , false , core.DumpOptions {
3862 Targets : []storage.Storage {file .New (* fileTargetURL )},
3963 MaxAllowedPacket : defaultMaxAllowedPacket ,
4064 Compressor : & compression.GzipCompressor {},
4165 DBConn : database.Connection {Host : "abc" , Port : 3306 , User : "user" , Pass : "xxxx" },
4266 }, core.TimerOptions {Frequency : defaultFrequency , Begin : defaultBegin }},
67+ {"incompatible flags: once/cron" , []string {"--server" , "abc" , "--target" , "file:///foo/bar" , "--once" , "--cron" , "0 0 * * *" }, "" , true , core.DumpOptions {}, core.TimerOptions {}},
68+ {"incompatible flags: once/begin" , []string {"--server" , "abc" , "--target" , "file:///foo/bar" , "--once" , "--begin" , "1234" }, "" , true , core.DumpOptions {}, core.TimerOptions {}},
69+ {"incompatible flags: once/frequency" , []string {"--server" , "abc" , "--target" , "file:///foo/bar" , "--once" , "--frequency" , "10" }, "" , true , core.DumpOptions {}, core.TimerOptions {}},
70+ {"incompatible flags: cron/begin" , []string {"--server" , "abc" , "--target" , "file:///foo/bar" , "--cron" , "0 0 * * *" , "--begin" , "1234" }, "" , true , core.DumpOptions {}, core.TimerOptions {}},
71+ {"incompatible flags: cron/frequency" , []string {"--server" , "abc" , "--target" , "file:///foo/bar" , "--cron" , "0 0 * * *" , "--frequency" , "10" }, "" , true , core.DumpOptions {}, core.TimerOptions {}},
4372 }
4473
4574 for _ , tt := range tests {
0 commit comments