You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@samza.apache.org by GitBox <gi...@apache.org> on 2019/10/01 17:46:34 UTC

[GitHub] [samza] mynameborat commented on a change in pull request #1155: SAMZA-2322: Integrate startpoints with ZK Standalone integration tests.

mynameborat commented on a change in pull request #1155: SAMZA-2322: Integrate startpoints with ZK Standalone integration tests.
URL: https://github.com/apache/samza/pull/1155#discussion_r330186376
 
 

 ##########
 File path: samza-test/src/test/java/org/apache/samza/test/startpoint/StartpointTestHarness.java
 ##########
 @@ -0,0 +1,468 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.samza.test.startpoint;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Maps;
+import java.time.Duration;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.UUID;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+import java.util.stream.Collectors;
+import org.apache.kafka.clients.admin.NewTopic;
+import org.apache.kafka.clients.producer.ProducerRecord;
+import org.apache.kafka.clients.producer.RecordMetadata;
+import org.apache.samza.Partition;
+import org.apache.samza.SamzaException;
+import org.apache.samza.config.ApplicationConfig;
+import org.apache.samza.config.Config;
+import org.apache.samza.config.JobConfig;
+import org.apache.samza.config.JobCoordinatorConfig;
+import org.apache.samza.config.MapConfig;
+import org.apache.samza.config.TaskConfig;
+import org.apache.samza.config.ZkConfig;
+import org.apache.samza.coordinator.metadatastore.CoordinatorStreamStore;
+import org.apache.samza.runtime.ApplicationRunner;
+import org.apache.samza.runtime.ApplicationRunners;
+import org.apache.samza.startpoint.Startpoint;
+import org.apache.samza.startpoint.StartpointManager;
+import org.apache.samza.startpoint.StartpointOldest;
+import org.apache.samza.startpoint.StartpointSpecific;
+import org.apache.samza.startpoint.StartpointTimestamp;
+import org.apache.samza.startpoint.StartpointUpcoming;
+import org.apache.samza.system.IncomingMessageEnvelope;
+import org.apache.samza.system.SystemAdmin;
+import org.apache.samza.system.SystemAdmins;
+import org.apache.samza.system.SystemStream;
+import org.apache.samza.system.SystemStreamPartition;
+import org.apache.samza.task.TaskCallback;
+import org.apache.samza.test.StandaloneTestUtils;
+import org.apache.samza.test.harness.IntegrationTestHarness;
+import org.apache.samza.test.processor.SharedContextFactories;
+import org.apache.samza.test.processor.TestTaskApplication;
+import org.apache.samza.test.util.TestKafkaEvent;
+import org.apache.samza.util.CoordinatorStreamUtil;
+import org.apache.samza.util.NoOpMetricsRegistry;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.junit.rules.Timeout;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertTrue;
+
+
+public class StartpointTestHarness extends IntegrationTestHarness {
+
+  private static final Logger LOGGER = LoggerFactory.getLogger(StartpointTestHarness.class);
+
+  private static final int NUM_KAFKA_EVENTS = 300;
+  private static final int ZK_TEST_PARTITION_COUNT = 5;
+  private static final String TEST_SYSTEM = "TestSystemName";
+  private static final String TEST_SSP_GROUPER_FACTORY = "org.apache.samza.container.grouper.stream.GroupByPartitionFactory";
+  private static final String TEST_TASK_GROUPER_FACTORY = "org.apache.samza.container.grouper.task.GroupByContainerIdsFactory";
+  private static final String TEST_JOB_COORDINATOR_FACTORY = "org.apache.samza.zk.ZkJobCoordinatorFactory";
+  private static final String TEST_SYSTEM_FACTORY = "org.apache.samza.system.kafka.KafkaSystemFactory";
+  private static final String TASK_SHUTDOWN_MS = "10000";
+  private static final String JOB_DEBOUNCE_TIME_MS = "10000";
+  private static final String BARRIER_TIMEOUT_MS = "10000";
+  private static final String[] PROCESSOR_IDS = new String[] {"0000000000", "0000000001", "0000000002", "0000000003"};
+
+  private String inputKafkaTopic1;
+  private String inputKafkaTopic2;
+  private String inputKafkaTopic3;
+  private String inputKafkaTopic4;
+  private String outputKafkaTopic;
+  private ApplicationConfig applicationConfig1;
+  private ApplicationConfig applicationConfig2;
+  private ApplicationConfig applicationConfig3;
+  private ApplicationConfig applicationConfig4;
+  private String testStreamAppName;
+  private String testStreamAppId;
+
+  @Rule
+  public Timeout testTimeOutInMillis = new Timeout(150000, TimeUnit.MILLISECONDS);
 
 Review comment:
   Do we need such a long timeout? Is this inferred through some calculation from the debounce, barrier timeout etc? If so, can you add a doc?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services