Ejemplo n.º 1
0
def funcvalues(nullable=False):
    """Check clickhouse-odbc driver support for parameterized
    queries with functions and values using pyodbc connector.
    """
    with Logs() as logs, PyODBCConnection(logs=logs) as connection:
        args = {"connection": connection}

        run("Check support for isNull function", isNull, args=args, flags=TE)
        run("Check support for handling NULL value", Null, args=args, flags=TE)
Ejemplo n.º 2
0
def parameterized():
    """Test suite for clickhouse-odbc support of parameterized queries.
    """
    for dsn in ["clickhouse_localhost", "clickhouse_localhost_w"]:
        with Feature(f"{dsn}", flags=TE):
            os.environ["DSN"] = dsn
            run(test=load("parameterized.sanity", test="sanity"), flags=TE)
            run(test=load("parameterized.datatypes", test="datatypes"),
                flags=TE)
            run(test=load("parameterized.datatypes", test="nullable"),
                flags=TE)
            run(test=load("parameterized.funcvalues", test="funcvalues"),
                flags=TE)
Ejemplo n.º 3
0
                test_014,
                test_015,
                test_016,
                test_017,
                test_018,
                test_019,
                test_020,
            ]
            run_tests = all_tests

            # placeholder for selective test running
            # run_tests = [test_020]

            for t in run_tests:
                if callable(t):
                    run(test=t, flags=TE)
                else:
                    run(test=t[0], args=t[1], flags=TE)

        # python3 tests/test.py --only clickhouse*
        with Module("clickhouse", flags=TE):
            all_tests = [
                test_ch_001,
            ]

            run_test = all_tests

            # placeholder for selective test running
            # run_test = [test_009]

            for t in run_test:
Ejemplo n.º 4
0
@Name("Empty installation, creates 1 node")
def test_examples01_1():
    create_and_check("../docs/chi-examples/01-simple-layout-01-1shard-1repl.yaml", {"object_counts": [1,1,2]})

@TestScenario
@Name("1 shard 2 replicas")
def test_examples01_2():
    create_and_check("../docs/chi-examples/01-simple-layout-02-1shard-2repl.yaml", {"object_counts": [2,2,3]})

@TestScenario
@Name("Persistent volume mapping via defaults")
def test_examples02_1():
    create_and_check("../docs/chi-examples/03-persistent-volume-01-default-volume.yaml",
                     {"pod_count": 1,
                      "pod_volumes": {"/var/lib/clickhouse", "/var/log/clickhouse-server"}})

@TestScenario
@Name("Persistent volume mapping via podTemplate")
def test_examples02_2():
    create_and_check("../docs/chi-examples/03-persistent-volume-02-pod-template.yaml",
                     {"pod_count": 1,
                      "pod_image": "yandex/clickhouse-server:19.3.7",
                      "pod_volumes": {"/var/lib/clickhouse", "/var/log/clickhouse-server"}})


if main():
    with Module("examples", flags=TE):
        examples = [test_examples01_1, test_examples01_2, test_examples02_1, test_examples02_2]
        for t in examples:
            run(test=t, flags=TE)
                    "do_not_delete": 1
                }
            )
            clickhouse_operator_spec = kubectl.get(
                "pod", name="", ns=settings.operator_namespace, label="-l app=clickhouse-operator"
            )
            chi = kubectl.get("chi", ns=kubectl.namespace, name="test-cluster-for-alerts")

        with Module("metrics_alerts"):
            test_cases = [
                test_prometheus_setup,
                test_read_only_replica,
                test_replicas_max_abosulute_delay,
                test_metrics_exporter_down,
                test_clickhouse_dns_errors,
                test_distributed_connection_exceptions,
                test_delayed_and_rejected_insert_and_max_part_count_for_partition_and_low_inserted_rows_per_query,
                test_too_many_connections,
                test_too_much_running_queries,
                test_longest_running_query,
                test_system_settings_changed,
                test_version_changed,
                test_zookeeper_hardware_exceptions,
                test_distributed_sync_insertion_timeout,
                test_distributed_files_to_insert,
                test_clickhouse_server_reboot,
                test_zookeeper_alerts,
            ]
            for t in test_cases:
                run(test=t)
Ejemplo n.º 6
0
                test_operator.test_020,
                test_operator.test_021,
                test_operator.test_022,
                test_operator.test_023,
                test_operator.test_024,
                test_operator.test_025,
            ]
            run_tests = all_tests

            # placeholder for selective test running
            # run_tests = [test_008, (test_009, {"version_from": "0.9.10"})]
            # run_tests = [test_002]

            for t in run_tests:
                if callable(t):
                    run(test=t)
                else:
                    run(test=t[0], args=t[1])

        # python3 tests/test.py --only clickhouse*
        with Module("clickhouse"):
            all_tests = [
                test_clickhouse.test_ch_001,
                test_clickhouse.test_ch_002,
            ]

            run_test = all_tests

            # placeholder for selective test running
            # run_test = [test_ch_002]
Ejemplo n.º 7
0
def regression():
    """The regression module for clickhouse-odbc driver.
    """
    run(test=parameterized, flags=TE)
Ejemplo n.º 8
0
        "/regression/parameterized/:/nullable/datatypes/String/utf8": [
            (Fail, "Known failure")
        ],
        "/regression/parameterized/:/nullable/datatypes/String/ascii": [
            (Fail, "Known failure")
        ],
        "/regression/parameterized/:/nullable/datatypes/FixedString/utf8": [
            (Fail, "Known failure")
        ],
        "/regression/parameterized/:/nullable/datatypes/FixedString/ascii": [
            (Fail, "Known failure")
        ],
        "/regression/parameterized/:/nullable/datatypes/Enum/utf8": [
            (Fail, "Known failure")
        ],
        "/regression/parameterized/:/nullable/datatypes/Enum/ascii": [
            (Fail, "Known failure")
        ],
        "/regression/parameterized/:/functions and values/Null": [
            (Fail, "Known failure")
        ],
        "/regression/parameterized/clickhouse_localhost_w/datatypes/String/utf8":
        [(Fail, "Known failure")],
        "/regression/parameterized/clickhouse_localhost_w/datatypes/FixedString/utf8":
        [(Fail, "Known failure")],
        "/regression/parameterized/clickhouse_localhost_w/datatypes/Enum/utf8":
        [(Fail, "Known failure")]
    }

    run(test=regression, xfails=xfails)
Ejemplo n.º 9
0
def datatypes(nullable=False):
    """Check clickhouse-odbc driver support for parameterized
    queries with various data types using pyodbc connector.
    """
    with Logs() as logs, PyODBCConnection(logs=logs) as connection:
        args = {"connection": connection, "nullable": nullable}

        run("Sanity check", sanity_check, args={"connection": connection})
        run("Check support for Int8", Int8, args=args, flags=TE)
        run("Check support for Int16", Int16, args=args, flags=TE)
        run("Check support for Int32", Int32, args=args, flags=TE)
        run("Check support for Int64", Int64, args=args, flags=TE)
        run("Check support for UInt8", UInt8, args=args, flags=TE)
        run("Check support for UInt16", UInt16, args=args, flags=TE)
        run("Check support for UInt32", UInt32, args=args, flags=TE)
        run("Check support for UInt64", UInt64, args=args, flags=TE)
        run("Check support for Float32", Float32, args=args, flags=TE)
        run("Check support for Float64", Float64, args=args, flags=TE)
        run("Check support for Decimal32", Decimal32, args=args, flags=TE)
        run("Check support for Decimal64", Decimal64, args=args, flags=TE)
        run("Check support for Decimal128", Decimal128, args=args, flags=TE)
        run("Check support for String", String, args=args, flags=TE)
        run("Check support for FixedString", FixedString, args=args, flags=TE)
        run("Check support for Date", Date, args=args, flags=TE)
        run("Check support for DateTime", DateTime, args=args, flags=TE)
        run("Check support for Enum", Enum, args=args, flags=TE)
        run("Check support for UUID", UUID, args=args, flags=TE)
        run("Check support for IPv4", IPv4, args=args, flags=TE)
        run("Check support for IPv6", IPv6, args=args, flags=TE)