@@ -592,6 +592,7 @@ func TestRunEnvVars(t *testing.T) {
592
592
"-e" , "MYSQL_DATABASE=mytestdb" ,
593
593
"-e" , "MYSQL_USER" ,
594
594
"-e" , "MYSQL_PASSWORD=userpwd" ,
595
+ "-e" , "DATASOURCE_URL=jdbc:mysql://mydb.mysql.database.azure.com/db1?useSSL=true&requireSSL=false&serverTimezone=America/Recife" ,
595
596
"mysql:5.7" ,
596
597
)
597
598
cmd .Env = append (cmd .Env , "MYSQL_USER=user1" )
@@ -604,7 +605,16 @@ func TestRunEnvVars(t *testing.T) {
604
605
605
606
containerInspect , err := ParseContainerInspect (res .Stdout ())
606
607
assert .NilError (t , err )
608
+ assert .Assert (t , containerInspect .Config != nil , "nil container config" )
609
+ assert .Assert (t , containerInspect .Config .Env != nil , "nil container env variables" )
607
610
assert .Equal (t , containerInspect .Image , "mysql:5.7" )
611
+ envVars := containerInspect .Config .Env
612
+ assert .Equal (t , len (envVars ), 5 )
613
+ assert .Equal (t , envVars ["MYSQL_ROOT_PASSWORD" ], "rootpwd" )
614
+ assert .Equal (t , envVars ["MYSQL_DATABASE" ], "mytestdb" )
615
+ assert .Equal (t , envVars ["MYSQL_USER" ], "user1" )
616
+ assert .Equal (t , envVars ["MYSQL_PASSWORD" ], "userpwd" )
617
+ assert .Equal (t , envVars ["DATASOURCE_URL" ], "jdbc:mysql://mydb.mysql.database.azure.com/db1?useSSL=true&requireSSL=false&serverTimezone=America/Recife" )
608
618
609
619
check := func (t poll.LogT ) poll.Result {
610
620
res := c .RunDockerOrExitError ("logs" , container )
0 commit comments