Return-Path: X-Original-To: apmail-samza-dev-archive@minotaur.apache.org Delivered-To: apmail-samza-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 7B9F318550 for ; Wed, 17 Jun 2015 01:11:59 +0000 (UTC) Received: (qmail 81626 invoked by uid 500); 17 Jun 2015 01:11:59 -0000 Delivered-To: apmail-samza-dev-archive@samza.apache.org Received: (qmail 81568 invoked by uid 500); 17 Jun 2015 01:11:59 -0000 Mailing-List: contact dev-help@samza.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@samza.apache.org Delivered-To: mailing list dev@samza.apache.org Received: (qmail 81556 invoked by uid 99); 17 Jun 2015 01:11:59 -0000 Received: from Unknown (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 17 Jun 2015 01:11:59 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 92FB0CE4E8 for ; Wed, 17 Jun 2015 01:11:58 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 2.879 X-Spam-Level: ** X-Spam-Status: No, score=2.879 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=3, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd1-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-eu-west.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id JTnG6fw7yWCE for ; Wed, 17 Jun 2015 01:11:57 +0000 (UTC) Received: from mail-ig0-f181.google.com (mail-ig0-f181.google.com [209.85.213.181]) by mx1-eu-west.apache.org (ASF Mail Server at mx1-eu-west.apache.org) with ESMTPS id B781520DC7 for ; Wed, 17 Jun 2015 01:11:56 +0000 (UTC) Received: by igbiq7 with SMTP id iq7so56140778igb.1 for ; Tue, 16 Jun 2015 18:11:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=+8HS6lTKrRNs2B0YA8HFigDXIq0oRGI+QpT1Aqk0Kq0=; b=y0CbUhqNFtaOCyYOksaGIGhFOrFJv4V8/fFcxmckr3xyAk0WB9jPpkIDN14uyp34Na VtEGtquq+ruS+Nqklj0pIqzD4J1DiCAwhTBs90S2H4VqU7c4aX3tsedNtf8mUFlCLFtp 0n3j0eR4kdZCF0kHRuEvbeaD0c9u/j9qkJpaSdsbX8p0IYMYjmjIv8LMaJ8r060fK3pG CBF3wQ4Kk0q16zb2tl4uw9fPDPf562W0HkcLeX2fN1QpCAyXaqEltSlyv1pzCDt/SI3Q PceZrKGDbAHaIeE90nqWADph5IYRE+gpnZgq27Q7hqBW6dZQ8LnmrrcR4nFQHIUG0pcC k/lQ== MIME-Version: 1.0 X-Received: by 10.107.161.6 with SMTP id k6mr4386823ioe.41.1434503515647; Tue, 16 Jun 2015 18:11:55 -0700 (PDT) Received: by 10.107.18.168 with HTTP; Tue, 16 Jun 2015 18:11:55 -0700 (PDT) In-Reply-To: References: Date: Tue, 16 Jun 2015 18:11:55 -0700 Message-ID: Subject: Re: improving hello-samza / testing From: Chinmay Soman To: dev@samza.apache.org Content-Type: multipart/alternative; boundary=001a1141bd967ab5880518ac6068 --001a1141bd967ab5880518ac6068 Content-Type: text/plain; charset=UTF-8 We've built a driver program which kinda falls along approach (1) listed in your email. The driver program accepts a custom task object and has a way to inject data -> which in turn invokes the process method. For now we're assuming logical time and use the frequency of process() invocations to deduce when to invoke the window() method (for eg: invoke window once for every 4 calls to process). We've also built our own Incoming and Outgoing envelope -> which is just in the form of a Java List. This is how the result is evaluated (either get the full result list or define a callback which is invoked every time a collector.send is called). Its still work in progress and the goal is to make unit testing along the lines of Storm unit tests. On Tue, Jun 16, 2015 at 5:17 PM, Chris Riccomini wrote: > Hey Tim, > > This is a really good discussion to have. The testing that I've seen with > Samza falls into two categories: > > 1. Instantiate your StreamTask, and mock all params in the process()/init() > methods. > 2. A mini-ontegration test that starts ZooKeeper, and Kafka, and feeds > messages into a topic, and validates it gets messages back out from the > output topic. > 3. A full blown integration test that uses Zopkio. > > For an example of (2), in practice, have a look at TestStatefuleTask: > > > > https://git-wip-us.apache.org/repos/asf?p=samza.git;a=blob;f=samza-test/src/test/scala/org/apache/samza/test/integration/TestStatefulTask.scala;h=ea702a919348305ff95ce0b4ca1996a13aff04ec;hb=HEAD > > As you can see, writing this kind of integration test can be a bit painful. > > (3) is documented here: > > http://samza.apache.org/contribute/tests.html > > Another way to test would be to start a full-blown container using > ThreadJobFactory/ProcessJobFactory, but use a MockSystemFactory to mock out > the system consumer/system producer. > > Has anyone else tested Samza in other ways? > > Cheers, > Chris > > On Tue, Jun 16, 2015 at 11:00 AM, Tim Williams > wrote: > > > I'm learning samza by the hello-samza project and notice the lack of > > tests. Where's a good place to learn how folks are properly testing > > things written with samza? > > > > Thanks, > > --tim > > > -- Thanks and regards Chinmay Soman --001a1141bd967ab5880518ac6068--