-
Notifications
You must be signed in to change notification settings - Fork 3.3k
[Test Proxy] Add error response with debug information when startup hangs #26138
Description
While adding test proxy support to a new test suite, a user was having issues running tests -- pytest would correctly collect tests and the test proxy container would start, but things would hang at that point. Below is a snippet of test proxy container logs, which continued with many more "Recorded: 0 Played Back: 0" statements.
Dumping Resolved Configuration Values:
VERSION = 6.0.6
URLS = http://0.0.0.0:5000;https://0.0.0.0:5001
SYSTEM_GLOBALIZATION_INVARIANT = true
RUNNING_IN_CONTAINER = true
PATH = /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
NO_AT_BRIDGE = 1
Logging =
Logging:LogLevel =
Logging:LogLevel:Microsoft.Hosting.Lifetime = Information
Logging:LogLevel:Microsoft = Information
Logging:LogLevel:Default = Information
Logging:Console =
Logging:Console:FormatterName =
HOSTNAME = ffcfcc8294da
HOME = /root
ENVIRONMENT = Development
DOTNET_VERSION = 6.0.6
DOTNET_SYSTEM_GLOBALIZATION_INVARIANT = true
DOTNET_RUNNING_IN_CONTAINER = true
contentRoot = /proxyserver
CERT_IMPORT_SH = apply-dev-cert.sh
CERT_FOLDER = /var/certwork
ASPNET_VERSION = 6.0.6
ASPNETCORE_URLS = http://0.0.0.0:5000;https://0.0.0.0:5001
ASPNETCORE_ENVIRONMENT = Development
applicationName = Azure.Sdk.Tools.TestProxy
AllowedHosts = *
[19:11:30] warn: Microsoft.AspNetCore.DataProtection.Repositories.FileSystemXmlRepository[60]
Storing keys in a directory '/root/.aspnet/DataProtection-Keys' that may not be persisted outside of the container. Protected data will be unavailable when container is destroyed.
[19:11:30] info: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[62]
User profile is available. Using '/root/.aspnet/DataProtection-Keys' as key repository; keys will not be encrypted at rest.
[19:11:30] info: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[58]
Creating key {614a8dbe-fbb3-4fcd-924a-1b8d4e273571} with creation date 2022-09-09 19:11:30Z, activation date 2022-09-09 19:11:30Z, and expiration date 2022-12-08 19:11:30Z.
[19:11:30] warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35]
No XML encryptor configured. Key {614a8dbe-fbb3-4fcd-924a-1b8d4e273571} may be persisted to storage in unencrypted form.
[19:11:30] info: Microsoft.AspNetCore.DataProtection.Repositories.FileSystemXmlRepository[39]
Writing data to file '/root/.aspnet/DataProtection-Keys/key-614a8dbe-fbb3-4fcd-924a-1b8d4e273571.xml'.
[19:11:30] info: Microsoft.Hosting.Lifetime[14]
Now listening on: http://0.0.0.0:5000/
[19:11:30] info: Microsoft.Hosting.Lifetime[14]
Now listening on: https://0.0.0.0:5001/
[19:11:30] info: Microsoft.Hosting.Lifetime[0]
Application started. Press Ctrl+C to shut down.
[19:11:30] info: Microsoft.Hosting.Lifetime[0]
Hosting environment: Development
[19:11:30] info: Microsoft.Hosting.Lifetime[0]
Content root path: /proxyserver
[19:11:31] Recorded: 0 Played Back: 0
[19:11:32] Recorded: 0 Played Back: 0
Normally, before the "Recorded: 0 Played Back: 0" logs, there should be logs of the recording/playback session starting request.
The issue turned out to be that the test proxy devcert was never set up correctly, so our attempts to check proxy availability failed. Ideally, a certificate issue should be detected and reported straight away, instead of having to wait for attempts to time out. At the very least, we should report the failure upon timeout with a helpful message that suggests double-checking certificate setup, any local setting for the PROXY_URL environment variable, etc. that could have caused the issue.