toMatchDisk_TODO throws error when writing multiple snapshots to disk during parameterized tests, succeeds on follow ups.
まだ誰も着手していません。
評価
調査の方向性
selfie-runner-junit5:2.0.1 を使用するパラメーター化された Kotlin reproducer から始め、Validator.kt:613 での失敗を調査します。snapshot ファイルが作成される最初の実行を、その後の実行および既存の _TODO の再利用と比較します。「Snapshot was set to multiple values!」エラーなしで複数の snapshot を書き込めるようになれば完了です。
索引モデルが issue の本文から書いたものです。
説明
I am using selfie-runner-junit5:2.0.1 to verify errors for each test case. I my parameters include a unique test case name to pass into toMatchDisk.
The summarized version:
@ParameterizedTest(name = "rejects invalid commands: {1}")
@MethodSource("modifyNodeItemsValidationCases")
fun `rejects invalid commands`(
cmd: Command,
testcaseName: String,
) = runTest {
val thrown = shouldThrow<TraitStandardResponseException> {
validate(cmd)
}
thrown.response.respCase shouldBe RespCase.RESPONSE_BAD_REQUEST
Selfie.expectSelfie(thrown.message.toString()).toMatchDisk(testcaseName)
}
When I run this test case, the snapshot file is successfully written:
╔═ rejects invalid commands/Child node not found ═╗
ModifyItem must have a valid item case to modify
╔═ rejects invalid commands/Empty modify item ═╗
ModifyItem must have a valid item case to modify
╔═ rejects invalid commands/Empty modify node item ═╗
ModifyNodeItemWithAddition must have either modifyItem, updateExistingTraits, modifyChildElectricalConnectionPoints, or upstreamElectricalConnectionPoint
╔═ rejects invalid commands/No UtilityMeterNode when trying to edit a utility meter node ═╗
No UtilityMeterNode item found for node id 1 in topology
╔═ rejects invalid commands/Node not found ═╗
Provided node id 1 not in topology
╔═ rejects invalid commands/empty modifyDownstreamElectricalConnectionPoint ═╗
ModifyItem must have a valid item case to modify
╔═ rejects invalid commands/empty simpleElectricalConnectionPoint ═╗
ModifyItem must have a valid item case to modify
╔═ [end of file] ═╗
But the first run fails with this error:
org.opentest4j.AssertionFailedError: Snapshot was set to multiple values!
first time: ValidatorTest$rejects invalid commands$1.invokeSuspend(Validator.kt:613)
this time: ValidatorTest$rejects invalid commands$1.invokeSuspend(Validator.kt:613)
Once the file is created things seem to work:
- Subsequent test runs pass
- If I modify one or more of the expected value and include
//selfieoncethe updates are made and tests pass - Add one or more new test case with
//selfieonce
I can produce the same errors again if the file exists if I ever reuse the _TODO.
- 主要言語
- Kotlin
- スター
- 101
- フォーク
- 18
- 平均マージ
- 6日 11時間
- マージ済み PR(30日)
- 5
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
diffplug/selfie のほかの issue
-
Selfie JVM Snapshot Garbage Collection is overly zealous when using multiple test suites in gradleオープンbug jvm
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
-
enhancement jvm
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
-
bug jvm
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
-
bug docs jvm
難易度 2/5 1〜3時間 初心者へのやさしさ 50/100
-
bug jvm py
難易度 2/5 1〜3時間 初心者へのやさしさ 48/100
diffplug/selfie の issue をすべて見る
似ている issue
-
contributor: external needs review
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
fwcd/tree-sitter-kotlin#289 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
navikt/syfo-oppfolgingsplan-backend#482 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
amir1376/ab-download-manager#1449 ·
メンテナーはふだん 1 日以内に返信