This configuration refers to portfolio_db
when running the server normally, and refers to test_portfolio_db
during testing.
DATABASES = {
"default": {
"ENGINE": "django.db.backends.mysql",
"NAME": "portfolio_db",
"USER": "python",
"PASSWORD": "python123",
"HOST": "localhost",
"PORT": "3306",
"TEST": {"NAME": "test_portfolio_db"},
}
}
However, when I actually run it through CI, for some reason it refers to portfolio_db
. This is because githubactions assumes test_portfolio_db
.
Does anyone know why it refarences at portfolio_db
and how to properly run the test?
In addition, the test in the local environment passes
https://github.com/duri0214/portfolio/actions/runs/10016990263/job/27690629902?pr=42
before: https://github.com/duri0214/portfolio/actions/runs/10016990263/job/27690629902?pr=42
after: https://github.com/duri0214/portfolio/actions/runs/10019680997/job/27696499042
I had created test_portfolio_db
in advance, but it seems that migrate is not necessary in the first place. This is because test_portfolio_db is created in manage.py test.
In other words, the test passed after I removed the migrate command execution.