Skip to content

Commit

Permalink
結合テストのDB接続確認。(MySQL)
Browse files Browse the repository at this point in the history
  • Loading branch information
Fumika Koyama committed Nov 6, 2023
1 parent 9622a9d commit d15d0fd
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/samples-dressca-backend.ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ jobs:
echo '# Build Result :gear:' >> $GITHUB_STEP_SUMMARY
cat build-result.txt | sed -n -e 's/^/> /p' >> $GITHUB_STEP_SUMMARY
- name: 結合テスト用 PostgreSQL のセットアップ
- name: 結合テスト用 MySQL のセットアップ
shell: bash
run: |
sudo systemctl start postgresql.service
sudo bash -c "echo \"local all all md5\" >> /etc/postgresql/14/main/pg_hba.conf"
sudo su postgres -c "psql postgres -c \"alter role postgres with login password 'postgres';\""
sudo su postgres -c "psql postgres -c 'create database dressca_eshop;'"
sudo systemctl start mysql.service
sudo mysql -u root -p
root
create database dressca_eshop;
- id: run-tests
name: テストの実行
Expand Down
1 change: 1 addition & 0 deletions samples/Dressca/dressca-backend/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<PackageVersion Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="6.0.22" />
<PackageVersion Include="NSwag.AspNetCore" Version="13.19.0" />
<PackageVersion Include="NSwag.MSBuild" Version="13.19.0" />
<PackageVersion Include="Pomelo.EntityFrameworkCore.MySql" Version="6.0.2" />
<PackageVersion Include="StyleCop.Analyzers" Version="1.2.0-beta.435" />
<PackageVersion Include="xunit" Version="2.5.0" />
<PackageVersion Include="xunit.abstractions" Version="2.0.3" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ protected override void ConfigureWebHost(IWebHostBuilder builder)

services.AddDbContext<DresscaDbContext>( options =>
{
options.UseNpgsql("Host=localhost;Database=dressca_eshop;Username=postgres;Password=postgres");
options.UseMySql("server=localhost;user=root;password=root;database=dressca_eshop;",new MySqlServerVersion(new Version(8,0,34)));
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" />
<PackageReference Include="xunit" />
<PackageReference Include="xunit.runner.visualstudio">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down

0 comments on commit d15d0fd

Please sign in to comment.