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

Support for TPM Using PyOpenSSL with Azure IoT SDK #1194

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Add TPM support PyOpenSSL/PKCS#11

8fed995
Select commit
Loading
Failed to load commit list.
Draft

Support for TPM Using PyOpenSSL with Azure IoT SDK #1194

Add TPM support PyOpenSSL/PKCS#11
8fed995
Select commit
Loading
Failed to load commit list.
Azure Pipelines / Azure.azure-iot-sdk-python failed Sep 6, 2024 in 3m 7s

Build #20240906.1 had test failures

Details

Tests

  • Failed: 222 (1.36%)
  • Passed: 16,047 (98.60%)
  • Other: 6 (0.04%)
  • Total: 16,275

Annotations

Check failure on line 64 in Build log

See this annotation in the file changed.

@azure-pipelines azure-pipelines / Azure.azure-iot-sdk-python

Build log #L64

Bash exited with code '2'.

Check failure on line 64 in Build log

See this annotation in the file changed.

@azure-pipelines azure-pipelines / Azure.azure-iot-sdk-python

Build log #L64

Bash exited with code '2'.

Check failure on line 7719 in Build log

See this annotation in the file changed.

@azure-pipelines azure-pipelines / Azure.azure-iot-sdk-python

Build log #L7719

Bash exited with code '1'.

Check failure on line 7719 in Build log

See this annotation in the file changed.

@azure-pipelines azure-pipelines / Azure.azure-iot-sdk-python

Build log #L7719

Bash exited with code '1'.

Check failure on line 1 in test_creates_transport[Using Gateway Hostname]

See this annotation in the file changed.

@azure-pipelines azure-pipelines / Azure.azure-iot-sdk-python

test_creates_transport[Using Gateway Hostname]

AssertionError: assert call(hostname...56814545936'>) == call(hostname...56814545936'>)
  Use -v to get more diff
Raw output
self = <tests.unit.common.pipeline.test_pipeline_stages_http.TestHTTPTransportStageRunOpCalledWithInitializePipelineOperation object at 0x7f9018e5a250>
mocker = <pytest_mock.plugin.MockerFixture object at 0x7f901558a850>
stage = <azure.iot.device.common.pipeline.pipeline_stages_http.HTTPTransportStage object at 0x7f90156e3f90>
op = <azure.iot.device.common.pipeline.pipeline_ops_base.InitializePipelineOperation object at 0x7f9015a30310>
mock_transport = <MagicMock name='HTTPTransport' spec='HTTPTransport' id='140256809967312'>
gateway_hostname = 'fake.gateway.hostname.com'

    @pytest.mark.it(
        "Creates an HTTPTransport object and sets it as the 'transport' attribute of the stage (and on the pipeline root)"
    )
    @pytest.mark.parametrize(
        "gateway_hostname",
        [
            pytest.param("fake.gateway.hostname.com", id="Using Gateway Hostname"),
            pytest.param(None, id="Not using Gateway Hostname"),
        ],
    )
    def test_creates_transport(self, mocker, stage, op, mock_transport, gateway_hostname):
        # Setup pipeline config
        stage.nucleus.pipeline_configuration.gateway_hostname = gateway_hostname
    
        # NOTE: if more of this type of logic crops up, consider splitting this test up
        if stage.nucleus.pipeline_configuration.gateway_hostname:
            expected_hostname = stage.nucleus.pipeline_configuration.gateway_hostname
        else:
            expected_hostname = stage.nucleus.pipeline_configuration.hostname
    
        assert stage.transport is None
    
        stage.run_op(op)
    
        assert mock_transport.call_count == 1
>       assert mock_transport.call_args == mocker.call(
            hostname=expected_hostname,
            server_verification_cert=stage.nucleus.pipeline_configuration.server_verification_cert,
            x509_cert=stage.nucleus.pipeline_configuration.x509,
            cipher=stage.nucleus.pipeline_configuration.cipher,
            proxy_options=stage.nucleus.pipeline_configuration.proxy_options,
        )
E       AssertionError: assert call(hostname...56814545936'>) == call(hostname...56814545936'>)
E         Use -v to get more diff

tests/unit/common/pipeline/test_pipeline_stages_http.py:113: AssertionError

Check failure on line 1 in test_creates_transport[Not using Gateway Hostname]

See this annotation in the file changed.

@azure-pipelines azure-pipelines / Azure.azure-iot-sdk-python

test_creates_transport[Not using Gateway Hostname]

AssertionError: assert call(hostname...56810250704'>) == call(hostname...56810250704'>)
  Use -v to get more diff
Raw output
self = <tests.unit.common.pipeline.test_pipeline_stages_http.TestHTTPTransportStageRunOpCalledWithInitializePipelineOperation object at 0x7f9018e5a090>
mocker = <pytest_mock.plugin.MockerFixture object at 0x7f90156e2010>
stage = <azure.iot.device.common.pipeline.pipeline_stages_http.HTTPTransportStage object at 0x7f90173e10d0>
op = <azure.iot.device.common.pipeline.pipeline_ops_base.InitializePipelineOperation object at 0x7f90155c9810>
mock_transport = <MagicMock name='HTTPTransport' spec='HTTPTransport' id='140256810369744'>
gateway_hostname = None

    @pytest.mark.it(
        "Creates an HTTPTransport object and sets it as the 'transport' attribute of the stage (and on the pipeline root)"
    )
    @pytest.mark.parametrize(
        "gateway_hostname",
        [
            pytest.param("fake.gateway.hostname.com", id="Using Gateway Hostname"),
            pytest.param(None, id="Not using Gateway Hostname"),
        ],
    )
    def test_creates_transport(self, mocker, stage, op, mock_transport, gateway_hostname):
        # Setup pipeline config
        stage.nucleus.pipeline_configuration.gateway_hostname = gateway_hostname
    
        # NOTE: if more of this type of logic crops up, consider splitting this test up
        if stage.nucleus.pipeline_configuration.gateway_hostname:
            expected_hostname = stage.nucleus.pipeline_configuration.gateway_hostname
        else:
            expected_hostname = stage.nucleus.pipeline_configuration.hostname
    
        assert stage.transport is None
    
        stage.run_op(op)
    
        assert mock_transport.call_count == 1
>       assert mock_transport.call_args == mocker.call(
            hostname=expected_hostname,
            server_verification_cert=stage.nucleus.pipeline_configuration.server_verification_cert,
            x509_cert=stage.nucleus.pipeline_configuration.x509,
            cipher=stage.nucleus.pipeline_configuration.cipher,
            proxy_options=stage.nucleus.pipeline_configuration.proxy_options,
        )
E       AssertionError: assert call(hostname...56810250704'>) == call(hostname...56810250704'>)
E         Use -v to get more diff

tests/unit/common/pipeline/test_pipeline_stages_http.py:113: AssertionError

Check failure on line 1 in test_creates_transport[Pipeline configured for custom keep alive-Using Gateway Hostname-Proxy present-Pipeline configured for custom cipher-Pipeline configured for websockets]

See this annotation in the file changed.

@azure-pipelines azure-pipelines / Azure.azure-iot-sdk-python

test_creates_transport[Pipeline configured for custom keep alive-Using Gateway Hostname-Proxy present-Pipeline configured for custom cipher-Pipeline configured for websockets]

assert call(client_i...eep_alive=900) == call(client_i...eep_alive=900)
  Use -v to get more diff
Raw output
self = <tests.unit.common.pipeline.test_pipeline_stages_mqtt.TestMQTTTransportStageRunOpCalledWithInitializePipelineOperation object at 0x7f9019df2710>
mocker = <pytest_mock.plugin.MockerFixture object at 0x7f9015497210>
stage = <azure.iot.device.common.pipeline.pipeline_stages_mqtt.MQTTTransportStage object at 0x7f9015484b10>
op = <azure.iot.device.common.pipeline.pipeline_ops_base.InitializePipelineOperation object at 0x7f90155f1710>
mock_transport = <MagicMock name='MQTTTransport' spec='MQTTTransport' id='140256810574416'>
websockets = True, cipher = 'DHE-RSA-AES128-SHA', proxy_options = 'FAKE-PROXY'
gateway_hostname = 'fake.gateway.hostname.com', keep_alive = 900

    @pytest.mark.it(
        "Creates an MQTTTransport object and sets it as the 'transport' attribute of the stage"
    )
    @pytest.mark.parametrize(
        "websockets",
        [
            pytest.param(True, id="Pipeline configured for websockets"),
            pytest.param(False, id="Pipeline NOT configured for websockets"),
        ],
    )
    @pytest.mark.parametrize(
        "cipher",
        [
            pytest.param("DHE-RSA-AES128-SHA", id="Pipeline configured for custom cipher"),
            pytest.param(
                "DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA:ECDHE-ECDSA-AES128-GCM-SHA256",
                id="Pipeline configured for multiple custom ciphers",
            ),
            pytest.param("", id="Pipeline NOT configured for custom cipher(s)"),
        ],
    )
    @pytest.mark.parametrize(
        "proxy_options",
        [
            pytest.param("FAKE-PROXY", id="Proxy present"),
            pytest.param(None, id="Proxy None"),
            pytest.param("", id="Proxy Absent"),
        ],
    )
    @pytest.mark.parametrize(
        "gateway_hostname",
        [
            pytest.param("fake.gateway.hostname.com", id="Using Gateway Hostname"),
            pytest.param(None, id="Not using Gateway Hostname"),
        ],
    )
    @pytest.mark.parametrize(
        "keep_alive",
        [
            pytest.param(900, id="Pipeline configured for custom keep alive"),
            pytest.param(None, id="Pipeline NOT configured for custom keep alive"),
        ],
    )
    def test_creates_transport(
        self,
        mocker,
        stage,
        op,
        mock_transport,
        websockets,
        cipher,
        proxy_options,
        gateway_hostname,
        keep_alive,
    ):
        # Configure websockets & cipher & keep alive
        stage.nucleus.pipeline_configuration.websockets = websockets
        stage.nucleus.pipeline_configuration.cipher = cipher
        stage.nucleus.pipeline_configuration.proxy_options = proxy_options
        stage.nucleus.pipeline_configuration.gateway_hostname = gateway_hostname
        stage.nucleus.pipeline_configuration.keep_alive = keep_alive
    
        # NOTE: if more of this type of logic crops up, consider splitting this test up
        if stage.nucleus.pipeline_configuration.gateway_hostname:
            expected_hostname = stage.nucleus.pipeline_configuration.gateway_hostname
        else:
            expected_hostname = stage.nucleus.pipeline_configuration.hostname
    
        assert stage.transport is None
    
        stage.run_op(op)
    
        assert mock_transport.call_count == 1
>       assert mock_transport.call_args == mocker.call(
            client_id=op.client_id,
            hostname=expected_hostname,
            username=op.username,
            server_verification_cert=stage.nucleus.pipeline_configuration.server_verification_cert,
            x509_cert=stage.nucleus.pipeline_configuration.x509,
            websockets=websockets,
            cipher=cipher,
            proxy_options=proxy_options,
            keep_alive=keep_alive,
        )
E       assert call(client_i...eep_alive=900) == call(client_i...eep_alive=900)
E         Use -v to get more diff

tests/unit/common/pipeline/test_pipeline_stages_mqtt.py:180: AssertionError

Check failure on line 1 in test_creates_transport[Pipeline configured for custom keep alive-Using Gateway Hostname-Proxy present-Pipeline configured for custom cipher-Pipeline NOT configured for websockets]

See this annotation in the file changed.

@azure-pipelines azure-pipelines / Azure.azure-iot-sdk-python

test_creates_transport[Pipeline configured for custom keep alive-Using Gateway Hostname-Proxy present-Pipeline configured for custom cipher-Pipeline NOT configured for websockets]

assert call(client_i...eep_alive=900) == call(client_i...eep_alive=900)
  Use -v to get more diff
Raw output
self = <tests.unit.common.pipeline.test_pipeline_stages_mqtt.TestMQTTTransportStageRunOpCalledWithInitializePipelineOperation object at 0x7f9019df25d0>
mocker = <pytest_mock.plugin.MockerFixture object at 0x7f9015753c10>
stage = <azure.iot.device.common.pipeline.pipeline_stages_mqtt.MQTTTransportStage object at 0x7f90157506d0>
op = <azure.iot.device.common.pipeline.pipeline_ops_base.InitializePipelineOperation object at 0x7f901556cad0>
mock_transport = <MagicMock name='MQTTTransport' spec='MQTTTransport' id='140256811924496'>
websockets = False, cipher = 'DHE-RSA-AES128-SHA', proxy_options = 'FAKE-PROXY'
gateway_hostname = 'fake.gateway.hostname.com', keep_alive = 900

    @pytest.mark.it(
        "Creates an MQTTTransport object and sets it as the 'transport' attribute of the stage"
    )
    @pytest.mark.parametrize(
        "websockets",
        [
            pytest.param(True, id="Pipeline configured for websockets"),
            pytest.param(False, id="Pipeline NOT configured for websockets"),
        ],
    )
    @pytest.mark.parametrize(
        "cipher",
        [
            pytest.param("DHE-RSA-AES128-SHA", id="Pipeline configured for custom cipher"),
            pytest.param(
                "DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA:ECDHE-ECDSA-AES128-GCM-SHA256",
                id="Pipeline configured for multiple custom ciphers",
            ),
            pytest.param("", id="Pipeline NOT configured for custom cipher(s)"),
        ],
    )
    @pytest.mark.parametrize(
        "proxy_options",
        [
            pytest.param("FAKE-PROXY", id="Proxy present"),
            pytest.param(None, id="Proxy None"),
            pytest.param("", id="Proxy Absent"),
        ],
    )
    @pytest.mark.parametrize(
        "gateway_hostname",
        [
            pytest.param("fake.gateway.hostname.com", id="Using Gateway Hostname"),
            pytest.param(None, id="Not using Gateway Hostname"),
        ],
    )
    @pytest.mark.parametrize(
        "keep_alive",
        [
            pytest.param(900, id="Pipeline configured for custom keep alive"),
            pytest.param(None, id="Pipeline NOT configured for custom keep alive"),
        ],
    )
    def test_creates_transport(
        self,
        mocker,
        stage,
        op,
        mock_transport,
        websockets,
        cipher,
        proxy_options,
        gateway_hostname,
        keep_alive,
    ):
        # Configure websockets & cipher & keep alive
        stage.nucleus.pipeline_configuration.websockets = websockets
        stage.nucleus.pipeline_configuration.cipher = cipher
        stage.nucleus.pipeline_configuration.proxy_options = proxy_options
        stage.nucleus.pipeline_configuration.gateway_hostname = gateway_hostname
        stage.nucleus.pipeline_configuration.keep_alive = keep_alive
    
        # NOTE: if more of this type of logic crops up, consider splitting this test up
        if stage.nucleus.pipeline_configuration.gateway_hostname:
            expected_hostname = stage.nucleus.pipeline_configuration.gateway_hostname
        else:
            expected_hostname = stage.nucleus.pipeline_configuration.hostname
    
        assert stage.transport is None
    
        stage.run_op(op)
    
        assert mock_transport.call_count == 1
>       assert mock_transport.call_args == mocker.call(
            client_id=op.client_id,
            hostname=expected_hostname,
            username=op.username,
            server_verification_cert=stage.nucleus.pipeline_configuration.server_verification_cert,
            x509_cert=stage.nucleus.pipeline_configuration.x509,
            websockets=websockets,
            cipher=cipher,
            proxy_options=proxy_options,
            keep_alive=keep_alive,
        )
E       assert call(client_i...eep_alive=900) == call(client_i...eep_alive=900)
E         Use -v to get more diff

tests/unit/common/pipeline/test_pipeline_stages_mqtt.py:180: AssertionError