Skip to content

Commit

Permalink
change smoke test dependency to proton-driver
Browse files Browse the repository at this point in the history
  • Loading branch information
qijun-niu-timeplus committed Sep 14, 2023
1 parent 6424081 commit 8278265
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 58 deletions.
44 changes: 2 additions & 42 deletions tests/stream/ci_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,7 @@
)

PROTON_PYTHON_DRIVER_S3_BUCKET_NAME = "tp-internal"
PROTON_PYTHON_DIRVER_S3_OBJ_NAME = (
"proton/proton-python-driver/clickhouse-driver-0.2.4.tar.gz"
)
PROTON_PYTHON_DRIVER_FILE_NAME = "clickhouse-driver-0.2.4.tar.gz"
PROTON_PYTHON_DRIVER_NANME = "clickhouse-driver"
PROTON_PYTHON_DRIVER_NANME = "proton-driver"

cur_dir = os.path.dirname(os.path.abspath(__file__))
config_file_path = f"{cur_dir}/test_stream_smoke/configs/config.json"
Expand Down Expand Up @@ -101,41 +97,6 @@ def upload_proton_logs(s3_client, proton_log_folder, pr_number="0", commit_sha="
return proton_log_url


def proton_python_driver_install():
s3_helper = S3Helper("https://s3.amazonaws.com")
command = "pip3 list | grep clickhouse-driver"
ret = subprocess.run(
command,
shell=True,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
encoding="utf-8",
timeout=600,
)
logger.debug(f"ret.stdout == {ret.stdout}")
if PROTON_PYTHON_DRIVER_NANME not in ret.stdout:
s3_helper.client.download_file(
PROTON_PYTHON_DRIVER_S3_BUCKET_NAME,
PROTON_PYTHON_DIRVER_S3_OBJ_NAME,
PROTON_PYTHON_DRIVER_FILE_NAME,
)
logger.debug(f"{PROTON_PYTHON_DRIVER_FILE_NAME} is downloaded")
command = "pip3 install ./" + PROTON_PYTHON_DRIVER_FILE_NAME
ret = ret = subprocess.run(
command,
shell=True,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
encoding="utf-8",
timeout=600,
)
logger.debug(f"ret of subprocess.run({command}) = {ret}")
else:
logger.debug(
f"{PROTON_PYTHON_DRIVER_NANME} exists bypass s3 download and install"
)
time.sleep(1)

def ci_runner(
local_all_results_folder_path,
setting_config,
Expand Down Expand Up @@ -511,8 +472,7 @@ def ci_runner(
print(
f"one of TIMEPLUS_API_KEY,TIMEPLUS_ADDRESS,TIMEPLUS_WORKSPACE is not found in ENV"
)
logger.info(f"Check proton_python_driver and install...")
proton_python_driver_install()

if (
"test_production_compatibility" in test_folders_list
): # todo: hardcode now, refactor later to have a system_test_runner to run all pytests folders like test_production_compatibility
Expand Down
4 changes: 2 additions & 2 deletions tests/stream/helpers/bucks.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import os, sys, getopt, json, random, copy, traceback
from re import sub
import logging, logging.config
from clickhouse_driver import Client
from clickhouse_driver import errors
from proton_driver import Client
from proton_driver import errors
import csv
import datetime
import time
Expand Down
4 changes: 2 additions & 2 deletions tests/stream/helpers/easy_json_util/json_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
import requests
import csv
import multiprocessing as mp
from clickhouse_driver import Client
from clickhouse_driver import errors
from proton_driver import Client
from proton_driver import errors
from github import (Github,enable_console_debug_logging,GithubException,RateLimitExceededException)
from requests.exceptions import ReadTimeout
import requests
Expand Down
4 changes: 2 additions & 2 deletions tests/stream/helpers/input_walk.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
import requests

import multiprocessing as mp
from clickhouse_driver import Client
from clickhouse_driver import errors
from proton_driver import Client
from proton_driver import errors
from requests.api import request

sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
Expand Down
4 changes: 2 additions & 2 deletions tests/stream/helpers/pgmz.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import os, sys, getopt, json, random
from re import sub
import logging, logging.config
from clickhouse_driver import Client
from clickhouse_driver import errors
from proton_driver import Client
from proton_driver import errors
import csv
import datetime
import time
Expand Down
4 changes: 2 additions & 2 deletions tests/stream/helpers/query_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import os, sys, getopt, json, random
from re import sub
import logging, logging.config
from clickhouse_driver import Client
from clickhouse_driver import errors
from proton_driver import Client
from proton_driver import errors
import csv
import datetime
import time
Expand Down
3 changes: 2 additions & 1 deletion tests/stream/helpers/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ pytest-html==3.1.1
psycopg2-binary==2.9.3
kafka-python==2.0.2
timeplus==1.1.2
sseclient-py>=1.7.2
sseclient-py>=1.7.2
proton-driver>=0.2.4
4 changes: 2 additions & 2 deletions tests/stream/helpers/rockets.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# _*_ coding: utf-8 _*_
import datetime, yaml, json, getopt, logging, logging.config, math, os, platform, random, requests,signal,subprocess, sys, threading, time, traceback, uuid
import multiprocessing as mp
from clickhouse_driver import Client, errors
from proton_driver import Client, errors
from timeplus import Stream, Environment
from helpers.event_util import (
Event,
Expand Down Expand Up @@ -57,7 +57,7 @@
TIME_STR_FORMAT = "%y/%m/%d, %H:%M:%S"


# TestException and errors, steal some codes from clickhouse_driver.errors
# TestException and errors, steal some codes from proton_driver.errors
class ErrorCodes:
STREAM_CREATE_FAILED = 100
QUERY_ID_NOT_EXIST = 101
Expand Down
4 changes: 2 additions & 2 deletions tests/stream/helpers/tpexporter/tpclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import timeplus
from timeplus import Environment, Stream
import sseclient
from clickhouse_driver import Client
from proton_driver import Client

logger = logging.getLogger(__name__)
formatter = logging.Formatter(
Expand All @@ -23,7 +23,7 @@
DEFAULT_REST_GET_TIMEOUT = 5
DEFAULT_REST_TIMEOUT_RETRY = 3
DEFAULT_REST_TIMEOUT_RETRY_INTERVAL = 1
TPNATIVE_DRIVER = 'clickhouse_driver'
TPNATIVE_DRIVER = 'proton_driver'


@unique
Expand Down
2 changes: 1 addition & 1 deletion tests/stream/helpers/tpexporter/tpexporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from enum import Enum, unique
# import swagger_client
# from swagger_client.rest import ApiException
from clickhouse_driver import Client
from proton_driver import Client
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))

# from timeplus import Environment, Stream
Expand Down

0 comments on commit 8278265

Please sign in to comment.