示例#1
0
    def __init__(self, test_scenario):
        assert test_scenario

        super(DTLiveScenarioTest, self).__init__(test_scenario)
        self.settings = DynamoSettings(
            opt_env_set=["azext_iot_testrg", "azext_dt_region"])
        self.embedded_cli = EmbeddedCLI()
        self._bootup_scenario()
示例#2
0
import os
import pytest
from time import sleep

from azext_iot.tests import IoTLiveScenarioTest
from azext_iot.tests.settings import DynamoSettings, ENV_SET_TEST_IOTHUB_BASIC
from azext_iot.common.utility import ensure_iothub_sdk_min_version

from azext_iot.tests.generators import generate_generic_id
# TODO: assert DEVICE_DEVICESCOPE_PREFIX format in parent device twin.
from azext_iot.constants import IOTHUB_TRACK_2_SDK_MIN_VERSION

opt_env_set = ["azext_iot_teststorageuri", "azext_iot_identity_teststorageid"]

settings = DynamoSettings(req_env_set=ENV_SET_TEST_IOTHUB_BASIC,
                          opt_env_set=opt_env_set)

LIVE_HUB = settings.env.azext_iot_testhub
LIVE_RG = settings.env.azext_iot_testrg

# Set this environment variable to your empty blob container sas uri to test device export and enable file upload test.
# For file upload, you will need to have configured your IoT Hub before running.
LIVE_STORAGE_URI = settings.env.azext_iot_teststorageuri

# Set this environment variable to enable identity-based integration tests
# You will need permissions to add and remove role assignments for this storage account
LIVE_STORAGE_RESOURCE_ID = settings.env.azext_iot_identity_teststorageid

CWD = os.path.dirname(os.path.abspath(__file__))

user_managed_identity_name = generate_generic_id()
示例#3
0
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

import pytest
import json

from time import time
from uuid import uuid4
from azext_iot.tests import IoTLiveScenarioTest, PREFIX_DEVICE
from azext_iot.tests.settings import DynamoSettings, ENV_SET_TEST_IOTHUB_BASIC
from azext_iot.common.utility import (validate_min_python_version,
                                      execute_onthread,
                                      calculate_millisec_since_unix_epoch_utc,
                                      validate_key_value_pairs)

settings = DynamoSettings(ENV_SET_TEST_IOTHUB_BASIC)
LIVE_HUB = settings.env.azext_iot_testhub
LIVE_RG = settings.env.azext_iot_testrg

LIVE_CONSUMER_GROUPS = ["test1", "test2", "test3"]


class TestIoTHubMessaging(IoTLiveScenarioTest):
    def __init__(self, test_case):
        super(TestIoTHubMessaging, self).__init__(test_case, LIVE_HUB, LIVE_RG)

    def test_uamqp_device_messaging(self):
        device_count = 1
        device_ids = self.generate_device_names(device_count)

        self.cmd(
)

logger = get_logger(__name__)

resource_test_env_vars = [
    "azext_dt_ep_eventhub_namespace",
    "azext_dt_ep_eventhub_policy",
    "azext_dt_ep_eventhub_topic",
    "azext_dt_ep_servicebus_namespace",
    "azext_dt_ep_servicebus_policy",
    "azext_dt_ep_servicebus_topic",
    "azext_dt_ep_eventgrid_topic",
    "azext_dt_ep_rg",
]

settings = DynamoSettings(opt_env_set=resource_test_env_vars)
run_resource_tests = False
run_endpoint_route_tests = False

if all([
        settings.env.azext_dt_ep_eventhub_namespace,
        settings.env.azext_dt_ep_eventhub_policy,
        settings.env.azext_dt_ep_eventhub_topic,
        settings.env.azext_dt_ep_servicebus_namespace,
        settings.env.azext_dt_ep_servicebus_policy,
        settings.env.azext_dt_ep_servicebus_topic,
        settings.env.azext_dt_ep_eventgrid_topic,
        settings.env.azext_dt_ep_rg,
]):
    run_endpoint_route_tests = True