@@ -41,28 +41,28 @@ func TestMariaDB_DumpCommand(t *testing.T) {
4141 }{
4242 {
4343 "default" ,
44- args {& conftypes.Dump {Global : & conftypes.Global {Host : "1.1.1.1" , Database : "d" , Username : "u" }}},
45- command .NewBuilder (command .NewEnv ("MYSQL_PWD" , "" ), command .Raw (`"$(which mariadb-dump || which mysqldump)"` ), "--host=1.1.1.1" , "--user=u" , "d" , "--verbose" ),
44+ args {& conftypes.Dump {Global : & conftypes.Global {Host : "1.1.1.1" , Database : "d" , Username : "u" , Password : "p" }}},
45+ command .NewBuilder (command .NewEnv ("MYSQL_PWD" , "p " ), command .Raw (`"$(which mariadb-dump || which mysqldump)"` ), "--host=1.1.1.1" , "--user=u" , "d" , "--verbose" ),
4646 },
4747 {
4848 "clean" ,
49- args {& conftypes.Dump {Clean : true , Global : & conftypes.Global {Host : "1.1.1.1" , Database : "d" , Username : "u" }}},
50- command .NewBuilder (command .NewEnv ("MYSQL_PWD" , "" ), command .Raw (`"$(which mariadb-dump || which mysqldump)"` ), "--host=1.1.1.1" , "--user=u" , "d" , "--add-drop-table" , "--verbose" ),
49+ args {& conftypes.Dump {Clean : true , Global : & conftypes.Global {Host : "1.1.1.1" , Database : "d" , Username : "u" , Password : "p" }}},
50+ command .NewBuilder (command .NewEnv ("MYSQL_PWD" , "p " ), command .Raw (`"$(which mariadb-dump || which mysqldump)"` ), "--host=1.1.1.1" , "--user=u" , "d" , "--add-drop-table" , "--verbose" ),
5151 },
5252 {
5353 "tables" ,
54- args {& conftypes.Dump {Table : []string {"table1" , "table2" }, Global : & conftypes.Global {Host : "1.1.1.1" , Database : "d" , Username : "u" }}},
55- command .NewBuilder (command .NewEnv ("MYSQL_PWD" , "" ), command .Raw (`"$(which mariadb-dump || which mysqldump)"` ), "--host=1.1.1.1" , "--user=u" , "d" , "table1" , "table2" , "--verbose" ),
54+ args {& conftypes.Dump {Table : []string {"table1" , "table2" }, Global : & conftypes.Global {Host : "1.1.1.1" , Database : "d" , Username : "u" , Password : "p" }}},
55+ command .NewBuilder (command .NewEnv ("MYSQL_PWD" , "p " ), command .Raw (`"$(which mariadb-dump || which mysqldump)"` ), "--host=1.1.1.1" , "--user=u" , "d" , "table1" , "table2" , "--verbose" ),
5656 },
5757 {
5858 "exclude-table" ,
59- args {& conftypes.Dump {ExcludeTable : []string {"table1" , "table2" }, Global : & conftypes.Global {Host : "1.1.1.1" , Database : "d" , Username : "u" }}},
60- command .NewBuilder (command .NewEnv ("MYSQL_PWD" , "" ), command .Raw (`"$(which mariadb-dump || which mysqldump)"` ), "--host=1.1.1.1" , "--user=u" , "d" , "--ignore-table=table1" , "--ignore-table=table2" , "--verbose" ),
59+ args {& conftypes.Dump {ExcludeTable : []string {"table1" , "table2" }, Global : & conftypes.Global {Host : "1.1.1.1" , Database : "d" , Username : "u" , Password : "p" }}},
60+ command .NewBuilder (command .NewEnv ("MYSQL_PWD" , "p " ), command .Raw (`"$(which mariadb-dump || which mysqldump)"` ), "--host=1.1.1.1" , "--user=u" , "d" , "--ignore-table=table1" , "--ignore-table=table2" , "--verbose" ),
6161 },
6262 {
6363 "port" ,
6464 args {& conftypes.Dump {Global : & conftypes.Global {Port : 1234 }}},
65- command .NewBuilder (command .NewEnv ( "MYSQL_PWD" , "" ), command . Raw (`"$(which mariadb-dump || which mysqldump)"` ), "--host=" , "--user=" , "" , "--port=1234" , "--verbose" ),
65+ command .NewBuilder (command .Raw (`"$(which mariadb-dump || which mysqldump)"` ), "--host=" , "--user=" , "" , "--port=1234" , "--verbose" ),
6666 },
6767 }
6868 for _ , tt := range tests {
@@ -85,23 +85,23 @@ func TestMariaDB_ExecCommand(t *testing.T) {
8585 }{
8686 {
8787 "default" ,
88- args {& conftypes.Exec {Global : & conftypes.Global {Host : "1.1.1.1" , Database : "d" , Username : "u" }}},
89- command .NewBuilder (command.Env { Key : "MYSQL_PWD" } , "exec" , command .Raw (`"$(which mariadb || which mysql)"` ), "--host=1.1.1.1" , "--user=u" , "--database=d" ),
88+ args {& conftypes.Exec {Global : & conftypes.Global {Host : "1.1.1.1" , Database : "d" , Username : "u" , Password : "p" }}},
89+ command .NewBuilder (command .NewEnv ( "MYSQL_PWD" , "p" ) , "exec" , command .Raw (`"$(which mariadb || which mysql)"` ), "--host=1.1.1.1" , "--user=u" , "--database=d" ),
9090 },
9191 {
9292 "disable-headers" ,
93- args {& conftypes.Exec {DisableHeaders : true , Global : & conftypes.Global {Host : "1.1.1.1" , Database : "d" , Username : "u" }}},
94- command .NewBuilder (command.Env { Key : "MYSQL_PWD" } , "exec" , command .Raw (`"$(which mariadb || which mysql)"` ), "--host=1.1.1.1" , "--user=u" , "--database=d" , "--skip-column-names" ),
93+ args {& conftypes.Exec {DisableHeaders : true , Global : & conftypes.Global {Host : "1.1.1.1" , Database : "d" , Username : "u" , Password : "p" }}},
94+ command .NewBuilder (command .NewEnv ( "MYSQL_PWD" , "p" ) , "exec" , command .Raw (`"$(which mariadb || which mysql)"` ), "--host=1.1.1.1" , "--user=u" , "--database=d" , "--skip-column-names" ),
9595 },
9696 {
9797 "command" ,
98- args {& conftypes.Exec {Command : "show databases" , Global : & conftypes.Global {Host : "1.1.1.1" , Database : "d" , Username : "u" }}},
99- command .NewBuilder (command.Env { Key : "MYSQL_PWD" } , "exec" , command .Raw (`"$(which mariadb || which mysql)"` ), "--host=1.1.1.1" , "--user=u" , "--database=d" , "--execute=show databases" ),
98+ args {& conftypes.Exec {Command : "show databases" , Global : & conftypes.Global {Host : "1.1.1.1" , Database : "d" , Username : "u" , Password : "p" }}},
99+ command .NewBuilder (command .NewEnv ( "MYSQL_PWD" , "p" ) , "exec" , command .Raw (`"$(which mariadb || which mysql)"` ), "--host=1.1.1.1" , "--user=u" , "--database=d" , "--execute=show databases" ),
100100 },
101101 {
102102 "port" ,
103103 args {& conftypes.Exec {Global : & conftypes.Global {Port : 1234 }}},
104- command .NewBuilder (command . NewEnv ( "MYSQL_PWD" , "" ), "exec" , command .Raw (`"$(which mariadb || which mysql)"` ), "--host=" , "--user=" , "--port=1234" ),
104+ command .NewBuilder ("exec" , command .Raw (`"$(which mariadb || which mysql)"` ), "--host=" , "--user=" , "--port=1234" ),
105105 },
106106 }
107107 for _ , tt := range tests {
@@ -162,23 +162,23 @@ func TestMariaDB_RestoreCommand(t *testing.T) {
162162 }{
163163 {
164164 "gzip" ,
165- args {& conftypes.Restore {Global : & conftypes.Global {Host : "1.1.1.1" , Database : "d" , Username : "u" }}, sqlformat .Gzip },
166- command .NewBuilder (command.Env { Key : "MYSQL_PWD" } , command .Raw (`"$(which mariadb || which mysql)"` ), "--host=1.1.1.1" , "--user=u" , "--database=d" ),
165+ args {& conftypes.Restore {Global : & conftypes.Global {Host : "1.1.1.1" , Database : "d" , Username : "u" , Password : "p" }}, sqlformat .Gzip },
166+ command .NewBuilder (command .NewEnv ( "MYSQL_PWD" , "p" ) , command .Raw (`"$(which mariadb || which mysql)"` ), "--host=1.1.1.1" , "--user=u" , "--database=d" ),
167167 },
168168 {
169169 "plain" ,
170- args {& conftypes.Restore {Global : & conftypes.Global {Host : "1.1.1.1" , Database : "d" , Username : "u" }}, sqlformat .Plain },
171- command .NewBuilder (command.Env { Key : "MYSQL_PWD" } , command .Raw (`"$(which mariadb || which mysql)"` ), "--host=1.1.1.1" , "--user=u" , "--database=d" ),
170+ args {& conftypes.Restore {Global : & conftypes.Global {Host : "1.1.1.1" , Database : "d" , Username : "u" , Password : "p" }}, sqlformat .Plain },
171+ command .NewBuilder (command .NewEnv ( "MYSQL_PWD" , "p" ) , command .Raw (`"$(which mariadb || which mysql)"` ), "--host=1.1.1.1" , "--user=u" , "--database=d" ),
172172 },
173173 {
174174 "custom" ,
175- args {& conftypes.Restore {Global : & conftypes.Global {Host : "1.1.1.1" , Database : "d" , Username : "u" }}, sqlformat .Custom },
176- command .NewBuilder (command.Env { Key : "MYSQL_PWD" } , command .Raw (`"$(which mariadb || which mysql)"` ), "--host=1.1.1.1" , "--user=u" , "--database=d" ),
175+ args {& conftypes.Restore {Global : & conftypes.Global {Host : "1.1.1.1" , Database : "d" , Username : "u" , Password : "p" }}, sqlformat .Custom },
176+ command .NewBuilder (command .NewEnv ( "MYSQL_PWD" , "p" ) , command .Raw (`"$(which mariadb || which mysql)"` ), "--host=1.1.1.1" , "--user=u" , "--database=d" ),
177177 },
178178 {
179179 "port" ,
180180 args {& conftypes.Restore {Global : & conftypes.Global {Port : 1234 }}, sqlformat .Plain },
181- command .NewBuilder (command .NewEnv ( "MYSQL_PWD" , "" ), command . Raw (`"$(which mariadb || which mysql)"` ), "--host=" , "--user=" , "--database=" , "--port=1234" ),
181+ command .NewBuilder (command .Raw (`"$(which mariadb || which mysql)"` ), "--host=" , "--user=" , "--database=" , "--port=1234" ),
182182 },
183183 }
184184 for _ , tt := range tests {
0 commit comments