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 add isRoot parameter to executeQuery #882

Merged

Conversation

jeengbe
Copy link
Contributor

@jeengbe jeengbe commented Dec 11, 2024

It's convenient to be able to perform root operations directly on the container. The parameter is optional and defaults to the current behaviour, so it's no breaking change.

Copy link

netlify bot commented Dec 11, 2024

Deploy Preview for testcontainers-node ready!

Name Link
🔨 Latest commit 69b6827
🔍 Latest deploy log https://app.netlify.com/sites/testcontainers-node/deploys/67824a3bf2c6b90008608c75
😎 Deploy Preview https://deploy-preview-882--testcontainers-node.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@jeengbe jeengbe marked this pull request as ready for review December 11, 2024 15:21
const queryResult = await container.executeQuery("SELECT 1 as res");
expect(queryResult).toEqual(expect.stringContaining("res\n1\n"));

// Test root user
const rootQueryResult = await container.executeQuery("SELECT CURRENT_USER() as user");
Copy link
Collaborator

@cristianrgreco cristianrgreco Jan 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does this test test the new isRoot parameter? Also please add a separate test

Copy link
Contributor Author

@jeengbe jeengbe Jan 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here we go, fixed. I apologise for the incomplete PR, I don't know what happened.

I kept the "test non-root and root in the same test" approach as is done in the "should work with database URI" test

@cristianrgreco cristianrgreco added enhancement New feature or request minor Backward compatible functionality labels Jan 8, 2025
@jeengbe jeengbe force-pushed the je-mysql-execute-query-root branch from da1a560 to b8118db Compare January 8, 2025 12:01
@cristianrgreco
Copy link
Collaborator

@jeengbe The new test is failing, could you take a look?

@jeengbe
Copy link
Contributor Author

jeengbe commented Jan 11, 2025

It's weird that this test is failing; this implies that SELECT CURRENT_USER() returns customUsername@% for the user, but root@localhost for root. On my machine, both return @%, and I don't see why they wouldn't. Perhaps some difference in the environment, the mysql version being run, or something. Nonetheless, the host is not the essence of this test, so I have just removed it from the assertion.

@cristianrgreco cristianrgreco changed the title feat(mysql): add isRoot parameter to executeQuery MySQL add isRoot parameter to executeQuery Jan 11, 2025
@cristianrgreco cristianrgreco merged commit fa6edeb into testcontainers:main Jan 11, 2025
167 checks passed
@jeengbe jeengbe deleted the je-mysql-execute-query-root branch January 11, 2025 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request minor Backward compatible functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants