Skip to content

Commit

Permalink
added test
Browse files Browse the repository at this point in the history
Signed-off-by: DvirDukhan <dvir@redislabs.com>
  • Loading branch information
DvirDukhan committed Jul 12, 2021
1 parent c6e40c9 commit 34e77db
Showing 1 changed file with 45 additions and 1 deletion.
46 changes: 45 additions & 1 deletion sdk/python/tests/test_cli_redis.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import tempfile
from pathlib import Path
from textwrap import dedent

import redis
import pytest

from feast.feature_store import FeatureStore
Expand Down Expand Up @@ -58,3 +58,47 @@ def test_basic() -> None:

result = runner.run(["teardown"], cwd=repo_path)
assert result.returncode == 0


@pytest.mark.integration
def test_connection_error() -> None:
project_id = "".join(
random.choice(string.ascii_lowercase + string.digits) for _ in range(10)
)
runner = CliRunner()
with tempfile.TemporaryDirectory() as repo_dir_name, tempfile.TemporaryDirectory() as data_dir_name:

repo_path = Path(repo_dir_name)
data_path = Path(data_dir_name)

repo_config = repo_path / "feature_store.yaml"

repo_config.write_text(
dedent(
f"""
project: {project_id}
registry: {data_path / "registry.db"}
provider: local
offline_store:
type: file
online_store:
type: redis
connection_string: localhost:6379,db=0=
"""
)
)

repo_example = repo_path / "example.py"
repo_example.write_text(
(Path(__file__).parent / "example_feature_repo_2.py").read_text()
)

result = runner.run(["apply"], cwd=repo_path)
assert result.returncode == 0

# Redis does not support names for its databases.
with pytest.raises(redis.exceptions.ResponseError):
basic_rw_test(
FeatureStore(repo_path=str(repo_path), config=None),
view_name="driver_hourly_stats",
)

0 comments on commit 34e77db

Please sign in to comment.