@@ -30,35 +30,35 @@ func TestDumpCmd(t *testing.T) {
3030 }{
3131 // invalid ones
3232 {"missing server and target options" , []string {"" }, "" , true , core.DumpOptions {}, core.TimerOptions {}, nil },
33- {"invalid target URL" , []string {"--server" , "abc" , "--target" , "def" }, "" , true , core.DumpOptions {DBConn : database.Connection {Host : "abc" }}, core.TimerOptions {}, nil },
33+ {"invalid target URL" , []string {"--server" , "abc" , "--target" , "def" }, "" , true , core.DumpOptions {DBConn : & database.Connection {Host : "abc" }}, core.TimerOptions {}, nil },
3434
3535 // file URL
3636 {"file URL" , []string {"--server" , "abc" , "--target" , "file:///foo/bar" }, "" , false , core.DumpOptions {
3737 Targets : []storage.Storage {file .New (* fileTargetURL )},
3838 MaxAllowedPacket : defaultMaxAllowedPacket ,
3939 Compressor : & compression.GzipCompressor {},
40- DBConn : database.Connection {Host : "abc" , Port : defaultPort },
40+ DBConn : & database.Connection {Host : "abc" , Port : defaultPort },
4141 FilenamePattern : "db_backup_{{ .now }}.{{ .compression }}" ,
4242 }, core.TimerOptions {Frequency : defaultFrequency , Begin : defaultBegin }, nil },
4343 {"file URL with pass-file" , []string {"--server" , "abc" , "--target" , "file:///foo/bar" , "--pass-file" , "testdata/password.txt" }, "" , false , core.DumpOptions {
4444 Targets : []storage.Storage {file .New (* fileTargetURL )},
4545 MaxAllowedPacket : defaultMaxAllowedPacket ,
4646 Compressor : & compression.GzipCompressor {},
47- DBConn : database.Connection {Host : "abc" , Port : defaultPort , Pass : "testpassword" },
47+ DBConn : & database.Connection {Host : "abc" , Port : defaultPort , Pass : "testpassword" },
4848 FilenamePattern : "db_backup_{{ .now }}.{{ .compression }}" ,
4949 }, core.TimerOptions {Frequency : defaultFrequency , Begin : defaultBegin }, nil },
5050 {"file URL with pass and pass-file (pass takes precedence)" , []string {"--server" , "abc" , "--target" , "file:///foo/bar" , "--pass" , "explicitpass" , "--pass-file" , "testdata/password.txt" }, "" , false , core.DumpOptions {
5151 Targets : []storage.Storage {file .New (* fileTargetURL )},
5252 MaxAllowedPacket : defaultMaxAllowedPacket ,
5353 Compressor : & compression.GzipCompressor {},
54- DBConn : database.Connection {Host : "abc" , Port : defaultPort , Pass : "explicitpass" },
54+ DBConn : & database.Connection {Host : "abc" , Port : defaultPort , Pass : "explicitpass" },
5555 FilenamePattern : "db_backup_{{ .now }}.{{ .compression }}" ,
5656 }, core.TimerOptions {Frequency : defaultFrequency , Begin : defaultBegin }, nil },
5757 {"file URL with prune" , []string {"--server" , "abc" , "--target" , "file:///foo/bar" , "--retention" , "1h" }, "" , false , core.DumpOptions {
5858 Targets : []storage.Storage {file .New (* fileTargetURL )},
5959 MaxAllowedPacket : defaultMaxAllowedPacket ,
6060 Compressor : & compression.GzipCompressor {},
61- DBConn : database.Connection {Host : "abc" , Port : defaultPort },
61+ DBConn : & database.Connection {Host : "abc" , Port : defaultPort },
6262 FilenamePattern : "db_backup_{{ .now }}.{{ .compression }}" ,
6363 }, core.TimerOptions {Frequency : defaultFrequency , Begin : defaultBegin }, & core.PruneOptions {Targets : []storage.Storage {file .New (* fileTargetURL )}, Retention : "1h" }},
6464
@@ -67,14 +67,14 @@ func TestDumpCmd(t *testing.T) {
6767 Targets : []storage.Storage {file .New (* fileTargetURL )},
6868 MaxAllowedPacket : defaultMaxAllowedPacket ,
6969 Compressor : & compression.GzipCompressor {},
70- DBConn : database.Connection {Host : "abc" , Port : defaultPort },
70+ DBConn : & database.Connection {Host : "abc" , Port : defaultPort },
7171 FilenamePattern : "db_backup_{{ .now }}.{{ .compression }}" ,
7272 }, core.TimerOptions {Frequency : defaultFrequency , Begin : defaultBegin }, nil },
7373 {"database explicit name with explicit port" , []string {"--server" , "abc" , "--port" , "3307" , "--target" , "file:///foo/bar" }, "" , false , core.DumpOptions {
7474 Targets : []storage.Storage {file .New (* fileTargetURL )},
7575 MaxAllowedPacket : defaultMaxAllowedPacket ,
7676 Compressor : & compression.GzipCompressor {},
77- DBConn : database.Connection {Host : "abc" , Port : 3307 },
77+ DBConn : & database.Connection {Host : "abc" , Port : 3307 },
7878 FilenamePattern : "db_backup_{{ .now }}.{{ .compression }}" ,
7979 }, core.TimerOptions {Frequency : defaultFrequency , Begin : defaultBegin }, nil },
8080
@@ -83,21 +83,21 @@ func TestDumpCmd(t *testing.T) {
8383 Targets : []storage.Storage {file .New (* fileTargetURL )},
8484 MaxAllowedPacket : defaultMaxAllowedPacket ,
8585 Compressor : & compression.GzipCompressor {},
86- DBConn : database.Connection {Host : "abcd" , Port : 3306 , User : "user2" , Pass : "xxxx2" },
86+ DBConn : & database.Connection {Host : "abcd" , Port : 3306 , User : "user2" , Pass : "xxxx2" },
8787 FilenamePattern : "db_backup_{{ .now }}.{{ .compression }}" ,
8888 }, core.TimerOptions {Frequency : defaultFrequency , Begin : defaultBegin }, & core.PruneOptions {Targets : []storage.Storage {file .New (* fileTargetURL )}, Retention : "1h" }},
8989 {"config file with port override" , []string {"--config-file" , "testdata/config.yml" , "--port" , "3307" }, "" , false , core.DumpOptions {
9090 Targets : []storage.Storage {file .New (* fileTargetURL )},
9191 MaxAllowedPacket : defaultMaxAllowedPacket ,
9292 Compressor : & compression.GzipCompressor {},
93- DBConn : database.Connection {Host : "abcd" , Port : 3307 , User : "user2" , Pass : "xxxx2" },
93+ DBConn : & database.Connection {Host : "abcd" , Port : 3307 , User : "user2" , Pass : "xxxx2" },
9494 FilenamePattern : "db_backup_{{ .now }}.{{ .compression }}" ,
9595 }, core.TimerOptions {Frequency : defaultFrequency , Begin : defaultBegin }, & core.PruneOptions {Targets : []storage.Storage {file .New (* fileTargetURL )}, Retention : "1h" }},
9696 {"config file with filename pattern override" , []string {"--config-file" , "testdata/pattern.yml" , "--port" , "3307" }, "" , false , core.DumpOptions {
9797 Targets : []storage.Storage {file .New (* fileTargetURL )},
9898 MaxAllowedPacket : defaultMaxAllowedPacket ,
9999 Compressor : & compression.GzipCompressor {},
100- DBConn : database.Connection {Host : "abcd" , Port : 3307 , User : "user2" , Pass : "xxxx2" },
100+ DBConn : & database.Connection {Host : "abcd" , Port : 3307 , User : "user2" , Pass : "xxxx2" },
101101 FilenamePattern : "foo_{{ .now }}.{{ .compression }}" ,
102102 }, core.TimerOptions {Frequency : defaultFrequency , Begin : defaultBegin }, & core.PruneOptions {Targets : []storage.Storage {file .New (* fileTargetURL )}, Retention : "1h" }},
103103
@@ -106,60 +106,60 @@ func TestDumpCmd(t *testing.T) {
106106 Targets : []storage.Storage {file .New (* fileTargetURL )},
107107 MaxAllowedPacket : defaultMaxAllowedPacket ,
108108 Compressor : & compression.GzipCompressor {},
109- DBConn : database.Connection {Host : "abc" , Port : defaultPort },
109+ DBConn : & database.Connection {Host : "abc" , Port : defaultPort },
110110 FilenamePattern : "db_backup_{{ .now }}.{{ .compression }}" ,
111111 }, core.TimerOptions {Once : true , Frequency : defaultFrequency , Begin : defaultBegin }, nil },
112112 {"cron flag" , []string {"--server" , "abc" , "--target" , "file:///foo/bar" , "--cron" , "0 0 * * *" }, "" , false , core.DumpOptions {
113113 Targets : []storage.Storage {file .New (* fileTargetURL )},
114114 MaxAllowedPacket : defaultMaxAllowedPacket ,
115115 Compressor : & compression.GzipCompressor {},
116- DBConn : database.Connection {Host : "abc" , Port : defaultPort },
116+ DBConn : & database.Connection {Host : "abc" , Port : defaultPort },
117117 FilenamePattern : "db_backup_{{ .now }}.{{ .compression }}" ,
118118 }, core.TimerOptions {Frequency : defaultFrequency , Begin : defaultBegin , Cron : "0 0 * * *" }, nil },
119119 {"begin flag" , []string {"--server" , "abc" , "--target" , "file:///foo/bar" , "--begin" , "1234" }, "" , false , core.DumpOptions {
120120 Targets : []storage.Storage {file .New (* fileTargetURL )},
121121 MaxAllowedPacket : defaultMaxAllowedPacket ,
122122 Compressor : & compression.GzipCompressor {},
123- DBConn : database.Connection {Host : "abc" , Port : defaultPort },
123+ DBConn : & database.Connection {Host : "abc" , Port : defaultPort },
124124 FilenamePattern : "db_backup_{{ .now }}.{{ .compression }}" ,
125125 }, core.TimerOptions {Frequency : defaultFrequency , Begin : "1234" }, nil },
126126 {"frequency flag" , []string {"--server" , "abc" , "--target" , "file:///foo/bar" , "--frequency" , "10" }, "" , false , core.DumpOptions {
127127 Targets : []storage.Storage {file .New (* fileTargetURL )},
128128 MaxAllowedPacket : defaultMaxAllowedPacket ,
129129 Compressor : & compression.GzipCompressor {},
130- DBConn : database.Connection {Host : "abc" , Port : defaultPort },
130+ DBConn : & database.Connection {Host : "abc" , Port : defaultPort },
131131 FilenamePattern : "db_backup_{{ .now }}.{{ .compression }}" ,
132132 }, core.TimerOptions {Frequency : 10 , Begin : defaultBegin }, nil },
133133 {"incompatible flags: once/cron" , []string {"--server" , "abc" , "--target" , "file:///foo/bar" , "--once" , "--cron" , "0 0 * * *" }, "" , true , core.DumpOptions {}, core.TimerOptions {}, nil },
134134 {"incompatible flags: once/begin" , []string {"--server" , "abc" , "--target" , "file:///foo/bar" , "--once" , "--begin" , "1234" }, "" , true , core.DumpOptions {}, core.TimerOptions {}, nil },
135135 {"incompatible flags: once/frequency" , []string {"--server" , "abc" , "--target" , "file:///foo/bar" , "--once" , "--frequency" , "10" }, "" , true , core.DumpOptions {}, core.TimerOptions {}, nil },
136136 {"incompatible flags: cron/begin" , []string {"--server" , "abc" , "--target" , "file:///foo/bar" , "--cron" , "0 0 * * *" , "--begin" , "1234" }, "" , true , core.DumpOptions {}, core.TimerOptions {}, nil },
137137 {"incompatible flags: cron/frequency" , []string {"--server" , "abc" , "--target" , "file:///foo/bar" , "--cron" , "0 0 * * *" , "--frequency" , "10" }, "" , true , core.DumpOptions {
138- DBConn : database.Connection {Host : "abcd" , Port : 3306 , User : "user2" , Pass : "xxxx2" },
138+ DBConn : & database.Connection {Host : "abcd" , Port : 3306 , User : "user2" , Pass : "xxxx2" },
139139 }, core.TimerOptions {Frequency : defaultFrequency , Begin : defaultBegin }, & core.PruneOptions {Targets : []storage.Storage {file .New (* fileTargetURL )}, Retention : "1h" }},
140140
141141 // pre- and post-backup scripts
142142 {"prebackup scripts" , []string {"--server" , "abc" , "--target" , "file:///foo/bar" , "--pre-backup-scripts" , "/prebackup" }, "" , false , core.DumpOptions {
143143 Targets : []storage.Storage {file .New (* fileTargetURL )},
144144 MaxAllowedPacket : defaultMaxAllowedPacket ,
145145 Compressor : & compression.GzipCompressor {},
146- DBConn : database.Connection {Host : "abc" , Port : defaultPort },
146+ DBConn : & database.Connection {Host : "abc" , Port : defaultPort },
147147 PreBackupScripts : "/prebackup" ,
148148 FilenamePattern : "db_backup_{{ .now }}.{{ .compression }}" ,
149149 }, core.TimerOptions {Frequency : defaultFrequency , Begin : defaultBegin }, nil },
150150 {"postbackup scripts" , []string {"--server" , "abc" , "--target" , "file:///foo/bar" , "--post-backup-scripts" , "/postbackup" }, "" , false , core.DumpOptions {
151151 Targets : []storage.Storage {file .New (* fileTargetURL )},
152152 MaxAllowedPacket : defaultMaxAllowedPacket ,
153153 Compressor : & compression.GzipCompressor {},
154- DBConn : database.Connection {Host : "abc" , Port : defaultPort },
154+ DBConn : & database.Connection {Host : "abc" , Port : defaultPort },
155155 PostBackupScripts : "/postbackup" ,
156156 FilenamePattern : "db_backup_{{ .now }}.{{ .compression }}" ,
157157 }, core.TimerOptions {Frequency : defaultFrequency , Begin : defaultBegin }, nil },
158158 {"prebackup and postbackup scripts" , []string {"--server" , "abc" , "--target" , "file:///foo/bar" , "--post-backup-scripts" , "/postbackup" , "--pre-backup-scripts" , "/prebackup" }, "" , false , core.DumpOptions {
159159 Targets : []storage.Storage {file .New (* fileTargetURL )},
160160 MaxAllowedPacket : defaultMaxAllowedPacket ,
161161 Compressor : & compression.GzipCompressor {},
162- DBConn : database.Connection {Host : "abc" , Port : defaultPort },
162+ DBConn : & database.Connection {Host : "abc" , Port : defaultPort },
163163 PreBackupScripts : "/prebackup" ,
164164 PostBackupScripts : "/postbackup" ,
165165 FilenamePattern : "db_backup_{{ .now }}.{{ .compression }}" ,
0 commit comments