Skip to content

Remove dependencies on deprecated --zookeeper command flags in junit tests#8527

Merged
cmccabe merged 4 commits into
apache:trunkfrom
ctan888:REMOVE_UNIT
May 4, 2020
Merged

Remove dependencies on deprecated --zookeeper command flags in junit tests#8527
cmccabe merged 4 commits into
apache:trunkfrom
ctan888:REMOVE_UNIT

Conversation

@ctan888

@ctan888 ctan888 commented Apr 22, 2020

Copy link
Copy Markdown
Contributor
  • Removed the --zookeeper flag related tests. Scram credential related tests are also get removed since they are using --zookeeper flag.

Committer Checklist (excluded from commit message)

  • Verify design and implementation
  • Verify test coverage and CI build status
  • Verify documentation (including upgrade notes)


val passwordConfigs = sslStoreProps.asScala.keySet.filter(DynamicBrokerConfig.isPasswordConfig)
val passwordEncoderConfigs = new Properties
passwordEncoderConfigs ++= sslStoreProps.asScala.filter { case (key, _) => key.startsWith("password.encoder.") }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm. Do we need this if we have passwordConfigs?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. Deleted.

@cmccabe cmccabe changed the title Splitted unit tests for --zookeeper flag removal Remove dependencies on deprecated --zookeeper command flags in junit tests Apr 23, 2020
@cmccabe

cmccabe commented Apr 23, 2020

Copy link
Copy Markdown
Contributor

For ConfigCommandTest.scala, we should keep the tests of the --zookeeper command since that is still present in trunk.

The goal should be to remove unnecessary dependencies on the deprecated zookeeper command code.

val props = new Properties()
props.setProperty(AdminClientConfig.BOOTSTRAP_SERVERS_CONFIG, TestUtils.getBrokerListStrFromServers(servers))
val adminClient = Admin.create(props)
adminClient.createPartitions(Map(topic -> NewPartitions.increaseTo(2)).asJava)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should be a "get" here to ensure that we actually create the partitions before shutting down, right?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. Although this will return an API exception (can't increase partition number during topic deletion), we still need to wait for the completion.

def shouldNotAllowBrokersListWithVerifyOption(): Unit = {
val args = Array(
"--zookeeper", "localhost:1234",
"--bootstrap-server", "localhost:1234",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good change since the test is not specifically testing the legacy mode (so it should use the new mode) Keep this one

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

def shouldNotAllowTopicsOptionWithVerify(): Unit = {
val args = Array(
"--zookeeper", "localhost:1234",
"--bootstrap-server", "localhost:1234",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

keep this change

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

def shouldNotAllowThrottleWithVerifyOption(): Unit = {
val args = Array(
"--zookeeper", "localhost:1234",
"--bootstrap-server", "localhost:1234",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

keep this change

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

}

@Test
def testCreateWithUnspecifiedReplicationFactorAndPartitionsWithZkClient(): Unit = {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's weird that this is even in this file. This should be moved to TopicCommandWithZKClientTest.scala, I think

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. If we are ignoring the tests instead of deleting the tests, we should move this one into TopicCommandWithZKClientTest.scala

@cmccabe

cmccabe commented Apr 23, 2020

Copy link
Copy Markdown
Contributor

ok to test

@cmccabe

cmccabe commented Apr 23, 2020

Copy link
Copy Markdown
Contributor

Looks like the JDK8 build flaked.

11:00:07 Error occurred during initialization of VM
11:00:07 java.lang.OutOfMemoryError: unable to create new native thread

We've got some things to fix before re-running in any case.

@ctan888

ctan888 commented Apr 25, 2020

Copy link
Copy Markdown
Contributor Author

ok to test

1 similar comment
@cmccabe

cmccabe commented Apr 25, 2020

Copy link
Copy Markdown
Contributor

ok to test

@cmccabe

cmccabe commented Apr 28, 2020

Copy link
Copy Markdown
Contributor

thanks for revising this. Let's get rid of the @Ignore on the tests here since we still do have the --zookeeper flags

@ctan888
ctan888 force-pushed the REMOVE_UNIT branch 3 times, most recently from 2c59469 to c4ffd05 Compare April 30, 2020 20:55
@cmccabe

cmccabe commented May 1, 2020

Copy link
Copy Markdown
Contributor

ok to test

2 similar comments
@ctan888

ctan888 commented May 1, 2020

Copy link
Copy Markdown
Contributor Author

ok to test

@cmccabe

cmccabe commented May 1, 2020

Copy link
Copy Markdown
Contributor

ok to test

@cmccabe cmccabe mentioned this pull request May 1, 2020
@cmccabe

cmccabe commented May 4, 2020

Copy link
Copy Markdown
Contributor

LGTM. Thanks, @d8tltanc.

@cmccabe

cmccabe commented May 4, 2020

Copy link
Copy Markdown
Contributor

JDK14 failure seems like infra issue

@cmccabe
cmccabe merged commit 7cb1600 into apache:trunk May 4, 2020
Kvicii pushed a commit to Kvicii/kafka that referenced this pull request May 7, 2020
* 'trunk' of github.com:apache/kafka: (87 commits)
  KAFKA-9865: Expose output topic names from TopologyTestDriver (apache#8483)
  MINOR - Increase the number of Trogdor Histogram buckets to 10000 (apache#8627)
  KAFKA-9768: Fix handling of rest.advertised.listener config (apache#8360)
  KAFKA-9419: Fix possible integer overflow in CircularIterator (apache#7950)
  MINOR: Only add 'Data' suffix for generated request/response/header types (apache#8625)
  KAFKA-9947; Ensure proper shutdown of services in `TransactionsBounceTest` (apache#8602)
  KAFKA-6342; Remove unused workaround for JSON parsing of non-escaped strings (apache#8591)
  MINOR: Pass `-release 8` to scalac and upgrade to Gradle 6.4 (apache#8538)
  KAFKA-9946; Partition deletion event should only be sent if deletion was requested in the StopReplica request (apache#8609)
  MINOR: Improve TopologyTestDriver JavaDocs (apache#8619)
  MINOR: MockAdminClient should return InvalidReplicationFactorException if brokers.size < replicationFactor
  KAFKA-9748: Add Streams eos-beta integration test (apache#8496)
  KAFKA-9731: Disable immediate fetch response for hw propagation if replica selector is not defined (apache#8607)
  HOTFIX: set correct numIterations in shouldAllowConcurrentAccesses
  MINOR: Clean up some test dependencies on ConfigCommand and TopicCommand (apache#8527)
  KAFKA-9918; SslEngineFactory is NOT closed when channel is closing (apache#8551)
  KAFKA-9798: Send one round synchronously before starting the async producer (apache#8565)
  MINOR: Annotate KafkaAdminClientTest.testAlterClientQuotas() with @test
  KAFKA-9589: Enable testLogAppendTimeNonCompressedV2 and fix bug in helper method (apache#8533)
  MINOR: Use min/max function when possible (apache#8577)
  ...

# Conflicts:
#	core/src/main/scala/kafka/log/Log.scala
#	gradle/dependencies.gradle
#	gradle/wrapper/gradle-wrapper.properties
#	gradlew
jwijgerd pushed a commit to buxapp/kafka that referenced this pull request May 14, 2020
…and (apache#8527)

Avoid calling into ConfigCommand and TopicCommand from tests that are not related
to these commands.  It's better to just invoke the admin APIs.

Change a few cases where we were testing the deprecated --zookeeper flag to testing
the --bootstrap-server flag instead.  Unless we're explicitly testing the deprecated code
path, we should be using the non-deprecated flags.

Move testCreateWithUnspecifiedReplicationFactorAndPartitionsWithZkClient from
TopicCommandWithAdminClientTest.scala into TopicCommandWithZKClientTest.scala,
since it makes more sense in the latter.

Reviewers: Colin P. McCabe <cmccabe@apache.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants