diff --git a/Build/Scripts/ImportTestDataInBcContainer.ps1 b/Build/Scripts/ImportTestDataInBcContainer.ps1 new file mode 100644 index 0000000000..dc36bb46d0 --- /dev/null +++ b/Build/Scripts/ImportTestDataInBcContainer.ps1 @@ -0,0 +1,43 @@ +Param( + [Parameter(ParameterSetName="ALGo")] + [Hashtable]$parameters, + [Parameter(ParameterSetName="Manual")] + [string]$containerName +) + +function Get-NavDefaultCompanyName +{ + return "CRONUS International Ltd." +} + +if ($PSCmdlet.ParameterSetName -eq 'ALGo') { + $containerName = $parameters.ContainerName +} + +# Get the repoversion +Import-Module "$PSScriptRoot\EnlistmentHelperFunctions.psm1" + +$installedApps = Get-BcContainerAppInfo -containerName $parameters.ContainerName -tenantSpecificProperties -sort DependenciesLast +$appsToBeUnPublished = (Get-ConfigValue -ConfigType "BuildConfig" -Key "AppsNotToBePublished") +$installedApps | ForEach-Object { + if ($_.Name -in $appsToBeUnPublished) { + Write-Host "Unpublishing $($_.Name)" + Unpublish-BcContainerApp -containerName $parameters.ContainerName -name $_.Name -unInstall -doNotSaveData -doNotSaveSchema -force + } +} + +try { + $repoVersion = Get-ConfigValue -ConfigType "AL-GO" -Key "RepoVersion" + $DemoDataType = "EXTENDED" + + Write-Host "Initializing company" + Invoke-NavContainerCodeunit -Codeunitid 2 -containerName $containerName -CompanyName (Get-NavDefaultCompanyName) + + Write-Host "Importing configuration package" + Invoke-NavContainerCodeunit -Codeunitid 8620 -containerName $containerName -CompanyName (Get-NavDefaultCompanyName) -MethodName "ImportAndApplyRapidStartPackage" -Argument "C:\ConfigurationPackages\NAV$($repoVersion).W1.ENU.$($DemoDataType).rapidstart" +} catch { + Write-Host "Error while importing configuration package" + Write-Host $_.Exception.Message + Write-Host $_.Exception.StackTrace + exit 1 +} \ No newline at end of file diff --git a/Build/Scripts/RunTestsInBcContainer.ps1 b/Build/Scripts/RunTestsInBcContainer.ps1 index efd1bc6f5e..e884667630 100644 --- a/Build/Scripts/RunTestsInBcContainer.ps1 +++ b/Build/Scripts/RunTestsInBcContainer.ps1 @@ -38,13 +38,4 @@ if ($disabledTests) $parameters["disabledTests"] = $disabledTests } -$installedApps = Get-BcContainerAppInfo -containerName $parameters.ContainerName -tenantSpecificProperties -sort DependenciesLast -$appsToBeUnPublished = (Get-ConfigValue -ConfigType "BuildConfig" -Key "AppsNotToBePublished") -$installedApps | ForEach-Object { - if ($_.Name -in $appsToBeUnPublished) { - Write-Host "Unpublishing $($_.Name)" - Unpublish-BcContainerApp -containerName $parameters.ContainerName -name $_.Name -unInstall -doNotSaveData -doNotSaveSchema -force - } -} - Run-TestsInBcContainer @parameters \ No newline at end of file diff --git a/Build/projects/1st Party Apps Tests (W1)/.AL-Go/ImportTestDataInBcContainer.ps1 b/Build/projects/1st Party Apps Tests (W1)/.AL-Go/ImportTestDataInBcContainer.ps1 new file mode 100644 index 0000000000..4c5fa96d84 --- /dev/null +++ b/Build/projects/1st Party Apps Tests (W1)/.AL-Go/ImportTestDataInBcContainer.ps1 @@ -0,0 +1,6 @@ +Param( + [Hashtable]$parameters +) + +$script = Join-Path $PSScriptRoot "../../../scripts/ImportTestDataInBcContainer.ps1" -Resolve +. $script -parameters $parameters \ No newline at end of file