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

Question : taking advantage of docker caching while building MySqlContainter. #1713

Closed
bhchandra opened this issue Aug 6, 2019 · 4 comments
Labels

Comments

@bhchandra
Copy link

bhchandra commented Aug 6, 2019

Issue:
I am having a little difficulty in figuring out how to take advantage of docker-caching to improve the speed of using test-containers.

Here is my simple use-case. When executing a test which uses MySQLContainer provided by TestContainers:

  1. The container boots up and executes the init script init_mysql.sql every time for setting up database schema. This step can be cached.
MySQLContainer mySQLContainer = new MySQLContainer()
                .withDatabaseName("test_database")
                .withInitScript("mysql-container/init_mysql.sql")
                .withUsername("test")
                .withPassword("test")
                .start();
  1. After the init script is executed and the container is ready, a java.sql.connection is created to the database and some of the tables are populated with data. This step can also be cached, by somehow included it during the creation of docker image.

All of this takes more ~1m30sec to 2m for the container to be ready for testing.

Question:
How can above code/process be restructured so that it can advantage of docker-caching feature to enable faster testing time ?

@rnorth rnorth mentioned this issue Aug 26, 2019
2 tasks
@stale
Copy link

stale bot commented Nov 4, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you believe this is a mistake, please reply to this comment to keep it open. If there isn't one already, a PR to fix or at least reproduce the problem in a test case will always help us get back on track to tackle this.

@stale stale bot added the stale label Nov 4, 2019
@bhchandra
Copy link
Author

unstale

@stale stale bot removed the stale label Nov 6, 2019
@stale
Copy link

stale bot commented Feb 4, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you believe this is a mistake, please reply to this comment to keep it open. If there isn't one already, a PR to fix or at least reproduce the problem in a test case will always help us get back on track to tackle this.

@stale stale bot added the stale label Feb 4, 2020
@stale
Copy link

stale bot commented Feb 18, 2020

This issue has been automatically closed due to inactivity. We apologise if this is still an active problem for you, and would ask you to re-open the issue if this is the case.

@stale stale bot closed this as completed Feb 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant