Skip to content

Commit

Permalink
test fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
MrTrustworthy committed Aug 18, 2019
1 parent fb841bf commit 31b4f3f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
3 changes: 3 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[pytest]
markers =
integration: run the tests that rely on a working kafka cluster
14 changes: 9 additions & 5 deletions tests/integration/test_topic_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,23 +114,27 @@ def test_apply(topic_controller: TopicController, topic_id: str):
# 1: topic creation
path = save_yaml(topic_id, apply_conf)
result = runner.invoke(apply, ["-f", path], input="Y\n")
assert result.exit_code == 0 and "Successfully created topics:" in result.output, \
assert result.exit_code == 0 and "Successfully applied changes" in result.output, \
f"Calling apply failed, error: {result.output}"

# 2: change cleanup policy to delete
topic_1["config"]["cleanup.policy"] = "delete"
path = save_yaml(topic_id, apply_conf)
result = runner.invoke(apply, ["-f", path], input="Y\n")
assert result.exit_code == 0 and "Successfully changed topics:" in result.output, \
assert result.exit_code == 0 and "Successfully applied changes" in result.output, \
f"Calling apply failed, error: {result.output}"

# 3: add another topic and change the first one again
apply_conf["topics"].append(topic_2)
topic_1["config"]["cleanup.policy"] = "compact"
path = save_yaml(topic_id, apply_conf)
result = runner.invoke(apply, ["-f", path], input="Y\nY\n")
assert result.exit_code == 0 and "Successfully changed topics:" in result.output \
and "Successfully created topics:" in result.output, \
result = runner.invoke(apply, ["-f", path], input="Y\n")
assert result.exit_code == 0 and "Successfully applied changes" in result.output, \
f"Calling apply failed, error: {result.output}"

# 4: no changes
result = runner.invoke(apply, ["-f", path])
assert result.exit_code == 0 and "No changes detected, aborting" in result.output, \
f"Calling apply failed, error: {result.output}"

# final: check results in the cluster to make sure they match
Expand Down
1 change: 1 addition & 0 deletions tests/test_samples/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*_apply.yaml

0 comments on commit 31b4f3f

Please sign in to comment.