From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id 9CBAE6C1AE; Fri, 21 May 2021 22:26:51 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 9CBAE6C1AE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1621625211; bh=nH/ELU1U2wMigfMQsMhLY293ySAeKBM8Ft2arrMuVms=; h=To:References:Date:In-Reply-To:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=IXPYep+RBC9AcVhJwPbXrGhsaqf0jkEY/QAfarwO8naQrAcu5C9NrAr6EZysCQy42 wGMdvH5cEus6WRn5Kx9R9StkNS3VSR9X+nW0OXat5M+UZTQZ1jpr9yw567h1UoYMXQ ywTYF42WV68KIdRrb/13LMp0GZ6zf2VCuDjq3Vlg= Received: from smtpng3.m.smailru.net (smtpng3.m.smailru.net [94.100.177.149]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id D89416C1AE for ; Fri, 21 May 2021 22:26:46 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org D89416C1AE Received: by smtpng3.m.smailru.net with esmtpa (envelope-from ) id 1lkAnG-0008PW-0x; Fri, 21 May 2021 22:26:46 +0300 To: Yaroslav Dynnikov References: Message-ID: <2ec9e3f1-6b24-6593-174f-0ea72b56cd6b@tarantool.org> Date: Fri, 21 May 2021 21:26:45 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.10.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-7564579A: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD91B019B01C53E51AF113D6D562FBA72891FA115C4A817A10000894C459B0CD1B92DB1CEC03599ADE2771094BF1E130D3666ABEBE91DA44D54A41EFFA2D20C5292 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7D9C4478D0B876341EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F790063773AA33509B65BC498638F802B75D45FF914D58D5BE9E6BC1A93B80C6DEB9DEE97C6FB206A91F05B208694B02527DF9E4B2176DE04FEB25989414A38D98B987DBD2E47CDBA5A96583C09775C1D3CA48CFE478A468B35FE767117882F4460429724CE54428C33FAD30A8DF7F3B2552694AC26CFBAC0749D213D2E47CDBA5A9658378DA827A17800CE709B92020B71E24959FA2833FD35BB23DF004C906525384302BEBFE083D3B9BA71A620F70A64A45A98AA50765F79006372E808ACE2090B5E1725E5C173C3A84C3C5EA940A35A165FF2DBA43225CD8A89F83C798A30B85E16B156CCFE7AF13BCA4B5C8C57E37DE458BEDA766A37F9254B7 X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A2AD77751E876CB595E8F7B195E1C97831F9341025EF6C258903B6B7CA29D26CC3 X-C1DE0DAB: 0D63561A33F958A56F727E7A201EECA6C33FDF5E7C618A5276CE27ED90E4090AD59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA752546FE575EB473F1410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34806D3522FB05EB3901C945E6D87856EC116456B871614DCF1845C2F3A4B9F043EECC2E476B7184BE1D7E09C32AA3244CC78C998D5D2B0FD9B94C5F571C5A6A6FF26BFA4C8A6946B8FACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2bioj3CIvDNz8QqBRJyfW5UcIsQ== X-Mailru-Sender: 689FA8AB762F73936BC43F508A06382265A4791FEAF617502D55D3E65F988FA13841015FED1DE5223CC9A89AB576DD93FB559BB5D741EB963CF37A108A312F5C27E8A8C3839CE0E267EA787935ED9F1B X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH 1/2] test: fix test output on latest Tarantool X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Vladislav Shpilevoy via Tarantool-patches Reply-To: Vladislav Shpilevoy Cc: tml Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Hi! Thanks for the review! On 19.05.2021 23:50, Yaroslav Dynnikov wrote: > HI, Vlad > > Thanks for the patch. > Find one comment below. > > On Thu, 13 May 2021 at 14:07, Vladislav Shpilevoy > wrote: > > Duplicate key error at insertion into a space on the latest > Tarantool changed its message and it broke of the tests. The patch > updates the test so it checks only the needed part of the message > and does not depend on Tarantool version anymore. > --- >  test/storage/storage.result   | 8 +++++--- >  test/storage/storage.test.lua | 3 ++- >  2 files changed, 7 insertions(+), 4 deletions(-) > > diff --git a/test/storage/storage.result b/test/storage/storage.result > index 2c9784a..d18b7f8 100644 > --- a/test/storage/storage.result > +++ b/test/storage/storage.result > @@ -179,10 +179,12 @@ vshard.storage.buckets_info() >      status: active >      id: 1 >  ... > -vshard.storage.bucket_force_create(1) -- error > +ok, err = vshard.storage.bucket_force_create(1) >  --- > -- null > -- Duplicate key exists in unique index 'pk' in space '_bucket' > +... > +assert(not ok and err.message:match("Duplicate key exists")) > +--- > +- Duplicate key exists >  ... >  vshard.storage.bucket_force_drop(1) >  --- > diff --git a/test/storage/storage.test.lua b/test/storage/storage.test.lua > index 33f0498..97558f6 100644 > --- a/test/storage/storage.test.lua > +++ b/test/storage/storage.test.lua > @@ -56,7 +56,8 @@ vshard.storage.sync(100500) >  vshard.storage.buckets_info() >  vshard.storage.bucket_force_create(1) >  vshard.storage.buckets_info() > -vshard.storage.bucket_force_create(1) -- error > +ok, err = vshard.storage.bucket_force_create(1) > +assert(not ok and "err.message:match("Duplicate key exists)) > > > I'd suggest splitting the check in two: > > 1. ok -- should be false > 2. Then check the message matches. > > Assertions usually don't provide useful errors. In the core we try to use assertions more, because this makes the tests easier to read. You can see right away what are the target points of the test. This is kind of a simulation of tap tests. I consider vshard be "half-core", so I decided to use assertions here as well.