From commits-return-10972-archive-asf-public=cust-asf.ponee.io@kafka.apache.org Wed Jan 9 09:14:45 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id A8A85180669 for ; Wed, 9 Jan 2019 09:14:44 +0100 (CET) Received: (qmail 49250 invoked by uid 500); 9 Jan 2019 08:14:43 -0000 Mailing-List: contact commits-help@kafka.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@kafka.apache.org Delivered-To: mailing list commits@kafka.apache.org Received: (qmail 49241 invoked by uid 99); 9 Jan 2019 08:14:43 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 09 Jan 2019 08:14:43 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id E49C985BF4; Wed, 9 Jan 2019 08:14:42 +0000 (UTC) Date: Wed, 09 Jan 2019 08:14:42 +0000 To: "commits@kafka.apache.org" Subject: [kafka] branch 2.1 updated: KAFKA-7799; Fix flaky test RestServerTest.testCORSEnabled (#6106) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Message-ID: <154702168145.14382.12755929680071982127@gitbox.apache.org> From: jgus@apache.org X-Git-Host: gitbox.apache.org X-Git-Repo: kafka X-Git-Refname: refs/heads/2.1 X-Git-Reftype: branch X-Git-Oldrev: 6a8ed79f58e92498feed6fa4b3627d01bd9a242a X-Git-Newrev: ca2215a35d98ff693c1bfb64dccf8133c29c35e0 X-Git-Rev: ca2215a35d98ff693c1bfb64dccf8133c29c35e0 X-Git-NotificationType: ref_changed_plus_diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated This is an automated email from the ASF dual-hosted git repository. jgus pushed a commit to branch 2.1 in repository https://gitbox.apache.org/repos/asf/kafka.git The following commit(s) were added to refs/heads/2.1 by this push: new ca2215a KAFKA-7799; Fix flaky test RestServerTest.testCORSEnabled (#6106) ca2215a is described below commit ca2215a35d98ff693c1bfb64dccf8133c29c35e0 Author: Jason Gustafson AuthorDate: Tue Jan 8 23:47:28 2019 -0800 KAFKA-7799; Fix flaky test RestServerTest.testCORSEnabled (#6106) The test always fails if testOptionsDoesNotIncludeWadlOutput is executed before testCORSEnabled. It seems the problem is the use of the system property. Perhaps there is some static caching somewhere. Reviewers: Randall Hauch , Guozhang Wang --- .../org/apache/kafka/connect/runtime/rest/RestServerTest.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/connect/runtime/src/test/java/org/apache/kafka/connect/runtime/rest/RestServerTest.java b/connect/runtime/src/test/java/org/apache/kafka/connect/runtime/rest/RestServerTest.java index 892693a..8fee4f4 100644 --- a/connect/runtime/src/test/java/org/apache/kafka/connect/runtime/rest/RestServerTest.java +++ b/connect/runtime/src/test/java/org/apache/kafka/connect/runtime/rest/RestServerTest.java @@ -27,6 +27,7 @@ import org.easymock.Capture; import org.easymock.EasyMock; import org.junit.After; import org.junit.Assert; +import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.powermock.api.easymock.PowerMock; @@ -58,6 +59,12 @@ public class RestServerTest { private Plugins plugins; private RestServer server; + @Before + public void setUp() { + // To be able to set the Origin, we need to toggle this flag + System.setProperty("sun.net.http.allowRestrictedHeaders", "true"); + } + @After public void tearDown() { server.stop(); @@ -182,13 +189,10 @@ public class RestServerTest { } public void checkCORSRequest(String corsDomain, String origin, String expectedHeader, String method) { - // To be able to set the Origin, we need to toggle this flag - Map workerProps = baseWorkerProps(); workerProps.put(WorkerConfig.ACCESS_CONTROL_ALLOW_ORIGIN_CONFIG, corsDomain); workerProps.put(WorkerConfig.ACCESS_CONTROL_ALLOW_METHODS_CONFIG, method); WorkerConfig workerConfig = new DistributedConfig(workerProps); - System.setProperty("sun.net.http.allowRestrictedHeaders", "true"); EasyMock.expect(herder.plugins()).andStubReturn(plugins); EasyMock.expect(plugins.newPlugins(Collections.EMPTY_LIST,