Skip to content

[Shopify] Fix test isolation in Shpfy Product Price Calc. Test (AB#642673)#9709

Open
onbuyuka wants to merge 1 commit into
mainfrom
bugs/642673-shpfy-price-calc-test-isolation
Open

[Shopify] Fix test isolation in Shpfy Product Price Calc. Test (AB#642673)#9709
onbuyuka wants to merge 1 commit into
mainfrom
bugs/642673-shpfy-price-calc-test-isolation

Conversation

@onbuyuka

@onbuyuka onbuyuka commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

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 record in table Price Calculation Setup already exists. Identification fields and values: Code='[1-1-10]-7002'

The test called LibraryPriceCalculation.AddSetup, which does a plain Insert and throws on a duplicate key. A sibling test in the same codeunit (UnitTestCalcPriceTestNewPricing) inserts the same Price Calculation Setup row, and CreateShop() 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 to UnitTestCalcPriceTestNewPricing for 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.
  • The change is identical in form to the already-merged FindOrAddSetup call in UnitTestCalcPriceTestNewPricing, 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.

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
@onbuyuka
onbuyuka requested a review from a team July 24, 2026 09:27
@github-actions github-actions Bot added the AL: Apps (W1) Add-on apps for W1 label Jul 24, 2026
@onbuyuka
onbuyuka enabled auto-merge July 24, 2026 09:28
@github-actions github-actions Bot added the Integration GitHub request for Integration area label Jul 24, 2026
@github-actions github-actions Bot added this to the Version 29.0 milestone Jul 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AL: Apps (W1) Add-on apps for W1 Integration GitHub request for Integration area

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant