Skip to content

Commit

Permalink
ci: move consul, mariadb, mongoengine suites to gitlab (#12516)
Browse files Browse the repository at this point in the history
This change moves to gitlab the mongoengine, mariadb, and consul test
suites as part an the ongoing migration away from circleci.

## Checklist
- [x] PR author has checked that all the criteria below are met
- The PR description includes an overview of the change
- The PR description articulates the motivation for the change
- The change includes tests OR the PR description describes a testing
strategy
- The PR description notes risks associated with the change, if any
- Newly-added code is easy to change
- The change follows the [library release note
guidelines](https://ddtrace.readthedocs.io/en/stable/releasenotes.html)
- The change includes or references documentation updates if necessary
- Backport labels are set (if
[applicable](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting))

## Reviewer Checklist
- [x] Reviewer has checked that all the criteria below are met 
- Title is accurate
- All changes are related to the pull request's stated goal
- Avoids breaking
[API](https://ddtrace.readthedocs.io/en/stable/versioning.html#interfaces)
changes
- Testing strategy adequately addresses listed risks
- Newly-added code is easy to change
- Release note makes sense to a user of the library
- If necessary, author has acknowledged and discussed the performance
implications of this PR as reported in the benchmarks PR comment
- Backport labels are set in a manner that is consistent with the
[release branch maintenance
policy](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting)
  • Loading branch information
emmettbutler authored Feb 26, 2025
1 parent 1a52cd6 commit 2aa4ffb
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 37 deletions.
29 changes: 0 additions & 29 deletions .circleci/config.templ.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ ubuntu_base_image: &ubuntu_base_img ubuntu-2004:2023.04.2
cimg_base_image: &cimg_base_image cimg/base:2022.08
python310_image: &python310_image cimg/python:3.10.12
ddtrace_dev_image: &ddtrace_dev_image ghcr.io/datadog/dd-trace-py/testrunner:47c7b5287da25643e46652e6d222a40a52f2382a@sha256:3a02dafeff9cd72966978816d1b39b54f5517af4049396923b95c8452f604269
consul_image: &consul_image consul:1.6.0@sha256:daa6203532fc30d81bf6c5593f79a2c7c23f08e8fde82f1e4bd8069b48b57596
moto_image: &moto_image datadog/docker-library:moto_1_0_1@sha256:58c15f03141073629f4ff2a78910b812205324579c76f8bcac87e8e89af2e673
mongo_image: &mongo_image mongo:3.6@sha256:19c11a8f1064fd2bb713ef1270f79a742a184cd57d9bb922efdd2a8eca514af8
httpbin_image: &httpbin_image kennethreitz/httpbin@sha256:2c7abc4803080c22928265744410173b6fea3b898872c01c5fd0f0f9df4a59fb
testagent_image: &testagent_image ghcr.io/datadog/dd-apm-test-agent/ddapm-test-agent:v1.20.0

Expand Down Expand Up @@ -422,33 +420,6 @@ jobs:
snapshot: true
docker_services: "localstack"

consul:
<<: *contrib_job_small
docker:
- image: *ddtrace_dev_image
- image: *consul_image
- *testagent
steps:
- run_test:
pattern: 'consul'

mariadb:
<<: *machine_executor
parallelism: 4
steps:
- run_test:
pattern: 'mariadb$'
snapshot: true
docker_services: "mariadb"

mongoengine:
<<: *machine_executor
steps:
- run_test:
pattern: 'mongoengine'
snapshot: true
docker_services: 'mongo'

aiobotocore:
<<: *contrib_job
docker:
Expand Down
11 changes: 11 additions & 0 deletions .gitlab/services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,14 @@
variables:
MAX_HEAP_SIZE: 512M
HEAP_NEWSIZE: 256M
mariadb:
name: registry.ddbuild.io/images/mirror/mariadb:lts
alias: mariadb
variables:
MYSQL_ROOT_PASSWORD: example
MYSQL_DATABASE: test
MYSQL_USER: test
MYSQL_PASSWORD: test
consul:
name: registry.ddbuild.io/images/mirror/consul:1.6.0
alias: consul
35 changes: 27 additions & 8 deletions tests/contrib/consul/test.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import os

import consul
from wrapt import BoundFunctionWrapper

Expand All @@ -12,10 +14,15 @@
from ..config import CONSUL_CONFIG


CONSUL_HTTP_ADDR = f"{CONSUL_CONFIG['host']}:{CONSUL_CONFIG['port']}"


class TestConsulPatch(TracerTestCase):
TEST_SERVICE = "test-consul"

def setUp(self):
if "CONSUL_HTTP_ADDR" in os.environ:
del os.environ["CONSUL_HTTP_ADDR"]
super(TestConsulPatch, self).setUp()
patch()
c = consul.Consul(
Expand Down Expand Up @@ -176,7 +183,7 @@ def tearDown(self):
unpatch()
super(TestSchematization, self).tearDown()

@TracerTestCase.run_in_subprocess(env_overrides=dict(DD_SERVICE="mysvc"))
@TracerTestCase.run_in_subprocess(env_overrides=dict(DD_SERVICE="mysvc", CONSUL_HTTP_ADDR=CONSUL_HTTP_ADDR))
def test_schematize_service_name_default(self):
key = "test/put/consul"
value = "test_value"
Expand All @@ -189,7 +196,9 @@ def test_schematize_service_name_default(self):

assert span.service == "consul"

@TracerTestCase.run_in_subprocess(env_overrides=dict(DD_SERVICE="mysvc", DD_TRACE_SPAN_ATTRIBUTE_SCHEMA="v0"))
@TracerTestCase.run_in_subprocess(
env_overrides=dict(DD_SERVICE="mysvc", DD_TRACE_SPAN_ATTRIBUTE_SCHEMA="v0", CONSUL_HTTP_ADDR=CONSUL_HTTP_ADDR)
)
def test_schematize_service_name_v0(self):
key = "test/put/consul"
value = "test_value"
Expand All @@ -202,7 +211,9 @@ def test_schematize_service_name_v0(self):

assert span.service == "consul"

@TracerTestCase.run_in_subprocess(env_overrides=dict(DD_SERVICE="mysvc", DD_TRACE_SPAN_ATTRIBUTE_SCHEMA="v1"))
@TracerTestCase.run_in_subprocess(
env_overrides=dict(DD_SERVICE="mysvc", DD_TRACE_SPAN_ATTRIBUTE_SCHEMA="v1", CONSUL_HTTP_ADDR=CONSUL_HTTP_ADDR)
)
def test_schematize_service_name_v1(self):
key = "test/put/consul"
value = "test_value"
Expand All @@ -215,7 +226,7 @@ def test_schematize_service_name_v1(self):

assert span.service == "mysvc"

@TracerTestCase.run_in_subprocess(env_overrides=dict())
@TracerTestCase.run_in_subprocess(env_overrides=dict(CONSUL_HTTP_ADDR=CONSUL_HTTP_ADDR))
def test_schematize_unspecified_service_name_default(self):
key = "test/put/consul"
value = "test_value"
Expand All @@ -228,7 +239,9 @@ def test_schematize_unspecified_service_name_default(self):

assert span.service == "consul"

@TracerTestCase.run_in_subprocess(env_overrides=dict(DD_TRACE_SPAN_ATTRIBUTE_SCHEMA="v0"))
@TracerTestCase.run_in_subprocess(
env_overrides=dict(DD_TRACE_SPAN_ATTRIBUTE_SCHEMA="v0", CONSUL_HTTP_ADDR=CONSUL_HTTP_ADDR)
)
def test_schematize_unspecified_service_name_v0(self):
key = "test/put/consul"
value = "test_value"
Expand All @@ -241,7 +254,9 @@ def test_schematize_unspecified_service_name_v0(self):

assert span.service == "consul"

@TracerTestCase.run_in_subprocess(env_overrides=dict(DD_TRACE_SPAN_ATTRIBUTE_SCHEMA="v1"))
@TracerTestCase.run_in_subprocess(
env_overrides=dict(DD_TRACE_SPAN_ATTRIBUTE_SCHEMA="v1", CONSUL_HTTP_ADDR=CONSUL_HTTP_ADDR)
)
def test_schematize_unspecified_service_name_v1(self):
key = "test/put/consul"
value = "test_value"
Expand All @@ -254,7 +269,9 @@ def test_schematize_unspecified_service_name_v1(self):

assert span.service == DEFAULT_SPAN_SERVICE_NAME

@TracerTestCase.run_in_subprocess(env_overrides=dict(DD_TRACE_SPAN_ATTRIBUTE_SCHEMA="v0"))
@TracerTestCase.run_in_subprocess(
env_overrides=dict(DD_TRACE_SPAN_ATTRIBUTE_SCHEMA="v0", CONSUL_HTTP_ADDR=CONSUL_HTTP_ADDR)
)
def test_schematize_operation_name_v0(self):
key = "test/put/consul"
value = "test_value"
Expand All @@ -267,7 +284,9 @@ def test_schematize_operation_name_v0(self):

assert span.name == consulx.CMD

@TracerTestCase.run_in_subprocess(env_overrides=dict(DD_TRACE_SPAN_ATTRIBUTE_SCHEMA="v1"))
@TracerTestCase.run_in_subprocess(
env_overrides=dict(DD_TRACE_SPAN_ATTRIBUTE_SCHEMA="v1", CONSUL_HTTP_ADDR=CONSUL_HTTP_ADDR)
)
def test_schematize_operation_name_v1(self):
key = "test/put/consul"
value = "test_value"
Expand Down
9 changes: 9 additions & 0 deletions tests/contrib/suitespec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,9 @@ suites:
- '@consul'
- tests/contrib/consul/*
runner: riot
snapshot: true
services:
- consul
datastreams:
paths:
- '@bootstrap'
Expand Down Expand Up @@ -826,6 +829,9 @@ suites:
- tests/contrib/mariadb/*
- tests/snapshots/tests.contrib.mariadb.*
runner: riot
services:
- mariadb
snapshot: true
molten:
paths:
- '@bootstrap'
Expand All @@ -845,6 +851,9 @@ suites:
- '@mongo'
- tests/contrib/mongoengine/*
runner: riot
snapshot: true
services:
- mongo
mysqlpython:
paths:
- '@bootstrap'
Expand Down

0 comments on commit 2aa4ffb

Please sign in to comment.