Closed git-no closed 3 years ago
If I am to look at anything, I always need the script with which the container was created and the full output of that and if possible a repro scenario.
The first attempt was
Import-TestToolkitToBcContainer container name -includeTestLibrariesOnly
Import-TestToolkitToBcContainer container name
Run-TestsInNavContainer -containerName containername -testSuite DEFAULT -credential $credential -companyName 'CRONUS (Schweiz) AG' -detailed
Run-TestsInNavContainer -containerName containername -testSuite DEFAULT -credential $credential -companyName 'CRONUS (Schweiz) AG' -detailed
-> show error about missing codeunitSecond attempt was recreating container
$containerName = 'dev'
$artifactUrl = Get-BcArtifactUrl -type 'OnPrem' -country 'ch' -version '17.2.19367.19735'
$licenseFile = '\\DevOps\Licences\fin17.flf'
$credential = New-Object System.Management.Automation.PSCredential ('su', (ConvertTo-SecureString 'su' -AsPlainText -Force)) # Get-Credential -Message 'Using User/Password authentication. Please enter credentials to use for the container.'
New-BcContainer -containerName $containerName -artifactUrl $artifactUrl -auth Userpassword -credential $credential -licenseFile $licenseFile -updateHosts -shortcuts DesktopFolder -accept_eula -assignPremiumPlan
Log:
Default parameter Isolation = Process
BcContainerHelper is version 1.0.19
BcContainerHelper is running as administrator
Host is Microsoft Windows 10 Enterprise - 20H2
Docker Client Version is 20.10.0
Docker Server Version is 20.10.0
Downloading application artifact /onprem/17.2.19367.19735/ch
Downloading C:\Users\l.nocinski\AppData\Local\Temp\8b09b278-4969-4581-b966-6c6e59639068.zip
Unpacking application artifact to tmp folder using 7zip
Downloading platform artifact /onprem/17.2.19367.19735/platform
Downloading C:\Users\l.nocinski\AppData\Local\Temp\9c88640c-ec84-484a-92e5-d1ecb30394d5.zip
Unpacking platform artifact to tmp folder using 7zip
Downloading Prerequisite Components
Downloading c:\bcartifacts.cache\onprem\17.2.19367.19735\platform\Prerequisite Components\DotNetCore\DotNetCore.1.0.4_1.1.1-WindowsHo
Downloading c:\bcartifacts.cache\onprem\17.2.19367.19735\platform\Prerequisite Components\Open XML SDK 2.5 for Microsoft Office\OpenX
Downloading c:\bcartifacts.cache\onprem\17.2.19367.19735\platform\Prerequisite Components\IIS URL Rewrite Module\rewrite_2.0_rtw_x64.
Fetching all docker images
Using image mcr.microsoft.com/dynamicsnav:10.0.19042.630-generic
Creating Container alph-dev
Version: 17.2.19367.19735-ch
Style: onprem
Multitenant: No
Platform: 17.0.19353.19730
Generic Tag: 0.1.0.24
Container OS Version: 10.0.19042.630 (20H2)
Host OS Version: 10.0.19042.630 (20H2)
Using Process isolation
Using locale de-CH
Disabling the standard eventlog dump to container log every 2 seconds (use -dumpEventLog to enable)
Using license file \\DevOps\Licences\fin17.flf
Files in C:\ProgramData\BcContainerHelper\Extensions\alph-dev\my:
- AdditionalOutput.ps1
- license.flf
- MainLoop.ps1
- SetupNavUsers.ps1
- SetupVariables.ps1
- updatehosts.ps1
Creating container alph-dev from image mcr.microsoft.com/dynamicsnav:10.0.19042.630-generic
1a29ef92b7f480a45f74a40387a4ca7851b08fe21ad6967378a335930467cfbc
Waiting for container alph-dev to be ready
Using artifactUrl https://bcartifacts.azureedge.net/onprem/17.2.19367.19735/ch
Using installer from C:\Run\150-new
Installing Business Central
Installing from artifacts
Starting Local SQL Server
Starting Internet Information Server
Copying Service Tier Files
Copying PowerShell Scripts
Copying dependencies
Copying ReportBuilder
Importing PowerShell Modules
Determining Database Collation from c:\dl\onprem\17.2.19367.19735\ch\database\Demo Database NAV (17-0).bak
Changing Database Server Collation to Latin1_General_100_CI_AS
Restoring CRONUS Demo Database
Modifying Business Central Service Tier Config File for Docker
Creating Business Central Service Tier
Installing SIP crypto provider: 'C:\Windows\System32\NavSip.dll'
Copying Web Client Files
Copying Client Files
Copying ModernDev Files
Copying additional files
Copying ConfigurationPackages
Copying Test Assemblies
Copying Applications
Starting Business Central Service Tier
Importing license file
Stopping Business Central Service Tier
Installation took 104 seconds
Installation complete
Initializing...
Setting host.docker.internal to 10.0.8.182 in container hosts file (copy from host hosts file)
Setting gateway.docker.internal to 10.0.8.182 in container hosts file (copy from host hosts file)
Setting kubernetes.docker.internal to 127.0.0.1 in container hosts file (copy from host hosts file)
Setting host.containerhelper.internal to 192.16.1.1 in container hosts file
Starting Container
Hostname is alph-dev
PublicDnsName is dev
Using NavUserPassword Authentication
Creating Self Signed Certificate
Self Signed Certificate Thumbprint 1BDEC2ACA3FA1DA8030E3D4D2F2B370255E8D877
Modifying Service Tier Config File with Instance Specific Settings
Starting Service Tier
Registering event sources
Creating DotNetCore Web Server Instance
Using license file 'c:\run\my\license.flf'
Import License
Creating http download site
Setting SA Password and enabling SA
Creating su as SQL User and add to sysadmin
Creating SUPER user
WARNING: The password that you entered does not meet the minimum requirements.
It should be at least 8 characters long and contain at least one uppercase
letter, one lowercase letter, and one number.
Assign Premium plan for SU
Container IP Address: 192.16.1.10
Container Hostname : dev
Container Dns Name : dev
Web Client : http://dev/BC/
Dev. Server : http://dev
Dev. ServerInstance : BC
Setting alph-dev to 192.16.1.10 in host hosts file
Files:
http://dev:8080/ALLanguage.vsix
Container Total Physical Memory is 31.8Gb
Container Free Physical Memory is 8.4Gb
Initialization took 60 seconds
Ready for connections!
Reading CustomSettings.config from alph-dev
Creating Desktop Shortcuts for alph-dev
Container alph-dev successfully created
Import-TestToolkitToBcContainer -containerName $containerName -credential $credential -includeTestLibrariesOnly
Run-TestsInNavContainer -containerName containername -testSuite DEFAULT -credential $credential -companyName 'CRONUS (Schweiz) AG' -detailed
-> shows no resultRun-TestsInNavContainer
, again no result.In the second attempt the command does not log anything, seems not to find the test settings. In the web browser there are two codeunit listed related to the test suite. Also I was able to successfully run the test within the browser.
First attempt was with BC 17.0, second attempt was with 17.2.
To the second attempt there are errors in the event log. This message appears right after a message "user successfully authenticated"
Server instance: BC Category: Security ClientSessionId: 00000000-0000-0000-0000-000000000000 ClientActivityId: e82e7408-b83a-435a-8056-c999b61c6e83 ServerSessionUniqueId: 787449da-954a-406a-90e3-2cf4436e214a ServerActivityId: 8a21311a-de49-4737-be58-950be58f4ecc EventTime: 01/07/2021 10:48:42 Message The Federation Service endpoint login failed because the following audience URI does not match an AppIdUri or wtrealm in server or application configuration. ProcessId: 769224 Tag: 00000ME ThreadId: 169 CounterInformation: CustomParameters: { } GatewayCorrelationId:
I suppose I found the potential reason of all these problems
By invoking Run-TestsInNavContainer
with -debugMode
it prints this
Run-Tests, open page 130455
Await State Ready (state is Busy)
Await State Ready (state is Busy)
Await State Ready (state is Busy)
Using repeater based test-runner
Offset: 0
Await State Ready (state is Busy)
Await State Ready (state is Busy)
Offset: 0
Index: 0, Offset: 0, Count: 2
Row - lineType = 1, run = Yes, CodeunitId = 0, codeunitName = '', name = ''
Found Row - index = 1, rowIndex = 0/2, lineType = 1, run = Yes, CodeunitId = 0, codeunitName = '', name = ''
Await State Ready (state is Busy)
It seems the Test command does use a different page 130455. I checked and did the setup in page 130401. Page 130455 does not show any entries.
401 is the C/AL test runner 455 is the AL test runner Recommendation is to specify extensionid to run-tests - then it executes all tests in that app
Got it. I have used an install codeunit as recommend on the Microsoft website. In your blog article "running-tests-in-containers-2" is also described the appID approach and that it is recommend for BC 15+. Sorry, bothering you. Thanks for your help. Case closed.
Yeah, the install codeunit was for before 15 (C/AL test runner) Should still work, and you can specify -testpageid to run-tests to run the C/AL test runner as well.
Describe the issue Run-TestsInNavContainer breaks with error:
Also it does not run the codeunits listed in page 130401.
It seems, the command does not use the current codeunits listed in the 130401.
SZENARIO
Scripts used to create container and cause the issue
Latest BCContainerHelper version used.
Additional context