Best Testcontainers-java code snippet using org.testcontainers.containers.MariaDBContainer.configure
Source:DatabaseContainers.java
...56 MariaDb5Container() {57 super("mariadb:5.5.61");58 }59 @Override60 protected void configure() {61 super.configure();62 setCommand("mysqld", "--character-set-server=utf8mb4",63 "--collation-server=utf8mb4_unicode_ci", "--innodb_large_prefix",64 "--innodb_file_format=barracuda", "--innodb-file-per-table");65 }66 }67 private static class MariaDb10Container extends MariaDBContainer<MariaDb10Container> {68 MariaDb10Container() {69 super("mariadb:10.3.10");70 }71 @Override72 protected void configure() {73 super.configure();74 setCommand("mysqld", "--character-set-server=utf8mb4",75 "--collation-server=utf8mb4_unicode_ci");76 }77 }78 private static class MySql5Container extends MySQLContainer<MySql5Container> {79 MySql5Container() {80 super("mysql:5.7.23");81 }82 @Override83 protected void configure() {84 super.configure();85 setCommand("mysqld", "--character-set-server=utf8mb4",86 "--collation-server=utf8mb4_unicode_ci");87 }88 @Override89 public String getDriverClassName() {90 return "com.mysql.cj.jdbc.Driver";91 }92 }93 private static class MySql8Container extends MySQLContainer<MySql8Container> {94 MySql8Container() {95 super("mysql:8.0.12");96 }97 @Override98 protected void configure() {99 super.configure();100 setCommand("mysqld", "--default-authentication-plugin=mysql_native_password");101 }102 @Override103 public String getDriverClassName() {104 return "com.mysql.cj.jdbc.Driver";105 }106 }107 private static class PostgreSql9Container108 extends PostgreSQLContainer<PostgreSql9Container> {109 PostgreSql9Container() {110 super("postgres:9.6.10");111 }112 }113 private static class PostgreSql10Container114 extends PostgreSQLContainer<PostgreSql10Container> {115 PostgreSql10Container() {116 super("postgres:10.5");117 }118 }119 private static class SqlServer2017Container120 extends MSSQLServerContainer<SqlServer2017Container> {121 SqlServer2017Container() {122 super("microsoft/mssql-server-linux:2017-CU11");123 }124 @Override125 protected void configure() {126 super.configure();127 withStartupTimeoutSeconds(240);128 withConnectTimeoutSeconds(240);129 }130 }131}...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!