[Tarantool-patches] [PATCH 3/6] test: remove empty print() functions
Sergey Bronnikov
sergeyb at tarantool.org
Thu Dec 10 16:26:58 MSK 2020
Hello,
thanks for review!
On 09.12.2020 23:27, Leonid Vasiliev wrote:
> Hi! Thank you for the patch.
> This was my initiative and I'm sorry.
> I don't like tests that used result files, but without delimiters, it's
> doubly ugly.
> Please leave it as it is.
>
Patch removed from a series.
> On 07.12.2020 10:46, sergeyb at tarantool.org wrote:
>> From: Sergey Bronnikov <sergeyb at tarantool.org>
>>
>> Python tests are based on a reference output: on every run output
>> produced by a
>> test compared to reference output and test become passed when both
>> output are
>> equal. Perhaps empty print()'s were added as a delimeter for
>> testscases in a
>> produced output, so the main purpose of these empty print() functions
>> is a
>> reader's convenience. The problem with empty print's is that code
>> become ugly.
>> ---
>> test/box-py/call.result | 4 ----
>> test/box-py/call.test.py | 4 ----
>> test/replication-py/multi.result | 6 ------
>> test/replication-py/multi.test.py | 6 ------
>> test/xlog-py/dup_key.result | 2 --
>> test/xlog-py/dup_key.test.py | 2 --
>> test/xlog-py/lsn_gap.result | 2 --
>> test/xlog-py/lsn_gap.test.py | 2 --
>> test/xlog-py/misc.result | 6 ------
>> test/xlog-py/misc.test.py | 6 ------
>> test/xlog-py/missing.result | 2 --
>> test/xlog-py/missing.test.py | 2 --
>> 12 files changed, 44 deletions(-)
>>
>> diff --git a/test/box-py/call.result b/test/box-py/call.result
>> index e6b7b8dc9..dc3da3c82 100644
>> --- a/test/box-py/call.result
>> +++ b/test/box-py/call.result
>> @@ -55,11 +55,9 @@ call box.error (33333, 'Hey!')
>> "reason": "Unknown error"
>> }
>> }
>> -
>> # A test case for Bug#103491
>> # server CALL processing bug with name path longer than two
>> # https://bugs.launchpad.net/tarantool/+bug/1034912
>> -
>> f = function() return 'OK' end
>> ---
>> ...
>> @@ -81,11 +79,9 @@ call test.f ()
>> - 'OK'
>> call test.test.f ()
>> - 'OK'
>> -
>> # Test for Bug #955226
>> # Lua Numbers are passed back wrongly as strings
>> #
>> -
>> function foo() return 1, 2, '1', '2' end
>> ---
>> ...
>> diff --git a/test/box-py/call.test.py b/test/box-py/call.test.py
>> index 75ced1dff..519334c8b 100644
>> --- a/test/box-py/call.test.py
>> +++ b/test/box-py/call.test.py
>> @@ -23,11 +23,9 @@ call("f1")
>> # IPROTO required!
>> call("box.error", 33333, "Hey!")
>> -print("")
>> print("# A test case for Bug#103491")
>> print("# server CALL processing bug with name path longer than two")
>> print("# https://bugs.launchpad.net/tarantool/+bug/1034912")
>> -print("")
>> admin("f = function() return 'OK' end")
>> admin("test = {}")
>> admin("test.f = f")
>> @@ -37,11 +35,9 @@ call("f")
>> call("test.f")
>> call("test.test.f")
>> -print("")
>> print("# Test for Bug #955226")
>> print("# Lua Numbers are passed back wrongly as strings")
>> print("#")
>> -print("")
>> admin("function foo() return 1, 2, '1', '2' end")
>> call("foo")
>> diff --git a/test/replication-py/multi.result
>> b/test/replication-py/multi.result
>> index f90ab22a0..f1ec286ad 100644
>> --- a/test/replication-py/multi.result
>> +++ b/test/replication-py/multi.result
>> @@ -37,27 +37,21 @@ _ = box.space.test:create_index('primary')
>> server 1 is ok
>> server 2 is ok
>> server 3 is ok
>> -
>> Insert records
>> inserted 60 records
>> -
>> Synchronize
>> server 1 done
>> server 2 done
>> server 3 done
>> done
>> -
>> Check data
>> server 1 is ok
>> server 2 is ok
>> server 3 is ok
>> Done
>> -
>> -
>> ----------------------------------------------------------------------
>> Cleanup
>> ----------------------------------------------------------------------
>> server 1 done
>> server 2 done
>> server 3 done
>> -
>> diff --git a/test/replication-py/multi.test.py
>> b/test/replication-py/multi.test.py
>> index a346fd560..c7d415258 100644
>> --- a/test/replication-py/multi.test.py
>> +++ b/test/replication-py/multi.test.py
>> @@ -72,14 +72,12 @@ master_lsn = master.get_lsn(master.id)
>> for server in cluster:
>> server.wait_lsn(master.id, master_lsn)
>> print("server {} is ok".format(server.id))
>> -print("")
>> print("Insert records")
>> for i in range(ROW_N):
>> server = cluster[i % REPLICA_N]
>> server.admin("box.space.test:insert{{{}, {}}}".format(i,
>> server.id), silent = True)
>> print("inserted {} records".format(ROW_N))
>> -print("")
>> print("Synchronize")
>> for server1 in cluster:
>> @@ -87,16 +85,13 @@ for server1 in cluster:
>> server1.wait_lsn(server2.id, server2.get_lsn(server2.id))
>> print("server {} done".format(server1.id))
>> print("done")
>> -print("")
>> print("Check data")
>> for server in cluster:
>> cnt = yaml.safe_load(server.admin("box.space.test:len()",
>> silent = True))[0]
>> print("server {} is {}".format(server.id, cnt == ROW_N and "ok"
>> or "not ok"))
>> print("Done")
>> -print("")
>> -print("")
>> print("----------------------------------------------------------------------")
>> print("Cleanup")
>> print("----------------------------------------------------------------------")
>> @@ -104,7 +99,6 @@
>> print("----------------------------------------------------------------------")
>> for server in cluster:
>> server.stop()
>> print("server {} done".format(server.id))
>> -print("")
>> master.cleanup()
>> master.deploy()
>> diff --git a/test/xlog-py/dup_key.result b/test/xlog-py/dup_key.result
>> index f387e8e89..ce3ffbc55 100644
>> --- a/test/xlog-py/dup_key.result
>> +++ b/test/xlog-py/dup_key.result
>> @@ -27,9 +27,7 @@ box.space.test:insert{2, 'fourth tuple'}
>> ...
>> .xlog does not exist
>> check log line for 'Duplicate key'
>> -
>> 'Duplicate key' exists in server log
>> -
>> box.space.test:get{1}
>> ---
>> - [1, 'first tuple']
>> diff --git a/test/xlog-py/dup_key.test.py b/test/xlog-py/dup_key.test.py
>> index a40133ef2..534221150 100644
>> --- a/test/xlog-py/dup_key.test.py
>> +++ b/test/xlog-py/dup_key.test.py
>> @@ -40,10 +40,8 @@ if not os.access(wal, os.F_OK):
>> server.start()
>> line = "Duplicate key"
>> print("check log line for '{}'".format(line))
>> -print("")
>> if server.logfile_pos.seek_once(line) >= 0:
>> print("'{}' exists in server log".format(line))
>> -print("")
>> server.admin("box.space.test:get{1}")
>> server.admin("box.space.test:get{2}")
>> diff --git a/test/xlog-py/lsn_gap.result b/test/xlog-py/lsn_gap.result
>> index 685fc1efa..8633d76a4 100644
>> --- a/test/xlog-py/lsn_gap.result
>> +++ b/test/xlog-py/lsn_gap.result
>> @@ -21,9 +21,7 @@ box.space.test:insert{4, 'fourth tuple'}
>> - [4, 'fourth tuple']
>> ...
>> check log line for 'ignoring a gap in LSN'
>> -
>> 'ignoring a gap in LSN' exists in server log
>> -
>> box.space.test:select{}
>> ---
>> - - [1, 'first tuple']
>> diff --git a/test/xlog-py/lsn_gap.test.py b/test/xlog-py/lsn_gap.test.py
>> index b80b97146..2d814c42c 100644
>> --- a/test/xlog-py/lsn_gap.test.py
>> +++ b/test/xlog-py/lsn_gap.test.py
>> @@ -31,10 +31,8 @@ os.unlink(wal)
>> server.start()
>> line="ignoring a gap in LSN"
>> print("check log line for '{}'".format(line))
>> -print("")
>> if server.logfile_pos.seek_once(line) >= 0:
>> print("'{}' exists in server log".format(line))
>> -print("")
>> # missing tuple from removed xlog
>> server.admin("box.space.test:select{}")
>> diff --git a/test/xlog-py/misc.result b/test/xlog-py/misc.result
>> index 6c85814b1..8b4a6740c 100644
>> --- a/test/xlog-py/misc.result
>> +++ b/test/xlog-py/misc.result
>> @@ -1,6 +1,4 @@
>> -
>> # xlog file must exist after inserts.
>> -
>> space = box.schema.space.create('tweedledum')
>> ---
>> ...
>> @@ -8,16 +6,12 @@ space = box.schema.space.create('tweedledum')
>> index = space:create_index('primary', { type = 'hash' })
>> ---
>> ...
>> -
>> # a new xlog must be opened after regular termination.
>> -
>> box.space.tweedledum:insert{3, 'third tuple'}
>> ---
>> - [3, 'third tuple']
>> ...
>> -
>> # An xlog file with one record during recovery.
>> -
>> box.space.tweedledum:insert{4, 'fourth tuple'}
>> ---
>> - [4, 'fourth tuple']
>> diff --git a/test/xlog-py/misc.test.py b/test/xlog-py/misc.test.py
>> index 3fcda9504..678031afa 100644
>> --- a/test/xlog-py/misc.test.py
>> +++ b/test/xlog-py/misc.test.py
>> @@ -13,9 +13,7 @@ server.stop()
>> data_path = os.path.join(server.vardir, server.name)
>> -print("")
>> print("# xlog file must exist after inserts.")
>> -print("")
>> filename = str(lsn).zfill(20) + ".xlog"
>> wal = os.path.join(data_path, filename)
>> @@ -30,9 +28,7 @@ server.admin("index =
>> space:create_index('primary', { type = 'hash' })")
>> server.stop()
>> lsn += 2
>> -print("")
>> print("# a new xlog must be opened after regular termination.")
>> -print("")
>> filename = str(lsn).zfill(20) + ".xlog"
>> server.start()
>> @@ -49,9 +45,7 @@ if os.access(wal, os.F_OK):
>> print(".xlog stays around after shutdown")
>> lsn += 1
>> -print("")
>> print("# An xlog file with one record during recovery.")
>> -print("")
>> server.start()
>> filename = str(lsn).zfill(20) + ".xlog"
>> wal = os.path.join(data_path, filename)
>> diff --git a/test/xlog-py/missing.result b/test/xlog-py/missing.result
>> index c52f75c68..826f57296 100644
>> --- a/test/xlog-py/missing.result
>> +++ b/test/xlog-py/missing.result
>> @@ -29,9 +29,7 @@ box.space.test:delete{3}
>> - [3, 'third tuple']
>> ...
>> check log line for 'ignoring a gap in LSN'
>> -
>> 'ignoring a gap in LSN' exists in server log
>> -
>> box.space.test:select{}
>> ---
>> - []
>> diff --git a/test/xlog-py/missing.test.py b/test/xlog-py/missing.test.py
>> index 2fff0df6c..13b3ddd8f 100644
>> --- a/test/xlog-py/missing.test.py
>> +++ b/test/xlog-py/missing.test.py
>> @@ -37,10 +37,8 @@ os.unlink(wal)
>> server.start()
>> line="ignoring a gap in LSN"
>> print("check log line for '{}'".format(line))
>> -print("")
>> if server.logfile_pos.seek_once(line) >= 0:
>> print("'{}' exists in server log".format(line))
>> -print("")
>> # missing tuples from removed xlog
>> server.admin("box.space.test:select{}")
>>
More information about the Tarantool-patches
mailing list