You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Enable MYSQL_CODESPACES environment variable in the devcontainer
This commit addresses the following error because it creates database
as a root user without a password. In the devcontainer, the root
password is set to `root` in the `docker-compose.yaml` file.
https://github.com/rails/rails/blob/78de0fae2289e47738441549aa80451875a8b4bc/.devcontainer/compose.yaml#L37-L38
```yaml
environment:
MARIADB_ROOT_PASSWORD: root
```
- Error addressed by this commit:
```
$ cd railties
$ bin/test test/application/test_runner_test.rb -n test_parallel_testing_when_schema_is_not_up_to_date
Run options: -n test_parallel_testing_when_schema_is_not_up_to_date --seed 56426
E
Error:
ApplicationTests::TestRunnerTest#test_parallel_testing_when_schema_is_not_up_to_date:
RuntimeError: rails command failed (1): bin/rails db:create 2>&1
/home/vscode/.rbenv/versions/3.4.2/lib/ruby/gems/3.4.0/gems/rake-13.2.1/lib/rake/application.rb:717: warning: conflicting chdir during another chdir block
/workspaces/rails/railties/test/application/test_runner_test.rb:828: note: previous chdir was here
/home/vscode/.rbenv/versions/3.4.2/lib/ruby/gems/3.4.0/gems/rake-13.2.1/lib/rake/application.rb:738: warning: conflicting chdir during another chdir block
/workspaces/rails/railties/test/application/test_runner_test.rb:828: note: previous chdir was here
There is an issue connecting to your database with your username/password, username: root.
Please check your database configuration to ensure the username/password are valid.
Couldn't create 'railties_5059_development' database. Please check your configuration.
bin/rails aborted!
ActiveRecord::DatabaseConnectionError: There is an issue connecting to your database with your username/password, username: root. (ActiveRecord::DatabaseConnectionError)
Please check your database configuration to ensure the username/password are valid.
/workspaces/rails/tmp/d20250305-5059-hve3ds/app/bin/rails:4:in '<top (required)>'
Caused by:
Mysql2::Error::ConnectionError: Access denied for user 'root'@'172.18.0.6' (using password: NO) (Mysql2::Error::ConnectionError)
/workspaces/rails/tmp/d20250305-5059-hve3ds/app/bin/rails:4:in '<top (required)>'
Tasks: TOP => db:create
(See full trace by running task with --trace)
test/isolation/abstract_unit.rb:420:in 'TestHelpers::Generation#rails'
test/application/test_runner_test.rb:834:in 'block in ApplicationTests::TestRunnerTest#test_parallel_testing_when_schema_is_not_up_to_date'
test/application/test_runner_test.rb:828:in 'Dir.chdir'
test/application/test_runner_test.rb:828:in 'ApplicationTests::TestRunnerTest#test_parallel_testing_when_schema_is_not_up_to_date'
bin/test test/application/test_runner_test.rb:826
Finished in 4.847434s, 0.2063 runs/s, 0.0000 assertions/s.
1 runs, 0 assertions, 0 failures, 1 errors, 0 skips
$
```
No need to set MYSQL_CODESPACES explicitly in the boot.sh script
that allows users to run `exec rake db:mysql:rebuild` in the devcontainer
without setting MYSQL_CODESPACES in the command line.
0 commit comments