[Shopify] Fix test isolation in Shpfy Product Price Calc. Test (AB#642673)#9709
Open
onbuyuka wants to merge 1 commit into
Open
[Shopify] Fix test isolation in Shpfy Product Price Calc. Test (AB#642673)#9709onbuyuka wants to merge 1 commit into
onbuyuka wants to merge 1 commit into
Conversation
UnitTestCalcPriceUsesCurrentWorkDate used LibraryPriceCalculation.AddSetup, which does a plain Insert and fails when the "Price Calculation Setup" row [1-1-10]-7002 already exists. A sibling test in the same codeunit commits that row via CreateShop(), so the second test collided on the duplicate key and had to be disabled during the BCApps uptake. Switch to FindOrAddSetup (idempotent), matching the fix already applied to UnitTestCalcPriceTestNewPricing for AB#642193. Fixes AB#642673 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 04b7fe58-2158-4039-a77b-0011d9bed440
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
UnitTestCalcPriceUsesCurrentWorkDate(codeunit 139605 "Shpfy Product Price Calc. Test") was disabled during the BCApps uptake because it failed deterministically across all country buckets with:The test called
LibraryPriceCalculation.AddSetup, which does a plainInsertand throws on a duplicate key. A sibling test in the same codeunit (UnitTestCalcPriceTestNewPricing) inserts the samePrice Calculation Setuprow, andCreateShop()commits it — so when the second test ran it collided on the already-committed key.This swaps
AddSetup->FindOrAddSetup(idempotent find-or-insert), matching the fix already applied toUnitTestCalcPriceTestNewPricingfor AB#642193.Linked work
Fixes AB#642673
How I validated this
al_getdiagnostics(AL language server) reports 0 errors for the Shopify test project and the changed file.FindOrAddSetupcall inUnitTestCalcPriceTestNewPricing, which passes CI.Follow-up
The test is currently disabled NAV-side in
App/DisabledTests/ShpfyProductPriceCalcTest.DisabledTest.json(added via NAV PR 250996). Once this change is taken up, that entry must be removed to re-enable the test.