Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 25 additions & 2 deletions docker-env-full/scripts/start-indexing.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ param(
Category = 4
CustomerOrder = 20
PickupLocation = 34
}
},
# Document types whose count gate should be skipped (reindex still runs).
# Use when the dataset legitimately has 0 source records for a type — e.g.
# -skipDocCountVerification PickupLocation,ContentFile
[string[]]$skipDocCountVerification = @()
)

$ErrorActionPreference = 'Stop'
Expand Down Expand Up @@ -197,6 +201,15 @@ function Wait-AllIndexedCountsReady {
throw "Index counts did not satisfy minimum expectations within ${timeoutSeconds}s: $lastReason"
}

# Fail loud on typos before the (~15min) reindex loop: a value in
# -skipDocCountVerification that doesn't match a key in -minDocCounts would
# silently no-op, and the user would only notice 15min later when the count
# gate they thought they'd bypassed times out.
$unknownSkips = @($skipDocCountVerification | Where-Object { $_ -and ($minDocCounts.Keys -notcontains $_) })
if ($unknownSkips.Count -gt 0) {
throw "skipDocCountVerification contains unknown document type(s): $($unknownSkips -join ', '). Valid types: $(($minDocCounts.Keys | Sort-Object) -join ', ')."
}

$token = Get-AdminToken

# Reindex one document type at a time. See Start-ReindexDocumentType for the rationale —
Expand All @@ -212,6 +225,16 @@ foreach ($docType in $script:reindexDocumentTypes) {
}

Write-IndexCounts -token $token
Wait-AllIndexedCountsReady -token $token -minDocCounts $minDocCounts

$effectiveMinDocCounts = @{}
foreach ($key in $minDocCounts.Keys) {
if ($skipDocCountVerification -notcontains $key) {
$effectiveMinDocCounts[$key] = $minDocCounts[$key]
}
}
if ($skipDocCountVerification.Count -gt 0) {
Write-Host "Skipping count verification for: $($skipDocCountVerification -join ', ')"
}
Wait-AllIndexedCountsReady -token $token -minDocCounts $effectiveMinDocCounts

Write-Output "Indexing complete and verified — safe to start tests."
16 changes: 15 additions & 1 deletion run-e2e-tests/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ inputs:
description: 'UI tests repository branch'
required: true
type: string
skipDocCountVerification:
description: 'Comma-separated document types whose post-reindex count check should be skipped (reindex still runs). Use when the seed dataset has 0 records for a type. Example: ''PickupLocation'' or ''PickupLocation,ContentFile''.'
required: false
default: ''
type: string
runs:
using: "composite"
steps:
Expand Down Expand Up @@ -99,7 +104,16 @@ runs:
}
python -m dataset.dataset_manager --seed
wget https://raw.githubusercontent.com/VirtoCommerce/vc-github-actions/refs/heads/master/docker-env-full/scripts/start-indexing.ps1
./start-indexing.ps1 -platformUrl http://localhost:8090 -adminUsername admin -adminPassword $adminPassword
$startArgs = @{
platformUrl = 'http://localhost:8090'
adminUsername = 'admin'
adminPassword = $adminPassword
}
$skipRaw = '${{ inputs.skipDocCountVerification }}'
if ($skipRaw) {
$startArgs.skipDocCountVerification = $skipRaw -split ',' | ForEach-Object { $_.Trim() } | Where-Object { $_ }
}
./start-indexing.ps1 @startArgs

- name: Upload dataset_manager log
if: always()
Expand Down
16 changes: 15 additions & 1 deletion run-graphql-tests/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ inputs:
description: 'UI tests repository branch'
required: true
type: string
skipDocCountVerification:
description: 'Comma-separated document types whose post-reindex count check should be skipped (reindex still runs). Use when the seed dataset has 0 records for a type. Example: ''PickupLocation'' or ''PickupLocation,ContentFile''.'
required: false
default: ''
type: string
runs:
using: "composite"
steps:
Expand Down Expand Up @@ -99,7 +104,16 @@ runs:
}
python -m dataset.dataset_manager --seed
wget https://raw.githubusercontent.com/VirtoCommerce/vc-github-actions/refs/heads/master/docker-env-full/scripts/start-indexing.ps1
./start-indexing.ps1 -platformUrl http://localhost:8090 -adminUsername admin -adminPassword $adminPassword
$startArgs = @{
platformUrl = 'http://localhost:8090'
adminUsername = 'admin'
adminPassword = $adminPassword
}
$skipRaw = '${{ inputs.skipDocCountVerification }}'
if ($skipRaw) {
$startArgs.skipDocCountVerification = $skipRaw -split ',' | ForEach-Object { $_.Trim() } | Where-Object { $_ }
}
./start-indexing.ps1 @startArgs

- name: Upload dataset_manager log
if: always()
Expand Down
16 changes: 15 additions & 1 deletion run-pytest-tests/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ inputs:
required: false
default: ''
type: string
skipDocCountVerification:
description: 'Comma-separated document types whose post-reindex count check should be skipped (reindex still runs). Use when the seed dataset has 0 records for a type. Example: ''PickupLocation'' or ''PickupLocation,ContentFile''.'
required: false
default: ''
type: string
testSecretEnvFile:
description: 'Test secret environment file content'
required: true
Expand Down Expand Up @@ -134,7 +139,16 @@ runs:
Write-Host "::group::Seed dataset"
python -m dataset.dataset_manager --seed --mode ci
Write-Host "::endgroup::"
& "${{ github.action_path }}/../docker-env-full/scripts/start-indexing.ps1" -platformUrl "${{ inputs.backUrl }}" -adminUsername "${{ inputs.adminUsername }}" -adminPassword $env:ADMIN_PASSWORD
$startArgs = @{
platformUrl = '${{ inputs.backUrl }}'
adminUsername = '${{ inputs.adminUsername }}'
adminPassword = $env:ADMIN_PASSWORD
}
$skipRaw = '${{ inputs.skipDocCountVerification }}'
if ($skipRaw) {
$startArgs.skipDocCountVerification = $skipRaw -split ',' | ForEach-Object { $_.Trim() } | Where-Object { $_ }
}
& "${{ github.action_path }}/../docker-env-full/scripts/start-indexing.ps1" @startArgs

- name: Run GraphQL tests
shell: bash
Expand Down