Skip to content

Commit ab99b89

Browse files
sethsamuelazhou-datadogclaude
authored
Add SQLSever 2025 to CI (DataDog#22794)
* always emit session_id as integer * Add SQLSever 2025 to CI * Hatch * Validate * Hatch * Validate * Image * add 60 sec lookback window * move lookback window seting to specific failing test only * Add -C flag to sqlcmd in sqlserver-entrypoint.ps1 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * make test less flaky by relaxing lower bound * linter --------- Co-authored-by: Allen Zhou <allen.zhou@datadoghq.com> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 90a83f0 commit ab99b89

6 files changed

Lines changed: 31 additions & 5 deletions

File tree

.github/workflows/test-all-windows.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,9 +362,23 @@ jobs:
362362
agent-image-windows-py2: "${{ inputs.agent-image-windows-py2 }}"
363363
test-py2: ${{ inputs.test-py2 }}
364364
test-py3: ${{ inputs.test-py3 }}
365+
target-env: ${{ matrix.target-env }}
365366
minimum-base-package: ${{ inputs.minimum-base-package }}
366367
pytest-args: ${{ inputs.pytest-args }}
367368
secrets: inherit
369+
strategy:
370+
matrix:
371+
target-env:
372+
- py3.13-windows-SQLOLEDB-2019-single
373+
- py3.13-windows-SQLOLEDB-2022-single
374+
- py3.13-windows-SQLOLEDB-2025-single
375+
- py3.13-windows-MSOLEDBSQL-2019-single
376+
- py3.13-windows-MSOLEDBSQL-2022-single
377+
- py3.13-windows-MSOLEDBSQL-2025-single
378+
- py3.13-windows-odbc-2019-single
379+
- py3.13-windows-odbc-2022-single
380+
- py3.13-windows-odbc-2025-single
381+
fail-fast: false
368382
j87dbe3f:
369383
uses: ./.github/workflows/test-target.yml
370384
with:

.github/workflows/test-all.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3638,10 +3638,14 @@ jobs:
36383638
- py3.13-linux-FreeTDS-2019-ha
36393639
- py3.13-linux-FreeTDS-2022-single
36403640
- py3.13-linux-FreeTDS-2022-ha
3641+
- py3.13-linux-FreeTDS-2025-single
3642+
- py3.13-linux-FreeTDS-2025-ha
36413643
- py3.13-linux-odbc-2019-single
36423644
- py3.13-linux-odbc-2019-ha
36433645
- py3.13-linux-odbc-2022-single
36443646
- py3.13-linux-odbc-2022-ha
3647+
- py3.13-linux-odbc-2025-single
3648+
- py3.13-linux-odbc-2025-ha
36453649
- py3.13-linux-2022-newyork
36463650
- py3.13-linux-2022-tokyo
36473651
fail-fast: false

sqlserver/hatch.toml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ base-package-features = ["deps", "db", "json"]
55
python = ["3.13"]
66
os = ["linux"]
77
driver = ["FreeTDS", "odbc"]
8-
version = ["2019", "2022"]
8+
version = ["2019", "2022", "2025"]
99
setup = ["single", "ha"]
1010

1111
# test the compatibility of sqlserver running on non-utc timezone
@@ -23,7 +23,7 @@ tz = ["newyork", "tokyo"]
2323
python = ["3.13"]
2424
os = ["windows"]
2525
driver = ["SQLOLEDB", "MSOLEDBSQL", "odbc"]
26-
version = ["2019", "2022"]
26+
version = ["2019", "2022", "2025"]
2727
setup = ["single"]
2828

2929
# The high cardinality environment is meant to be used for local dev/testing
@@ -60,6 +60,7 @@ matrix.version.env-vars = [
6060
{ key = "SQLSERVER_YEAR" },
6161
{ key = "SQLSERVER_ENGINE_EDITION", value = "express" },
6262
# Map years to major versions
63+
{ key = "SQLSERVER_MAJOR_VERSION", value="17", if = ["2025"] },
6364
{ key = "SQLSERVER_MAJOR_VERSION", value="16", if = ["2022"] },
6465
{ key = "SQLSERVER_MAJOR_VERSION", value="15", if = ["2019"] },
6566
{ key = "SQLSERVER_MAJOR_VERSION", value="14", if = ["2017"] },
@@ -68,6 +69,7 @@ matrix.version.env-vars = [
6869
{ key = "SQLSERVER_IMAGE_TAG", value = "2017-CU31-GDR2-ubuntu-18.04", if = ["2017"], platform = ["linux"] },
6970
{ key = "SQLSERVER_IMAGE_TAG", value = "2019-CU28-GDR1-ubuntu-20.04", if = ["2019"], platform = ["linux"] },
7071
{ key = "SQLSERVER_IMAGE_TAG", value = "2022-CU12-GDR1-ubuntu-20.04", if = ["2022"], platform = ["linux"] },
72+
{ key = "SQLSERVER_IMAGE_TAG", value = "2025-CU2-ubuntu-24.04", if = ["2025"], platform = ["linux"] },
7173
{ key = "SQLSERVER_BASE_IMAGE", value = "datadog/docker-library:sqlserver_{matrix:version}", platform = ["windows"] },
7274
]
7375
matrix.driver.env-vars = [
@@ -80,4 +82,5 @@ matrix.tz.env-vars = [
8082
]
8183
name.linux-odbc-2019-high-cardinality.env-vars = "COMPOSE_FOLDER=compose-high-cardinality"
8284
name.linux-odbc-2022-high-cardinality.env-vars = "COMPOSE_FOLDER=compose-high-cardinality"
85+
name.linux-odbc-2025-high-cardinality.env-vars = "COMPOSE_FOLDER=compose-high-cardinality"
8386
name.windows-odbc-2019-high-cardinality.env-vars = "COMPOSE_FOLDER=compose-high-cardinality-windows"

sqlserver/tests/compose-windows/sqlserver-entrypoint.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ $smo.Settings.LoginMode = "Mixed"
1717
$smo.Alter()
1818

1919
echo "INFO: running setup.sql for integration tests"
20-
sqlcmd -d master -i setup.sql -b -f 65001
20+
sqlcmd -d master -i setup.sql -b -f 65001 -C
2121
if (-Not $?) {
2222
throw "ERROR: setup.sql failed"
2323
}

sqlserver/tests/test_activity.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -875,10 +875,11 @@ def test_activity_collection_rate_limit(aggregator, dd_run_check, dbm_instance):
875875
dd_run_check(check)
876876
sleep_time = 1
877877
time.sleep(sleep_time)
878-
max_collections = int(1 / collection_interval * sleep_time) + 1
878+
max_collections = int(sleep_time / collection_interval) + 1
879+
min_collections = sleep_time # at minimum, one collection per second
879880
check.cancel()
880881
metrics = aggregator.metrics("dd.sqlserver.activity.collect_activity.payload_size")
881-
assert max_collections / 2.0 <= len(metrics) <= max_collections
882+
assert min_collections <= len(metrics) <= max_collections
882883

883884

884885
def _load_test_activity_json(filename):

sqlserver/tests/test_statements.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -596,6 +596,10 @@ def test_statement_metrics_limit(
596596
def test_statement_metadata(
597597
aggregator, dd_run_check, dbm_instance, bob_conn, datadog_agent, metadata, expected_metadata_payload
598598
):
599+
# The near-zero collection_interval produces a ~1s lookback window (math.ceil(~0 * 2) = 1).
600+
# Set an explicit lookback_window so the test query isn't missed when the check's preliminary
601+
# steps take longer than 1 second (e.g. on SQL Server 2025).
602+
dbm_instance['query_metrics']['lookback_window'] = 60
599603
check = SQLServer(CHECK_NAME, {}, [dbm_instance])
600604

601605
query = "select * from sys.databases /* service='datadog-agent' */"

0 commit comments

Comments
 (0)