Skip to content

Commit

Permalink
regression test (#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
MrTrustworthy authored and hfjn committed Sep 6, 2019
1 parent 35a3252 commit bbb496f
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/integration/test_topic_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,24 @@ def test_apply_duplicate_names(topic_controller: TopicController, topic_id: str)
assert result.exit_code != 0 and isinstance(result.exception, ValueError), f"Calling apply should have failed"


@pytest.mark.integration
def test_apply_invalid_replicas(topic_controller: TopicController, topic_id: str):
runner = CliRunner()
topic_name = f"apply_{topic_id}"
topic_1 = {
"name": topic_name,
"replication_factor": 100,
"num_partitions": 50,
"config": {"cleanup.policy": "compact"},
}
apply_conf = {"topics": [topic_1]}

# having the same topic name twice in apply should raise an ValueError
path = save_yaml(topic_id, apply_conf)
result = runner.invoke(apply, ["-f", path], input="Y\n")
assert result.exit_code != 0 and isinstance(result.exception, KafkaException), f"Calling apply should have failed"


def save_yaml(fname: str, data: Dict[str, Any]) -> str:
# this path name is in the gitignore so the temp files are not committed
path = f"tests/test_samples/{fname}_apply.yaml"
Expand Down

0 comments on commit bbb496f

Please sign in to comment.