Copilot commented on code in PR #13753:
URL: https://github.com/apache/trafficserver/pull/13753#discussion_r4138941636


##########
tests/gold_tests/pluginTest/stats_over_http/stats_over_http_compression.test.py:
##########
@@ -0,0 +1,109 @@
+'''
+Verify that stats_over_http compresses responses with many metrics and 
releases the intercept of aborted requests.
+'''
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+
+import os
+import sys
+
+Test.Summary = 'Compress stats_over_http responses with many metrics'
+Test.SkipUnless(Condition.PluginExists('stats_over_http.so'))
+Test.SkipIf(Condition.CurlUsingUnixDomainSocket())
+Test.ContinueOnFail = True
+
+# With this many metrics, the Prometheus output is larger than the default 1 
MiB thread stack.
+METRIC_COUNT = 10000
+
+# LeakSanitizer does not run on macOS, so cont_count.py counts live 
continuations to detect a leaked intercept.
+ts = Test.MakeATSProcess('ts', command='traffic_server --disable_pfreelist')
+Test.PrepareTestPlugin(os.path.join(Test.Variables.AtsTestPluginsDir, 
'test_metrics.so'), ts, f'--count={METRIC_COUNT}')
+ts.Disk.plugin_config.AddLine('stats_over_http.so _stats')
+ts.Disk.records_config.update(
+    {
+        'proxy.config.diags.debug.enabled': 1,
+        'proxy.config.diags.debug.tags': 'test_metrics',
+        'proxy.config.dump_mem_info_frequency': 1,
+    })
+ts.Disk.traffic_out.Content += Testers.ContainsExpression(
+    f'Created {METRIC_COUNT} metrics', 'test_metrics.so should create the 
requested gauges.')
+
+client = os.path.join(Test.RunDirectory, 'fetch_stats.py')
+Test.Setup.Copy('fetch_stats.py')
+cont_count = os.path.join(Test.RunDirectory, 'cont_count.py')
+Test.Setup.Copy('cont_count.py')
+cont_baseline = os.path.join(Test.RunDirectory, 'cont_baseline')
+
+encodings = ['gzip', 'deflate']
+if Test.Variables.get('TS_HAS_BROTLI'):
+    encodings.append('br')

Review Comment:
   `TS_HAS_BROTLI` only proves the Brotli library was available at build time, 
but every `br` case later invokes the standalone `brotli` executable. 
Environments such as the Debian build image install `libbrotli-dev` without 
installing that CLI (`ci/docker/deb/Dockerfile:58`), so this test fails with 
`FileNotFoundError` despite a valid Brotli-enabled build. Gate the `br` cases 
on executable availability (for example, `shutil.which`) or decode without an 
external command.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to