def test_running_on_macos_ci(): with mock.patch.dict(os.environ, { 'SYSTEM_TEAMFOUNDATIONCOLLECTIONURI': 'url', 'AGENT_OS': 'Darwin' }): assert running_on_ci() is True assert running_on_macos_ci() is True
def __call__(self): if not ON_WINDOWS: user = getpass.getuser() chown_args = ['chown', user, self.token_file] if user != 'root' and running_on_ci(): chown_args.insert(0, 'sudo') run_command(chown_args, check=True)
from datadog_checks.dev import get_docker_hostname, get_here from datadog_checks.dev.ci import running_on_ci from datadog_checks.dev.utils import ON_WINDOWS HERE = get_here() COMPOSE_FILE = os.path.join(HERE, 'docker', 'docker-compose.yaml') SERVER = get_docker_hostname() ACE_SERVER_NAME = 'ACESERVER' # https://www.ibm.com/docs/en/app-connect/containers_cd?topic=obtaining-app-connect-enterprise-server-image-from-cloud-container-registry#acedevimages DOCKER_IMAGE_PREFIX = 'icr.io/appc-dev/ace-server@sha256:' DOCKER_IMAGE_VERSIONS = { '12.0.3.0-r1': f'{DOCKER_IMAGE_PREFIX}9c0ab33cf01233b52e1273e559c1b1daa2f23282430ecd2c48001fc0469132f3', } E2E_METADATA = { 'docker_volumes': ['{}/agent_scripts/start_commands.sh:/tmp/start_commands.sh'.format(HERE)], 'start_commands': ['bash /tmp/start_commands.sh'], 'env_vars': { 'LD_LIBRARY_PATH': '/opt/mqm/lib64:/opt/mqm/lib', 'C_INCLUDE_PATH': '/opt/mqm/inc' }, } skip_windows_ci = pytest.mark.skipif( ON_WINDOWS and running_on_ci(), reason='MQ cannot be setup on Windows VMs in CI')
# (C) Datadog, Inc. 2022-present # All rights reserved # Licensed under a 3-clause BSD style license (see LICENSE) import os import re from copy import deepcopy from datadog_checks.dev import get_here from datadog_checks.dev.ci import running_on_ci from datadog_checks.dev.utils import get_tox_env HERE = get_here() CHECK_NAME = 'teradata' TOX_ENV = get_tox_env() ON_CI = running_on_ci() TERADATA_SERVER = os.environ.get('TERADATA_SERVER') TERADATA_DD_USER = os.environ.get('TERADATA_DD_USER') TERADATA_DD_PW = os.environ.get('TERADATA_DD_PW') USE_TD_SANDBOX = os.environ.get('USE_TD_SANDBOX') TABLE_EXTRACTION_PATTERN = re.compile(r'SELECT .* FROM \w+\.(\w+)') SERVICE_CHECK_CONNECT = 'teradata.can_connect' SERVICE_CHECK_QUERY = 'teradata.can_query' EXPECTED_TAGS = [ 'teradata_server:tdserver', 'teradata_port:1025', 'td_env:dev' ] CONFIG = {
import os import pytest from datadog_checks.dev import get_docker_hostname from datadog_checks.dev.ci import running_on_ci from datadog_checks.dev.utils import ON_WINDOWS # Ignore missing library to not require it for e2e try: from datadog_checks.ibm_mq.metrics import COUNT, GAUGE except ImportError: COUNT = GAUGE = '' RUNNING_ON_WINDOWS_CI = ON_WINDOWS and running_on_ci() skip_windows_ci = pytest.mark.skipif( RUNNING_ON_WINDOWS_CI, reason='MQ server cannot be setup on Windows VMs in CI') HERE = os.path.dirname(os.path.abspath(__file__)) COMPOSE_DIR = os.path.join(HERE, 'compose') HOST = get_docker_hostname() PORT = '11414' USERNAME = '******' PASSWORD = '******' QUEUE_MANAGER = 'QM1' CHANNEL = 'DEV.ADMIN.SVRCONN'
def test_not_running_ci(): with EnvVars(ignore=['SYSTEM_TEAMFOUNDATIONCOLLECTIONURI']): with mock.patch.dict(os.environ, {'AGENT_OS': 'Linux'}): assert running_on_ci() is False assert running_on_linux_ci() is False