# distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import json import logging import pytest from streamsets.sdk.utils import Version from streamsets.testframework.markers import cluster, sdc_min_version from streamsets.testframework.sdc import DataCollector from streamsets.testframework.utils import parse_multi_versions, parse_version_git_hash, wait_for_condition # Skip all tests in this module if --sdc-version < 3.1.0.0 pytestmark = sdc_min_version('3.1.0.0') logger = logging.getLogger(__name__) # Set of properties that needs to be enabled to perform the validation as we need to ENABLE_CLASSPATH_VALIDATION = { # Make sure that the validation is enabled 'stagelibs.classpath.validation.enable': 'true', # But never die, this test will validate result over REST 'stagelibs.classpath.validation.terminate': 'false' } # List of stage libraries that have their own tests rather then the generic one EXCLUDE_LIBS = { # Disable all MapR by default 'streamsets-datacollector-mapr_5_1-lib',
# See the License for the specific language governing permissions and # limitations under the License. # This module starts SDC with only default stage libs like basic and runs pipelines for tests. import logging import pytest from streamsets.sdk.exceptions import BadRequestError from streamsets.testframework.markers import registration, sdc_min_version from .utils.utils_activation import ACTIVATION_SUPPORT_SDC_MIN_VERSION, register_sdc # Skip all tests in this module if --sdc-version < 3.15.0 pytestmark = sdc_min_version(ACTIVATION_SUPPORT_SDC_MIN_VERSION) logger = logging.getLogger(__name__) REGISTRATION_MAX_ATTEMPTS = 3 @registration def test_with_basic_stage_too_many_registrations(sdc_executor): """ Attempt to register more than the maximum allowed and verify the error message. """ for _ in range(REGISTRATION_MAX_ATTEMPTS): register_sdc(sdc_executor) with pytest.raises(BadRequestError) as http_error: register_sdc(sdc_executor)
# distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import json import logging import pytest from streamsets.sdk.utils import Version from streamsets.testframework.markers import cluster, sdc_min_version from streamsets.testframework.sdc import DataCollector from streamsets.testframework.utils import parse_multi_versions, parse_version_git_hash, wait_for_condition # Skip all tests in this module if --sdc-version < 3.1.0.0 pytestmark = sdc_min_version('3.1.0.0-SNAPSHOT') logger = logging.getLogger(__name__) # Set of properties that needs to be enabled to perform the validation as we need to ENABLE_CLASSPATH_VALIDATION = { # Make sure that the validation is enabled 'stagelibs.classpath.validation.enable': 'true', # But never die, this test will validate result over REST 'stagelibs.classpath.validation.terminate': 'false' } # List of stage libraries that have their own tests rather then the generic one EXCLUDE_LIBS = { # Disable all MapR by default 'streamsets-datacollector-mapr_5_1-lib',
# # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import http.client import pytest from streamsets.testframework.markers import sdc_min_version pytestmark = sdc_min_version('3.8.0') # Main SDC WebServerTask should refuse connection requests # using HTTP methods TRACK and TRACE @pytest.mark.parametrize(('method'), ['TRACK', 'TRACE']) def test_restricted_http_methods(sdc_executor, method): h1 = http.client.HTTPConnection( sdc_executor.api_client.server_url.split('://')[-1]) h1.request(method, '/') resp = h1.getresponse() assert resp.status == 405
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import logging import json import pytest from javaproperties import Properties from streamsets.sdk import sdc_models from streamsets.testframework.markers import sdc_min_version from uuid import uuid4 # Skip all tests in this module if --sdc-version < 2.6.0.0-SNAPSHOT pytestmark = sdc_min_version('2.6.0.0-SNAPSHOT') logger = logging.getLogger(__name__) # Test pipeline (simple generator -> trash) @pytest.fixture(scope='module') def pipeline(sdc_executor): builder = sdc_executor.get_pipeline_builder() generator = builder.add_stage(label='Dev Data Generator') trash = builder.add_stage(label='Trash') generator >> trash pipeline = builder.build(title='Simply the simplest pipeline')
# See the License for the specific language governing permissions and # limitations under the License. import json import logging import string import time from datetime import timezone import pytest from streamsets.testframework.markers import influxdb2, sdc_min_version from streamsets.testframework.utils import get_random_string logger = logging.getLogger(__name__) pytestmark = [influxdb2, sdc_min_version('4.2.0')] RAW_DATA = [{ 'measurement': get_random_string(string.ascii_letters, 10), 'record': { 'time': round(time.time() * 1000), 'butterflies': 12, 'location': '1', 'scientist': 'langstroth' } }, { 'measurement': get_random_string(string.ascii_letters, 10), 'record': { 'time': round(time.time() * 1000), 'butterflies': 8, 'location': '2',