Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MySql Command is override on start #534

Closed
AlissonMedeiros opened this issue Dec 29, 2017 · 5 comments · Fixed by #767
Closed

MySql Command is override on start #534

AlissonMedeiros opened this issue Dec 29, 2017 · 5 comments · Fixed by #767

Comments

@AlissonMedeiros
Copy link

AlissonMedeiros commented Dec 29, 2017

When I start a new MySql container I set a diferent command, but this is override per the method "configure()"

My code:

(MySQLContainer) new MySQLContainer()
                .withDatabaseName("f"+timeStamp)
                .withUsername("f"+timeStamp)
                .withPassword("f"+timeStamp)
                .withCommand("mysqld", "--lower_case_table_names=1")
                .withLogConsumer(new Slf4jLogConsumer(logger));

The code of MYSQLContainer:

    @Override
    protected void configure() {
        optionallyMapResourceParameterAsVolume(MY_CNF_CONFIG_OVERRIDE_PARAM_NAME, "/etc/mysql/conf.d", "mysql-default-conf");

        addExposedPort(3306);
        addEnv("MYSQL_DATABASE", databaseName);
        addEnv("MYSQL_USER", username);
        addEnv("MYSQL_PASSWORD", password);
        addEnv("MYSQL_ROOT_PASSWORD", "test");
        setCommand("mysqld");
        setStartupAttempts(3);
    }

I need this to support case insentive. Do you know athoner way to do this? If not I can fix and open PR.

Another option is add lower_case_table_names=1" in the file my.cnf Or have
a way to add more configurations in the file.

Many thanks.

@bsideup
Copy link
Member

bsideup commented Jan 2, 2018

Hi @AlissonMedeiros,

That's a bug indeed. For now, you can override MySQLContainer's configure command and set your command there. PR is also highly appreciated (you can just move setCommand to constructor) :)

@AlissonMedeiros
Copy link
Author

@bsideup Thanks for help, I try to do this.

@pauldailly
Copy link
Contributor

pauldailly commented Jun 13, 2018

Hi there, would I be correct in saying the MariaDb test container module also suffers from this same issue?

If so, I'd be happy to start working on a PR similar to #560 if you would like me to?

One thing I am unsure of is the fact there's both a mariadb module in this project and a separate testcontainers-java-module-mariadb repository too. To which repo would I submit the PR?

@kiview
Copy link
Member

kiview commented Jun 22, 2018

@pauldailly
Yes, you are right. The correct module is the one in the main repository. We've moved all modules to the main repo at one point in time (mono repo). PR very much appreciated 🙂

pauldailly added a commit to pauldailly/testcontainers-java that referenced this issue Jun 30, 2018
This fixes testcontainers#534 for the MariaDB container, which was also affected.
@rnorth
Copy link
Member

rnorth commented Jul 12, 2018

Released in 1.8.1! 🎉

Thanks for flagging this, @AlissonMedeiros and @pauldailly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants