Fix cgroupv1 acceptance test to explicitly register the v1 parser#7296
Fix cgroupv1 acceptance test to explicitly register the v1 parser#7296stephentoub merged 2 commits intomainfrom
Conversation
The ResourceUtilizationTracker_And_Metrics_Report_Same_Values_With_Cgroupsv1 test was missing a .Replace() call to explicitly register the cgroupv1 parser. On CI hosts running cgroupv2, AddResourceMonitoring() would detect cgroupv2 and register the v2 parser, which then failed trying to read v2 paths from the fake filesystem that only had v1 paths. This matches the pattern already used by the equivalent cgroupv2 test. Co-authored-by: stephentoub <[email protected]>
|
@copilot, the tests should be robust to run on any machine, not just the ones currently or previously in CI |
Agreed. The fix at |
There was a problem hiding this comment.
Pull request overview
Fixes a Linux resource monitoring acceptance test that fails on cgroupv2 hosts by ensuring the cgroupv1 test explicitly uses the cgroupv1 utilization parser rather than relying on host cgroup auto-detection.
Changes:
- Update the cgroupv1 acceptance test DI setup to replace
ILinuxUtilizationParserwithLinuxUtilizationParserCgroupV1afterAddResourceMonitoring(). - Align the cgroupv1 test’s service registration pattern with the existing cgroupv2 acceptance test in the same file.
) Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: stephentoub <[email protected]>
* Update SDK and dotnet version to 10.0.103 * Update public pipeline pool images to fix broken builds (#7292) Update the pool image references in azure-pipelines-public.yml: - Windows: windows.vs2022preview.amd64.open -> 1es-windows-2022-open - Ubuntu: build.ubuntu.2004.amd64.open -> Build.Ubuntu.2204.Amd64.Open The old images have been retired and are no longer available, causing build failures. This matches the equivalent change made in dotnet/aspire (PR #14486). * Use smaller windows.vs2022.amd64.open image instead of 1es-windows-2022-open (#7298) The 1es-windows-2022-open image is the large 'kitchen sink' image. Switch to windows.vs2022.amd64.open which is the appropriate smaller image for our build needs. * Fix cgroupv1 acceptance test to explicitly register the v1 parser (#7296) Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: stephentoub <[email protected]> --------- Co-authored-by: William Godbe <[email protected]> Co-authored-by: Jose Perez Rodriguez <[email protected]> Co-authored-by: Copilot <[email protected]> Co-authored-by: stephentoub <[email protected]>
ResourceUtilizationTracker_And_Metrics_Report_Same_Values_With_Cgroupsv1fails on cgroupv2 hosts becauseAddResourceMonitoring()auto-detects the host's cgroup version, not the fake filesystem's. On cgroupv2 CI machines, the v2 parser is registered and tries to read/sys/fs/cgroup/cpuset.cpus.effective— which doesn't exist in the v1 fake filesystem..Replace(ServiceDescriptor.Singleton<ILinuxUtilizationParser, LinuxUtilizationParserCgroupV1>())afterAddResourceMonitoring(), matching the pattern the equivalent cgroupv2 test already uses at line 354 of the same file.Original prompt
This section details on the original issue you should resolve
<issue_title>ResourceUtilizationTracker_And_Metrics_Report_Same_Values_With_Cgroupsv1 consistently failing in CI</issue_title>
<issue_description>```
System.InvalidOperationException : Could not parse '/sys/fs/cgroup/cpuset.cpus.effective'. Expected comma-separated list of integers, with dashes ("-") based ranges ("0", "2-6,12") but got ''.
Microsoft.Shared.Diagnostics.Throw.InvalidOperationException(String message)
Microsoft.Extensions.Diagnostics.ResourceMonitoring.Linux.LinuxUtilizationParserCgroupV2.g__ThrowException|35_0(ReadOnlySpan
1 content) Microsoft.Extensions.Diagnostics.ResourceMonitoring.Linux.LinuxUtilizationParserCgroupV2.GetHostCpuCount() Microsoft.Extensions.Diagnostics.ResourceMonitoring.Linux.LinuxUtilizationParserCgroupV2.GetCgroupLimitedCpus() Microsoft.Extensions.Diagnostics.ResourceMonitoring.Linux.LinuxResourceQuotaProvider.GetResourceQuota() Microsoft.Extensions.Diagnostics.ResourceMonitoring.Linux.LinuxUtilizationProvider..ctor(IOptions1 options, ILinuxUtilizationParser parser, IMeterFactory meterFactory, ResourceQuotaProvider resourceQuotaProvider, ILogger1 logger, TimeProvider timeProvider) InvokeStub_LinuxUtilizationProvider..ctor(Object, Span1)System.Reflection.MethodBaseInvoker.InvokeWithManyArgs(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context)
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor
2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument) Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite callSite, RuntimeResolverContext context) Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2.VisitCallSite(ServiceCallSite callSite, TArgument argument)Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context)
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor
2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument) Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite callSite, RuntimeResolverContext context) Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2.VisitCallSite(ServiceCallSite callSite, TArgument argument)Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(ServiceCallSite callSite, ServiceProviderEngineScope scope)
Microsoft.Extensions.DependencyInjection.ServiceProvider.CreateServiceAccessor(ServiceIdentifier serviceIdentifier)
System.Collections.Concurrent.ConcurrentDictionary
2.GetOrAdd(TKey key, Func2 valueFactory)Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(ServiceIdentifier serviceIdentifier, ServiceProviderEngineScope serviceProviderEngineScope)
Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope.GetService(Type serviceType)
Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)
Microsoft.Extensions.Diagnostics.ResourceMonitoring.ResourceMonitorBuilder.<>c.<.ctor>b__3_1(IServiceProvider sp)
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitFactory(FactoryCallSite factoryCallSite, RuntimeResolverContext context)
Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor
2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument) Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite callSite, RuntimeResolverContext context) Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2.VisitCallSite(ServiceCallSite callSite, TArgument argument)Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(ServiceCallSite callSite, ServiceProviderEngineScope scope)
Microsoft.Extensions.DependencyInjection.ServiceProvider.CreateServiceAccessor(ServiceIdentifier serviceIdentifier)
System.Collections.Concurrent.ConcurrentDictionary
2.GetOrAdd(TKey key, Func2 valueFactory)Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(ServiceIdentifier serviceIdentifier, ServiceProviderEngineScope serviceProviderEngineScope)
Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type serviceType)
Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExte...
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.
Microsoft Reviewers: Open in CodeFlow