Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add gssapi as a dependency #11725

Merged
merged 19 commits into from
Mar 31, 2022
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

set -ex

sudo apt-get update
sudo apt install build-essential
sudo apt-get install -y --no-install-recommends libkrb5-dev

set +ex
1 change: 1 addition & 0 deletions LICENSE-3rdparty.csv
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ flup-py3,Vendor,BSD-3-Clause,Allan Saddi
foundationdb,PyPI,Apache-2.0,FoundationDB
futures,PyPI,PSF,Brian Quinlan
gearman,PyPI,Apache-2.0,Matthew Tai
gssapi,PyPI,ISC,The Python GSSAPI Team
immutables,PyPI,Apache-2.0,MagicStack Inc
in-toto,PyPI,Apache-2.0,New York University: Secure Systems Lab
ipaddress,PyPI,PSF,Philipp Hagemeister
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ enum34==1.1.10; python_version < '3.0'
foundationdb==6.3.24; python_version > '3.0'
futures==3.3.0; python_version < '3.0'
gearman==2.0.2; sys_platform != 'win32' and python_version < '3.0'
gssapi==1.6.1; python_version < '3.0'
gssapi==1.7.3; python_version > '3.0'
immutables==0.16; python_version > '3.0'
in-toto==1.0.1
ipaddress==1.0.23; python_version < '3.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
'adodbapi': ['LGPL-2.1-only'],
# https://github.com/rthalley/dnspython/blob/master/LICENSE
'dnspython': ['ISC'],
# https://github.com/pythongssapi/python-gssapi/blob/main/LICENSE.txt
'gssapi': ['ISC'],
# https://github.com/cannatag/ldap3/blob/dev/COPYING.txt
'ldap3': ['LGPL-3.0-only'],
# https://github.com/paramiko/paramiko/blob/master/LICENSE
Expand Down
2 changes: 2 additions & 0 deletions kafka_consumer/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ dynamic = [

[project.optional-dependencies]
deps = [
"gssapi==1.6.1; python_version < '3.0'",
"gssapi==1.7.3; python_version > '3.0'",
"kafka-python==2.0.2",
"kazoo==2.8.0",
]
Expand Down
11 changes: 10 additions & 1 deletion kafka_consumer/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,16 @@ def dd_environment(mock_local_kafka_hosts_dns, e2e_instance):
'KAFKA_HOST': HOST_IP
},
):
yield e2e_instance, {'custom_hosts': [('kafka1', '127.0.0.1'), ('kafka2', '127.0.0.1')]}
yield e2e_instance, E2E_METADATA


E2E_METADATA = {
'custom_hosts': [('kafka1', '127.0.0.1'), ('kafka2', '127.0.0.1')],
'start_commands': [
'apt-get update',
'apt-get install -y build-essential',
],
}


@pytest.fixture(scope='session')
Expand Down
14 changes: 14 additions & 0 deletions kafka_consumer/tests/test_kafka_consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,20 @@ def test_uses_new_implementation_when_new_version_specified(kafka_instance):
assert isinstance(kafka_consumer_check.sub_check, NewKafkaConsumerCheck)


@pytest.mark.unit
def test_gssapi(kafka_instance, dd_run_check):
instance = copy.deepcopy(kafka_instance)
instance['kafka_client_api_version'] = '0.10.2'
instance['sasl_mechanism'] = 'GSSAPI'
instance['security_protocol'] = 'SASL_PLAINTEXT'
instance['sasl_kerberos_service_name'] = 'kafka'
kafka_consumer_check = KafkaCheck('kafka_consumer', {}, [instance])
# assert the check doesn't fail with:
# Exception: Could not find main GSSAPI shared library.
with pytest.raises(Exception, match='check_version'):
dd_run_check(kafka_consumer_check)


@pytest.mark.unit
def test_tls_config_ok(kafka_instance_tls):
with mock.patch('datadog_checks.base.utils.tls.ssl') as ssl:
Expand Down
2 changes: 1 addition & 1 deletion kafka_consumer/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ passenv =
COMPOSE*
extras = deps
deps =
-e../datadog_checks_base[deps]
-e../datadog_checks_base[deps,http]
Copy link
Contributor

Choose a reason for hiding this comment

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

?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

my bad, fixed!

-rrequirements-dev.txt
-e../datadog_checks_tests_helper
commands =
Expand Down