Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to run tests on cloud sandbox #3246

Open
AmandaTest opened this issue Nov 23, 2023 · 5 comments
Open

Unable to run tests on cloud sandbox #3246

AmandaTest opened this issue Nov 23, 2023 · 5 comments
Assignees

Comments

@AmandaTest
Copy link

I am trying to run tests against my cloud sandbox.

I am able to publish the tests to the saas environment with the refreshToken but not run the tests from the devops pipeline. I can only run them manually from inside the environment. BC Run tests in container is not working for me.

I created a filesonly proxy container, connect to my saas environment via resfreshtoken and then run this

Write-Host "Running My Tests ..."
Run-TestsInBCContainer -containerName $containerName
-bcAuthContext $authcontext -environment $environment
-detailed -XUnitResultFileName $xunitResultsFile
-AppendToXUnitResultFile:(!$first) `
-extensionId $testappid

This is my error BC version 22.5
2023-11-20T22:04:55.7431757Z environment not ready, status is DoesNotExist
2023-11-20T22:04:55.7432162Z At C:\Program Files\WindowsPowerShell\Modules\BcContainerHelper\6.0.0\AppHandling\Run-TestsInNavContainer.ps1:143
2023-11-20T22:04:55.7432419Z char:13
2023-11-20T22:04:55.7432625Z + throw "environment not ready, status is $($response.statu ...
2023-11-20T22:04:55.7433688Z + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2023-11-20T22:04:55.7434248Z + CategoryInfo : OperationStopped: (environment not...is DoesNotExist:String) [], RuntimeException
2023-11-20T22:04:55.7435393Z + FullyQualifiedErrorId : environment not ready, status is DoesNotExist
2023-11-20T22:04:55.7435910Z
2023-11-20T22:04:55.8482151Z ##[error]PowerShell exited with code '1'.

Full output of scripts

NavContainerHelper is version 0.6.5.7
NavContainerHelper is running as administrator
Host is Microsoft Windows 10 Enterprise - 2004
Docker Client Version is 19.03.8
Docker Server Version is 19.03.8
...

Screenshots

I am able to publish the tests to a saas environment but not run the tests from the devops pipeline. I can only run them manually from inside the environment. BC Run tests in container is not working for me. What command are you using to accomplish this?

I created a filesonly proxy container, connect to my saas environment via resfreshtoken and then run this

Write-Host "Running My Tests ..."
Run-TestsInBCContainer -containerName $containerName
-bcAuthContext $authcontext -environment $environment
-detailed -XUnitResultFileName $xunitResultsFile
-AppendToXUnitResultFile:(!$first) `
-extensionId $testappid

**** Here is the log file

2023-11-21T13:37:50.4695860Z ##[section]Starting: Run Tests on Cloud
2023-11-21T13:37:50.4804580Z ==============================================================================
2023-11-21T13:37:50.4804725Z Task : PowerShell
2023-11-21T13:37:50.4804784Z Description : Run a PowerShell script on Linux, macOS, or Windows
2023-11-21T13:37:50.4804884Z Version : 2.231.0
2023-11-21T13:37:50.4804942Z Author : Microsoft Corporation
2023-11-21T13:37:50.4805038Z Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/powershell
2023-11-21T13:37:50.4805141Z ==============================================================================
2023-11-21T13:37:51.6789563Z Generating script.
2023-11-21T13:37:51.7450741Z Formatted command: . 'C:\Agent_work\6\s\Cloud Tests\Tests-Platform.ps1'
2023-11-21T13:37:51.7806552Z ========================== Starting Command Output ===========================
2023-11-21T13:37:51.8011862Z ##[command]"C:\windows\System32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command ". 'C:\Agent_work_temp\1e906ade-fe9e-4140-83a6-6f4037cfce3c.ps1'"
2023-11-21T13:37:52.9679920Z BcContainerHelper version 6.0.0
2023-11-21T13:37:52.9680199Z BC.HelperFunctions emits usage statistics telemetry to Microsoft
2023-11-21T13:38:04.3182405Z BcContainerHelper is version 6.0.0
2023-11-21T13:38:04.3190685Z BcContainerHelper is running as administrator
2023-11-21T13:38:05.5332331Z HyperV is Enabled
2023-11-21T13:38:05.5356756Z UsePsSession is True
2023-11-21T13:38:05.5384167Z Host is Microsoft Windows Server 2019 Datacenter - 10.0.17763.5122
2023-11-21T13:38:05.6952022Z Docker Client Version is 19.03.5
2023-11-21T13:38:05.6962896Z Docker Server Version is 19.03.5
2023-11-21T13:38:06.3121200Z Removing Session Proxy
2023-11-21T13:38:06.4617294Z Removing container Proxy
2023-11-21T13:38:07.3413159Z Removing entries from hosts
2023-11-21T13:38:07.3873311Z Removing Proxy from container hosts file
2023-11-21T13:38:07.4793186Z Removing Proxy-* from container hosts file
2023-11-21T13:38:07.4910518Z Removing Desktop shortcuts
2023-11-21T13:38:07.5232691Z Removing C:\ProgramData\BcContainerHelper\Extensions\Proxy
2023-11-21T13:38:07.9014500Z Fetching all docker images
2023-11-21T13:38:08.0386830Z Fetching all docker volumes
2023-11-21T13:38:08.5324348Z Using image mcr.microsoft.com/businesscentral:10.0.17763.4974-filesonly
2023-11-21T13:38:08.9652358Z Creating Container Proxy
2023-11-21T13:38:08.9660896Z Style: sandbox
2023-11-21T13:38:08.9668539Z Multitenant: Yes
2023-11-21T13:38:08.9676163Z Version: 22.5.59966.62222
2023-11-21T13:38:08.9682966Z Platform: 22.0.62215.0
2023-11-21T13:38:08.9693897Z Generic Tag: 1.0.2.14
2023-11-21T13:38:08.9731861Z Container OS Version: 10.0.17763.4974 (ltsc2019)
2023-11-21T13:38:08.9738965Z Host OS Version: 10.0.17763.5122 (ltsc2019)
2023-11-21T13:38:08.9820270Z WARNING: Host OS and Base Image Container OS doesn't match and process isolation is specified. If you encounter issues, you could try to specify -isolation hyperv
2023-11-21T13:38:08.9827771Z Using process isolation
2023-11-21T13:38:08.9865216Z Using locale en-US
2023-11-21T13:38:08.9900969Z Disabling the standard eventlog dump to container log every 2 seconds (use -dumpEventLog to enable)
2023-11-21T13:38:09.0354124Z Files in C:\ProgramData\BcContainerHelper\Extensions\Proxy\my:
2023-11-21T13:38:09.0485375Z - AdditionalOutput.ps1
2023-11-21T13:38:09.0492368Z - MainLoop.ps1
2023-11-21T13:38:09.0501726Z - SetupVariables.ps1
2023-11-21T13:38:09.0509661Z - updatehosts.ps1
2023-11-21T13:38:09.0516997Z Creating container Proxy from image mcr.microsoft.com/businesscentral:10.0.17763.4974-filesonly
2023-11-21T13:38:09.2958821Z ee2290109087625e7d73739e21e9c1047a8d015234083a275eba69a98cc820ac
2023-11-21T13:38:11.8001659Z Waiting for container Proxy to be ready
2023-11-21T13:38:14.2964926Z Using artifactUrl https://bcartifacts.azureedge.net/sandbox/22.5.59966.62222/us
2023-11-21T13:38:14.2965523Z Using installer from C:\Run\210-new
2023-11-21T13:38:14.2967350Z Installing Business Central
2023-11-21T13:38:14.2967709Z Installing from artifacts
2023-11-21T13:38:14.2968050Z Copying Service Tier Files
2023-11-21T13:38:18.0067716Z c:\dl\sandbox\22.5.59966.62222\platform\ServiceTier\Program Files
2023-11-21T13:38:18.0068425Z c:\dl\sandbox\22.5.59966.62222\platform\ServiceTier\System64Folder
2023-11-21T13:38:18.0068788Z Copying PowerShell Scripts
2023-11-21T13:38:18.0069202Z c:\dl\sandbox\22.5.59966.62222\platform\WindowsPowerShellScripts\Cloud\NAVAdministration
2023-11-21T13:38:18.0069709Z c:\dl\sandbox\22.5.59966.62222\platform\WindowsPowerShellScripts\WebSearch
2023-11-21T13:38:18.0070091Z Copying Web Client Files
2023-11-21T13:38:22.1035000Z c:\dl\sandbox\22.5.59966.62222\platform\WebClient\Microsoft Dynamics NAV
2023-11-21T13:38:22.1035283Z Copying ModernDev Files
2023-11-21T13:38:22.1035447Z c:\dl\sandbox\22.5.59966.62222\platform
2023-11-21T13:38:22.1035643Z c:\dl\sandbox\22.5.59966.62222\platform\ModernDev\program files\Microsoft Dynamics NAV
2023-11-21T13:38:22.1035855Z Copying additional files
2023-11-21T13:38:22.1037563Z Copying ConfigurationPackages
2023-11-21T13:38:23.2697493Z C:\dl\sandbox\22.5.59966.62222\us\ConfigurationPackages
2023-11-21T13:38:23.2697732Z Copying Test Assemblies
2023-11-21T13:38:23.2697902Z C:\dl\sandbox\22.5.59966.62222\platform\Test Assemblies
2023-11-21T13:38:23.2698052Z Copying Extensions
2023-11-21T13:38:24.4400747Z C:\dl\sandbox\22.5.59966.62222\us\Extensions
2023-11-21T13:38:24.4401320Z Copying Applications
2023-11-21T13:38:27.9614351Z C:\dl\sandbox\22.5.59966.62222\platform\Applications
2023-11-21T13:38:27.9614636Z Copying Applications.US
2023-11-21T13:38:29.1577667Z C:\dl\sandbox\22.5.59966.62222\us\Applications.US
2023-11-21T13:38:29.1578226Z Copying dependencies
2023-11-21T13:38:44.6019619Z Copying ReportBuilder
2023-11-21T13:38:44.6020073Z Importing PowerShell Modules
2023-11-21T13:38:44.6020583Z Skipping restore of Cronus database
2023-11-21T13:38:44.6021044Z Modifying Business Central Service Tier Config File for Docker
2023-11-21T13:38:45.7472241Z Installing SIP crypto provider: 'C:\Windows\System32\NavSip.dll'
2023-11-21T13:38:45.7472496Z Installation took 31 seconds
2023-11-21T13:38:45.7472836Z Installation complete
2023-11-21T13:38:45.7478716Z Ready for connections!
2023-11-21T13:38:48.6871568Z Reading CustomSettings.config from Proxy
2023-11-21T13:38:48.8977319Z Cleanup old dotnet core assemblies
2023-11-21T13:38:49.8537085Z Attempting authentication to https://api.businesscentral.dynamics.com/user_impersonation offline_access using refresh token...
2023-11-21T13:38:50.1279017Z Authenticated using refresh token as user Tester (myemail@microsoft.com)
2023-11-21T13:39:21.9029688Z Running Platform Tests ...
2023-11-21T13:39:22.9113900Z Run-TestsInBCContainer Telemetry Correlation Id: cd4b9827-136b-4e4e-b560-1d7de3c088ec
2023-11-21T13:39:23.0254074Z environment not ready, status is DoesNotExist
2023-11-21T13:39:23.0254504Z At C:\Program Files\WindowsPowerShell\Modules\BcContainerHelper\6.0.0\AppHandling\Run-TestsInNavContainer.ps1:143
2023-11-21T13:39:23.0254780Z char:13
2023-11-21T13:39:23.0257245Z + throw "environment not ready, status is $($response.statu ...
2023-11-21T13:39:23.0258310Z + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2023-11-21T13:39:23.0258719Z + CategoryInfo : OperationStopped: (environment not...is DoesNotExist:String) [], RuntimeException
2023-11-21T13:39:23.0259668Z + FullyQualifiedErrorId : environment not ready, status is DoesNotExist
2023-11-21T13:39:23.0259972Z

*Additional context

  • does it happen all the time?
    Yes
  • did it use to work?
    I use the same command on docker no problem. I'm thinking there is a missing credential somewhere.
@freddydk
Copy link
Contributor

It says that the environment does not exist.
Did you try running get-bcenvironments to see which environments exists with that authcontext?

@AmandaTest
Copy link
Author

AmandaTest commented Nov 24, 2023 via email

@freddydk
Copy link
Contributor

Which then means that your authcontext is wrong.

@AmandaTest
Copy link
Author

AmandaTest commented Nov 24, 2023 via email

@AmandaTest
Copy link
Author

AmandaTest commented Nov 24, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants