Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid Topic Creation - regression test #42

Merged
merged 1 commit into from
Sep 6, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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