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

Fix skipped integration tests if KAFKA_VERSION unset #1453

Merged
merged 1 commit into from
Mar 23, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions test/test_consumer_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import os
import time

import pytest
from six.moves import xrange
import six

Expand All @@ -19,12 +20,14 @@
ProduceRequestPayload, TopicPartition, OffsetAndTimestamp
)

from test.conftest import version
from test.fixtures import ZookeeperFixture, KafkaFixture
from test.testutil import (
KafkaIntegrationTestCase, kafka_versions, random_string, Timer,
send_messages
)

@pytest.mark.skipif(not version(), reason="No KAFKA_VERSION set")
def test_kafka_consumer(simple_client, topic, kafka_consumer_factory):
"""Test KafkaConsumer
"""
Expand Down
6 changes: 6 additions & 0 deletions test/test_producer_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import time
import uuid

import pytest
from six.moves import range

from kafka import (
Expand All @@ -14,9 +15,11 @@
from kafka.producer.base import Producer
from kafka.structs import FetchRequestPayload, ProduceRequestPayload

from test.conftest import version
from test.fixtures import ZookeeperFixture, KafkaFixture
from test.testutil import KafkaIntegrationTestCase, kafka_versions, current_offset


# TODO: This duplicates a TestKafkaProducerIntegration method temporarily
# while the migration to pytest is in progress
def assert_produce_request(client, topic, messages, initial_offset, message_ct,
Expand All @@ -32,13 +35,16 @@ def assert_produce_request(client, topic, messages, initial_offset, message_ct,

assert current_offset(client, topic, partition) == initial_offset + message_ct


def assert_produce_response(resp, initial_offset):
"""Verify that a produce response is well-formed
"""
assert len(resp) == 1
assert resp[0].error == 0
assert resp[0].offset == initial_offset


@pytest.mark.skipif(not version(), reason="No KAFKA_VERSION set")
def test_produce_many_simple(simple_client, topic):
"""Test multiple produces using the SimpleClient
"""
Expand Down