Skip to content

Migrate conftest.py MockResponse fixture chains to MockHTTPResponse#23226

Merged
mwdd146980 merged 7 commits intomwdd146980/httpx-migration-basefrom
mwdd146980/step3e-conftest-migration
Apr 20, 2026
Merged

Migrate conftest.py MockResponse fixture chains to MockHTTPResponse#23226
mwdd146980 merged 7 commits intomwdd146980/httpx-migration-basefrom
mwdd146980/step3e-conftest-migration

Conversation

@mwdd146980
Copy link
Copy Markdown
Contributor

@mwdd146980 mwdd146980 commented Apr 8, 2026

Motivation

Part of the requests→httpx test decoupling. The remaining conftest.py files that import MockResponse and patch requests.Session.* break when the HTTP backend switches to httpx.

Approach

Swap MockResponseMockHTTPResponse and replace requests.Session.* patches with the mock_http fixture, which intercepts at the AgentCheck.http property level and works regardless of HTTP backend. openstack_controller and yarn were partially migrated. Session patches kept for now (details).

Also dropped auth kwargs validation from hdfs_datanode/hdfs_namenode/mapreduce/yarn fixtures — these tested HTTP wrapper plumbing, not integration behavior. Consistent with Step 2's migration to config assertions.

No production code changes — all production except clause widenings are in PR #23046.

Details: Step 3e on Confluence

Verification

All affected integration test suites pass (ddev --no-interactive test --recreate).

🤖 Generated with Claude Code

Copy link
Copy Markdown
Contributor Author

mwdd146980 commented Apr 8, 2026

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 8, 2026

Codecov Report

❌ Patch coverage is 91.36691% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 94.00%. Comparing base (e1c120e) to head (c22010a).

Additional details and impacted files
Flag Coverage Δ
active_directory ?
activemq_xml ?
aerospike ?
airflow ?
amazon_msk ?
ambari ?
apache ?
appgate_sdp ?
arangodb ?
argo_rollouts ?
argo_workflows ?
argocd ?
aspdotnet ?
avi_vantage ?
aws_neuron ?
azure_iot_edge ?
boundary ?
btrfs ?
cacti ?
calico ?
cassandra_nodetool ?
celery ?
ceph ?
cert_manager ?
cilium ?
cisco_aci ?
citrix_hypervisor ?
clickhouse ?
cloud_foundry_api ?
cloudera ?
cockroachdb ?
consul ?
coredns ?
couch ?
couchbase ?
crio ?
datadog_checks_base ?
datadog_checks_dev ?
datadog_checks_downloader ?
datadog_cluster_agent ?
dcgm ?
ddev ?
directory ?
disk ?
dns_check ?
dotnetclr ?
druid ?
duckdb ?
ecs_fargate ?
eks_fargate ?
elastic ?
envoy ?
esxi ?
etcd ?
exchange_server ?
external_dns ?
falco ?
fluentd ?
fluxcd ?
fly_io ?
foundationdb ?
gearmand ?
gitlab ?
gitlab_runner ?
glusterfs ?
go_expvar ?
gunicorn ?
haproxy ?
harbor ?
hazelcast ?
hdfs_datanode ?
hdfs_namenode ?
http_check ?
ibm_ace ?
ibm_db2 ?
ibm_i ?
ibm_mq ?
ibm_was ?
iis ?
impala ?
infiniband ?
istio ?
kafka_consumer ?
karpenter ?
keda ?
kong ?
krakend ?
kube_apiserver_metrics ?
kube_controller_manager ?
kube_dns ?
kube_metrics_server ?
kube_proxy ?
kube_scheduler ?
kubeflow ?
kubelet ?
kubernetes_cluster_autoscaler ?
kubernetes_state ?
kubevirt_api ?
kubevirt_controller ?
kubevirt_handler ?
kuma ?
kyototycoon ?
kyverno ?
lighttpd ?
linkerd ?
linux_proc_extras ?
litellm ?
lustre ?
mac_audit_logs ?
mapr ?
mapreduce ?
marathon ?
marklogic ?
mcache ?
mesos_master ?
milvus ?
mongo ?
mysql ?
nagios ?
network ?
nfsstat ?
nginx ?
nginx_ingress_controller ?
nvidia_nim ?
nvidia_triton ?
octopus_deploy ?
openldap ?
openmetrics ?
openstack ?
openstack_controller ?
pdh_check ?
pgbouncer ?
php_fpm ?
postfix ?
postgres ?
powerdns_recursor ?
process ?
prometheus ?
proxmox ?
proxysql ?
pulsar ?
quarkus ?
rabbitmq ?
ray ?
redisdb ?
rethinkdb ?
riak ?
riakcs ?
sap_hana ?
scylla ?
silk ?
silverstripe_cms ?
singlestore ?
slurm ?
snmp ?
sonarqube ?
sonatype_nexus ?
spark ?
sqlserver ?
squid ?
ssh_check ?
statsd ?
strimzi ?
supabase ?
supervisord ?
system_core ?
system_swap ?
tcp_check ?
teamcity ?
tekton ?
teleport ?
temporal ?
teradata ?
tibco_ems ?
tls ?
torchserve ?
traefik_mesh ?
traffic_server ?
twemproxy ?
twistlock ?
varnish ?
vault ?
velero ?
vertica ?
vllm ?
voltdb ?
vsphere ?
weaviate ?
win32_event_log ?
windows_performance_counters ?
windows_service ?
wmi_check ?
yarn ?
zk ?

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mwdd146980 mwdd146980 force-pushed the mwdd146980/step3e-conftest-migration branch from ce699e0 to 573c1ba Compare April 8, 2026 22:43
@mwdd146980
Copy link
Copy Markdown
Contributor Author

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 96bc51f8db

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread hdfs_namenode/tests/conftest.py
@mwdd146980 mwdd146980 force-pushed the mwdd146980/step3e-conftest-migration branch from 96bc51f to e79d221 Compare April 10, 2026 18:15
@mwdd146980 mwdd146980 force-pushed the mwdd146980/step3d-batch-migrate-mockresponse branch from 000eac1 to 5b6df5a Compare April 10, 2026 18:15
@datadog-official
Copy link
Copy Markdown
Contributor

datadog-official Bot commented Apr 10, 2026

Tests

🎉 All green!

❄️ No new flaky tests detected
🧪 All tests passed

🎯 Code Coverage (details)
Patch Coverage: 91.37%
Overall Coverage: 93.99%

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: c22010a | Docs | Datadog PR Page | Give us feedback!

@mwdd146980 mwdd146980 self-assigned this Apr 10, 2026
@mwdd146980 mwdd146980 marked this pull request as ready for review April 10, 2026 20:05
@mwdd146980 mwdd146980 requested review from a team as code owners April 10, 2026 20:05
@mwdd146980 mwdd146980 force-pushed the mwdd146980/step3e-conftest-migration branch from 0caefaa to 4c1a5da Compare April 13, 2026 18:12
@mwdd146980 mwdd146980 force-pushed the mwdd146980/step3e-conftest-migration branch from 4c1a5da to 2369a51 Compare April 14, 2026 15:58
@mwdd146980 mwdd146980 force-pushed the mwdd146980/step3d-batch-migrate-mockresponse branch from 5b6df5a to 406407a Compare April 14, 2026 15:58
@mwdd146980 mwdd146980 force-pushed the mwdd146980/step3d-batch-migrate-mockresponse branch from 406407a to d40acc2 Compare April 14, 2026 18:29
@mwdd146980 mwdd146980 force-pushed the mwdd146980/step3e-conftest-migration branch from 2369a51 to 14387fd Compare April 14, 2026 18:29
@mwdd146980 mwdd146980 force-pushed the mwdd146980/step3d-batch-migrate-mockresponse branch from d40acc2 to 9971aa6 Compare April 14, 2026 20:29
@mwdd146980 mwdd146980 force-pushed the mwdd146980/step3e-conftest-migration branch from 14387fd to 33ed764 Compare April 14, 2026 20:29
Copy link
Copy Markdown
Contributor

@triviajon triviajon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm for container-integrations owned files

mwdd146980 and others added 7 commits April 20, 2026 15:09
Migrate 31 test files from `MockResponse` (requests-coupled) to
`MockHTTPResponse` (library-agnostic) as part of the requests→httpx
decoupling. Also widen JSONDecodeError except clauses in spark and
proxmox production code, add `links` property to MockHTTPResponse
for pagination support, and update test assertions that referenced
requests-specific exception class names.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Fix links property to split on ", <" instead of bare commas,
  matching requests.Response.links behavior (avoids breaking URLs
  containing commas)
- Update elastic test assertions to remove requests-specific
  ": None for url: None" error suffix
- Widen elastic _get_template_metrics except clause to catch
  AgentHTTPError alongside requests.RequestException

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Fix links property to fall back to keying by URL when rel is
  absent (matching requests.Response.links behavior)
- Add 6 dedicated unit tests for the links property: standard
  rel, multiple links, empty header, no-rel fallback, commas in
  URLs, and header pop clearing

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Drop 5 tests that tested Python internals or trivial one-liners
rather than MockHTTPResponse behavior: ok property (status < 400),
reason property (stdlib dict lookup), headers delete/pop (dict ops),
headers update with custom Mapping (unused code path), url attribute
(attribute assignment).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace MockResponse with MockHTTPResponse in 13 conftest.py files.
For 10 integrations, also migrate requests.Session.* patches to use
the mock_http fixture with configured side_effect, making tests
backend-agnostic. openstack_controller keeps Session patches due to
keystoneauth1 SDK coupling. Widen citrix_hypervisor JSONDecodeError
except clause for stdlib compatibility.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@mwdd146980 mwdd146980 force-pushed the mwdd146980/step3e-conftest-migration branch from e310970 to c22010a Compare April 20, 2026 13:09
@mwdd146980 mwdd146980 force-pushed the mwdd146980/step3d-batch-migrate-mockresponse branch from aeea062 to e1c120e Compare April 20, 2026 13:09
@dd-octo-sts
Copy link
Copy Markdown
Contributor

dd-octo-sts Bot commented Apr 20, 2026

Validation Report

All 20 validations passed.

Show details
Validation Description Status
agent-reqs Verify check versions match the Agent requirements file
ci Validate CI configuration and Codecov settings
codeowners Validate every integration has a CODEOWNERS entry
config Validate default configuration files against spec.yaml
dep Verify dependency pins are consistent and Agent-compatible
http Validate integrations use the HTTP wrapper correctly
imports Validate check imports do not use deprecated modules
integration-style Validate check code style conventions
jmx-metrics Validate JMX metrics definition files and config
labeler Validate PR labeler config matches integration directories
legacy-signature Validate no integration uses the legacy Agent check signature
license-headers Validate Python files have proper license headers
licenses Validate third-party license attribution list
metadata Validate metadata.csv metric definitions
models Validate configuration data models match spec.yaml
openmetrics Validate OpenMetrics integrations disable the metric limit
package Validate Python package metadata and naming
readmes Validate README files have required sections
saved-views Validate saved view JSON file structure and fields
version Validate version consistency between package and changelog

View full run

Base automatically changed from mwdd146980/step3d-batch-migrate-mockresponse to mwdd146980/httpx-migration-base April 20, 2026 15:42
@mwdd146980 mwdd146980 merged commit d181f9a into mwdd146980/httpx-migration-base Apr 20, 2026
37 of 61 checks passed
@mwdd146980 mwdd146980 deleted the mwdd146980/step3e-conftest-migration branch April 20, 2026 15:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment