From: AKhatskevich <avkhatskevich@tarantool.org> To: v.shpilevoy@tarantool.org, tarantool-patches@freelists.org Subject: [tarantool-patches] [PATCH] Check self arg passed for router objects Date: Wed, 1 Aug 2018 17:07:52 +0300 [thread overview] Message-ID: <20180801140752.2920-1-avkhatskevich@tarantool.org> (raw) In-Reply-To: <cover.1532940401.git.avkhatskevich@tarantool.org> Raise an exception in case someone calls router like `router.info()` instead of `router:info()`. --- test/multiple_routers/multiple_routers.result | 5 +++++ test/multiple_routers/multiple_routers.test.lua | 3 +++ vshard/router/init.lua | 9 +++++++++ 3 files changed, 17 insertions(+) diff --git a/test/multiple_routers/multiple_routers.result b/test/multiple_routers/multiple_routers.result index 33f4034..389bf9a 100644 --- a/test/multiple_routers/multiple_routers.result +++ b/test/multiple_routers/multiple_routers.result @@ -201,6 +201,11 @@ routers[5]:call(1, 'read', 'do_select', {2}) --- - [[2, 2]] ... +-- Self checker. +util.check_error(router_2.info) +--- +- Use router:info(...) instead of router.info(...) +... _ = test_run:cmd("switch default") --- ... diff --git a/test/multiple_routers/multiple_routers.test.lua b/test/multiple_routers/multiple_routers.test.lua index 6d470e1..2f159c7 100644 --- a/test/multiple_routers/multiple_routers.test.lua +++ b/test/multiple_routers/multiple_routers.test.lua @@ -76,6 +76,9 @@ vshard.router.call(1, 'read', 'do_select', {1}) router_2:call(1, 'read', 'do_select', {2}) routers[5]:call(1, 'read', 'do_select', {2}) +-- Self checker. +util.check_error(router_2.info) + _ = test_run:cmd("switch default") test_run:cmd("stop server router_1") test_run:cmd("cleanup server router_1") diff --git a/vshard/router/init.lua b/vshard/router/init.lua index 128628b..e0a39b2 100644 --- a/vshard/router/init.lua +++ b/vshard/router/init.lua @@ -860,6 +860,15 @@ local router_mt = { } } +-- +-- Wrap self methods with a sanity checker. +-- +local mt_index = {} +for name, func in pairs(router_mt.__index) do + mt_index[name] = util.generate_self_checker("router", name, router_mt, func) +end +router_mt.__index = mt_index + -- Table which represents this module. local module = {} -- 2.14.1
next prev parent reply other threads:[~2018-08-01 14:08 UTC|newest] Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-07-30 8:56 [tarantool-patches] [PATCH v4] vshard module reload AKhatskevich 2018-07-30 8:56 ` [tarantool-patches] [PATCH 1/4] Fix races related to object outdating AKhatskevich 2018-07-30 11:55 ` [tarantool-patches] " Vladislav Shpilevoy 2018-07-30 16:46 ` Alex Khatskevich 2018-07-30 17:50 ` Vladislav Shpilevoy 2018-07-31 11:05 ` Alex Khatskevich 2018-08-01 12:36 ` Vladislav Shpilevoy 2018-08-01 17:44 ` Alex Khatskevich 2018-08-02 11:51 ` Vladislav Shpilevoy 2018-07-30 8:56 ` [tarantool-patches] [PATCH 2/4] Refactor reloadable fiber AKhatskevich 2018-07-30 11:55 ` [tarantool-patches] " Vladislav Shpilevoy 2018-07-31 11:24 ` Alex Khatskevich 2018-07-31 11:30 ` Alex Khatskevich 2018-08-01 11:54 ` Vladislav Shpilevoy 2018-07-30 8:56 ` [tarantool-patches] [PATCH 3/4] tests: separate bootstrap routine to a lua_libs AKhatskevich 2018-08-01 12:03 ` [tarantool-patches] " Vladislav Shpilevoy 2018-07-30 8:56 ` [tarantool-patches] [PATCH 4/4] Introduce storage reload evolution AKhatskevich 2018-07-30 11:55 ` [tarantool-patches] " Vladislav Shpilevoy 2018-07-31 11:29 ` Alex Khatskevich 2018-07-31 11:33 ` Alex Khatskevich 2018-08-01 12:36 ` Vladislav Shpilevoy 2018-08-01 18:09 ` Alex Khatskevich 2018-08-02 11:40 ` Vladislav Shpilevoy 2018-08-02 11:46 ` Vladislav Shpilevoy 2018-08-06 10:59 ` Alex Khatskevich 2018-08-06 15:36 ` Vladislav Shpilevoy 2018-08-06 16:08 ` Alex Khatskevich 2018-08-06 17:18 ` Vladislav Shpilevoy 2018-08-07 9:14 ` Alex Khatskevich 2018-08-08 10:35 ` Vladislav Shpilevoy 2018-08-01 14:07 ` AKhatskevich [this message] 2018-07-31 16:25 [tarantool-patches] [PATCH 0/3] multiple routers AKhatskevich 2018-08-01 14:30 ` [tarantool-patches] [PATCH] Check self arg passed for router objects AKhatskevich
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20180801140752.2920-1-avkhatskevich@tarantool.org \ --to=avkhatskevich@tarantool.org \ --cc=tarantool-patches@freelists.org \ --cc=v.shpilevoy@tarantool.org \ --subject='Re: [tarantool-patches] [PATCH] Check self arg passed for router objects' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox