Skip to content

Commit

Permalink
Use python 3.5 runtime and pulsar client (apache#3723)
Browse files Browse the repository at this point in the history
* Use python 3.5 runtime and pulsar client

* Fix PulsarWorkerAssignmentTest

* Test Fixes

* Adjust test timeout
  • Loading branch information
aahmed-se authored and merlimat committed Mar 1, 2019
1 parent 0142247 commit 7c7c3fb
Show file tree
Hide file tree
Showing 8 changed files with 69 additions and 81 deletions.
8 changes: 3 additions & 5 deletions docker/pulsar/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,8 @@

FROM openjdk:8-jdk

RUN echo "deb http://ftp.de.debian.org/debian testing main" >> /etc/apt/sources.list

# Install some utilities
RUN apt-get update && apt-get install -y netcat dnsutils python-kazoo python-yaml python-pip python3.7 python3-pip
RUN apt-get update && apt-get install -y netcat dnsutils python-kazoo python-yaml python-pip python3 python3-pip python3-yaml python3-pip

ARG PULSAR_TARBALL

Expand All @@ -36,11 +34,11 @@ COPY scripts/pulsar-zookeeper-ruok.sh /pulsar/bin
COPY scripts/watch-znode.py /pulsar/bin
COPY scripts/set_python_version.sh /pulsar/bin
COPY scripts/install-pulsar-client-27.sh /pulsar/bin
COPY scripts/install-pulsar-client-37.sh /pulsar/bin
COPY scripts/install-pulsar-client-35.sh /pulsar/bin

ADD target/python-client/ /pulsar/pulsar-client
RUN /pulsar/bin/install-pulsar-client-27.sh
RUN /pulsar/bin/install-pulsar-client-37.sh
RUN /pulsar/bin/install-pulsar-client-35.sh
RUN echo networkaddress.cache.ttl=1 >> $JAVA_HOME/jre/lib/security/java.security

WORKDIR /pulsar
Expand Down
6 changes: 3 additions & 3 deletions docker/pulsar/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
</configuration>
</execution>
<execution>
<id>build-pulsar-clients-python-37</id>
<id>build-pulsar-clients-python-35</id>
<phase>compile</phase>
<goals>
<goal>exec</goal>
Expand All @@ -80,8 +80,8 @@
<workingDirectory>${project.basedir}/target</workingDirectory>
<executable>${project.basedir}/../../pulsar-client-cpp/docker/build-wheels.sh</executable>
<arguments>
<!-- build python 3.7 -->
<argument>3.7 cp37-cp37m</argument>
<!-- build python 3.5 -->
<argument>3.5 cp35-cp35m</argument>
</arguments>
</configuration>
</execution>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@

set -x

WHEEL_FILE=$(ls /pulsar/pulsar-client | grep cp37)
WHEEL_FILE=$(ls /pulsar/pulsar-client | grep cp35)
pip3 install /pulsar/pulsar-client/${WHEEL_FILE}
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,8 @@
package org.apache.pulsar.broker.admin;

import com.google.common.collect.ImmutableSet;

import java.util.List;
import java.security.cert.X509Certificate;
import javax.net.ssl.SSLContext;
import javax.ws.rs.NotAuthorizedException;
import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.GenericType;
import javax.ws.rs.core.MediaType;

import lombok.extern.slf4j.Slf4j;

import org.apache.http.conn.ssl.NoopHostnameVerifier;

import org.apache.pulsar.broker.auth.MockedPulsarServiceBaseTest;
import org.apache.pulsar.client.admin.PulsarAdmin;
import org.apache.pulsar.client.admin.PulsarAdminException;
Expand All @@ -44,22 +31,27 @@
import org.apache.pulsar.common.policies.data.AuthAction;
import org.apache.pulsar.common.policies.data.TenantInfo;
import org.apache.pulsar.common.util.SecurityUtility;

import org.glassfish.jersey.client.ClientConfig;
import org.glassfish.jersey.client.ClientProperties;
import org.glassfish.jersey.jackson.JacksonFeature;
import org.glassfish.jersey.media.multipart.MultiPartFeature;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.testng.Assert;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;

import javax.net.ssl.SSLContext;
import javax.ws.rs.NotAuthorizedException;
import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.GenericType;
import javax.ws.rs.core.MediaType;
import java.security.cert.X509Certificate;
import java.util.List;

@Slf4j
public class AdminApiTlsAuthTest extends MockedPulsarServiceBaseTest {
private static final Logger log = LoggerFactory.getLogger(AdminApiTlsAuthTest.class);

private static String getTLSFile(String name) {
return String.format("./src/test/resources/authentication/tls-http/%s.pem", name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,43 +18,40 @@
*/
package org.apache.pulsar.broker.service;

import java.lang.reflect.Method;
import java.util.concurrent.TimeUnit;

import com.google.common.collect.Sets;
import org.apache.pulsar.broker.auth.MockedPulsarServiceBaseTest;
import org.apache.pulsar.client.api.MessageRoutingMode;
import org.apache.pulsar.client.api.PulsarClient;
import org.apache.pulsar.client.impl.ConsumerImpl;
import org.apache.pulsar.client.impl.ProducerImpl;
import org.apache.pulsar.common.naming.TopicDomain;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;

import com.google.common.collect.Sets;
import java.lang.reflect.Method;
import java.util.concurrent.TimeUnit;

public class ReplicatorGlobalNSTest extends ReplicatorTestBase {

protected String methodName;

@BeforeMethod
public void beforeMethod(Method m) throws Exception {
public void beforeMethod(Method m) {
methodName = m.getName();
}

@Override
@BeforeClass(timeOut = 30000)
@BeforeClass(timeOut = 60000)
void setup() throws Exception {
super.setup();
}

@Override
@AfterClass(timeOut = 30000)
@AfterClass(timeOut = 60000)
void shutdown() throws Exception {
super.shutdown();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public class ReplicatorTestBase {

ZookeeperServerTest globalZkS;

ExecutorService executor = new ThreadPoolExecutor(5, 20, 30, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>());
ExecutorService executor = new ThreadPoolExecutor(5, 20, 30, TimeUnit.SECONDS, new LinkedBlockingQueue<>());

static final int TIME_TO_CHECK_BACKLOG_QUOTA = 5;

Expand Down Expand Up @@ -355,7 +355,7 @@ static class MessageConsumer {

void receive(int messages) throws Exception {
log.info("Start receiving messages");
Message<byte[]> msg = null;
Message<byte[]> msg;

for (int i = 0; i < messages; i++) {
msg = consumer.receive();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,18 +95,18 @@ public class V1_ReplicatorTest extends V1_ReplicatorTestBase {
protected String methodName;

@BeforeMethod
public void beforeMethod(Method m) throws Exception {
public void beforeMethod(Method m) {
methodName = m.getName();
}

@Override
@BeforeClass(timeOut = 30000)
@BeforeClass(timeOut = 60000)
void setup() throws Exception {
super.setup();
}

@Override
@AfterClass(timeOut = 30000)
@AfterClass(timeOut = 60000)
void shutdown() throws Exception {
super.shutdown();
}
Expand Down
Loading

0 comments on commit 7c7c3fb

Please sign in to comment.