Skip to content
This repository has been archived by the owner on Apr 12, 2023. It is now read-only.

Fix an issue that migration failed when DateTime is DateTime.MinValue. #525

Merged

Conversation

keiji
Copy link
Collaborator

@keiji keiji commented Nov 27, 2021

Issue 番号 / Issue ID

目的 / Purpose

  • タイムゾーンが指定されていない文字列をJSTとして取り扱った上でUTCに変換する中で、変換対照がDateTime.MinValueと同値(e.g. 0001/01/01 00:00:00)であった場合に例外が発生してアプリが強制終了する不具合を修正する

破壊的変更をもたらしますか / Does this introduce a breaking change?

[ ] Yes
[x] No

Pull Request の種類 / Pull Request type

[x] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Documentation content changes
[ ] Other... Please describe:

検証方法 / How to test

コードの入手 / Get the code

git clone [repo-address]
cd [repo-name]
git checkout [branch-name]
dotnet restore

コードの検証 / Test the code

既存の処理との互換性はMigrationServiceTestsの中でカバーしている。
DateTimeがMinValueだったときのテストは #524 で追加する。

確認事項 / What to check

  • 使用開始日、規約への合意日ともにCOCOAのリリース日以前ではあり得ないので、それ以前であれば最小値としてリリース日に置き換える
  • タイムゾーン処理はTimeZoneInfo.ConvertTimeToUtcで行う
  • TimeZoneを取得するための名前がプラットフォームで異なるのは、TimeZoneConverterライブラリに任せる(テストが不要になったわけではない)

その他 / Other information

@keiji keiji added the bug バグ。本来あるべき動作をしていないもの label Nov 27, 2021
@keiji keiji self-assigned this Nov 27, 2021
@keiji keiji marked this pull request as ready for review November 27, 2021 11:17
@keiji keiji force-pushed the fix_convert_timezone_jst_to_utc branch from 4bf64ab to 3bba6d2 Compare November 28, 2021 14:36
@keiji
Copy link
Collaborator Author

keiji commented Nov 28, 2021

手元の環境ではテスト成功するのに、CIだと失敗する。
https://github.com/cocoa-mhlw/cocoa/runs/4345932325?check_suite_focus=true

[xUnit.net 00:00:10.79]     Covid19Radar.UnitTests.Services.Migration.MigrationServiceTests.Migrate_120to130Async [FAIL]
  Failed Covid19Radar.UnitTests.Services.Migration.MigrationServiceTests.Migrate_120to130Async [1 s]
  Error Message:
   Assert.Equal() Failure
Expected: 1638110566
Actual:   1638078166
  Stack Trace:
     at Covid19Radar.UnitTests.Services.Migration.MigrationServiceTests.Migrate_120to130Async() in /home/runner/work/cocoa/cocoa/Covid19Radar/Tests/Covid19Radar.UnitTests/Services/Migration/MigrationServiceTests.cs:line 974

ちょうど9時間ずれてるな……。

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug バグ。本来あるべき動作をしていないもの
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant