Skip to content

Commit

Permalink
Update chart data tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ruthenian8 committed Nov 8, 2023
1 parent 8db3a78 commit 0251c0b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
5 changes: 1 addition & 4 deletions tests/stats/chart_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@
from dff.script import Context, Message, RESPONSE, TRANSITIONS
from dff.script import conditions as cnd
from dff.pipeline import Pipeline, ACTOR, Service
from dff.stats import (
OtelInstrumentor,
default_extractors
)
from dff.stats import OtelInstrumentor, default_extractors

# %%
# instrumentation code
Expand Down
15 changes: 5 additions & 10 deletions tests/stats/test_charts.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
try:
import omegaconf # noqa: F401
import tqdm # noqa: F401
from dff.stats.instrumentor import OtelInstrumentor
from dff.stats.__main__ import main
from dff.stats.utils import get_superset_session, drop_superset_assets
from dff.stats.cli import DEFAULT_SUPERSET_URL
Expand Down Expand Up @@ -42,9 +41,9 @@ def transitions_data_test(session, headers, base_url=DEFAULT_SUPERSET_URL):
target_url = parse.urljoin(DEFAULT_SUPERSET_URL, f"api/v1/chart/{target_chart_id}/data/")
data_result = session.get(target_url, headers=headers)
data_result.raise_for_status()
print(data_result.json())
data_result_json = data_result.json()
assert len(data_result_json["result"]["data"]) == 10
session.close()
assert False


def numbered_data_test(session, headers, base_url=DEFAULT_SUPERSET_URL):
Expand All @@ -58,9 +57,9 @@ def numbered_data_test(session, headers, base_url=DEFAULT_SUPERSET_URL):
target_url = parse.urljoin(DEFAULT_SUPERSET_URL, f"api/v1/chart/{target_chart_id}/data/")
data_result = session.get(target_url, headers=headers)
data_result.raise_for_status()
print(data_result.json())
data_result_json = data_result.json()
assert len(data_result_json) == 1
session.close()
assert False


config_namespace = Namespace(
Expand Down Expand Up @@ -106,11 +105,7 @@ async def test_charts(args, pipeline, func, otlp_log_exp_provider, otlp_trace_ex
_, tracer_provider = otlp_trace_exp_provider
_, logger_provider = otlp_log_exp_provider

table = "otel_logs"
await cleanup_clickhouse(table, CLICKHOUSE_USER, CLICKHOUSE_PASSWORD, CLICKHOUSE_DB)
dff_instrumentor = OtelInstrumentor.from_url("grpc://localhost:4317", insecure=True)
dff_instrumentor.uninstrument()
dff_instrumentor.instrument(logger_provider=logger_provider, tracer_provider=tracer_provider)
await cleanup_clickhouse("otel_logs", CLICKHOUSE_USER, CLICKHOUSE_PASSWORD, CLICKHOUSE_DB)
await loop(pipeline=pipeline) # run with a test-specific pipeline
await asyncio.sleep(5)

Expand Down

0 comments on commit 0251c0b

Please sign in to comment.