@@ -31,6 +31,8 @@ func TestInit(t *testing.T) {
3131 sshPort string
3232 sshUser string
3333 sshPass string
34+ sshKeyFile string
35+ sshKeyPass string
3436 }
3537 var tests = []struct {
3638 name string
@@ -102,6 +104,26 @@ func TestInit(t *testing.T) {
102104 limit : 50 ,
103105 },
104106 },
107+ {
108+ name : "realistic example" ,
109+ input : "realistic-ssh-example" ,
110+ want : want {
111+ host : "rds-endpoint.region.rds.amazonaws.com" ,
112+ port : "5432" ,
113+ dbname : "database_name" ,
114+ user : "db_user" ,
115+ pass : "password" ,
116+ driver : "postgres" ,
117+ schema : "schema_name" ,
118+ ssl : "require" ,
119+ sshHost : "bastion.host.ip" ,
120+ sshPort : "22" ,
121+ sshUser : "ec2-user" ,
122+ sshKeyFile : "/path/to/ssh/key.pem" ,
123+ sshKeyPass : "hiuwiewnc092" ,
124+ limit : 50 ,
125+ },
126+ },
105127 {
106128 name : "oracle" ,
107129 input : "oracle" ,
@@ -139,6 +161,14 @@ func TestInit(t *testing.T) {
139161 assert .Equal (t , tt .want .sslkey , opts .SSLKey )
140162 assert .Equal (t , tt .want .sslpassword , opts .SSLPassword )
141163 assert .Equal (t , tt .want .sslrootcert , opts .SSLRootcert )
164+
165+ // SSH validations.
166+ assert .Equal (t , tt .want .sshHost , opts .SSHHost )
167+ assert .Equal (t , tt .want .sshPort , opts .SSHPort )
168+ assert .Equal (t , tt .want .sshUser , opts .SSHUser )
169+ assert .Equal (t , tt .want .sshPass , opts .SSHPass )
170+ assert .Equal (t , tt .want .sshPass , opts .SSHPass )
171+ assert .Equal (t , tt .want .sshKeyFile , opts .SSHKeyFile )
142172 })
143173 }
144174}
0 commit comments