incubator-seata-go icon indicating copy to clipboard operation
incubator-seata-go copied to clipboard

reconstruction the getty module

Open georgehao opened this issue 1 year ago • 4 comments

What would you like to be added:

Why is this needed:

georgehao avatar Mar 31 '23 07:03 georgehao

@georgehao 你是基于什么原因想要重构getty模块的?我这里也发现了getty模块的一点问题,可能需要重构来解决。

问题如下: getty模块所依赖的getty.Session接口中,定义了小写开头的私有方法。这导致我们无法在seata-go中对Session接口进行mock,不方便单元测试,影响测试覆盖率。

iSuperCoder avatar Jul 25 '23 02:07 iSuperCoder

RoBot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


@georgehao What is your reason for wanting to refactor the getty module? I also found a little problem with the getty module here, which may need to be refactored to solve it.

Questions are as follows: In the getty.Session interface on which the getty module depends, private methods starting with lowercase are defined. This makes it impossible for us to mock the Session interface in seata-go, which is inconvenient for unit testing and affects test coverage.

Issues-translate-bot avatar Jul 25 '23 02:07 Issues-translate-bot

getty 到处都是用的单例模式,这点不太能接受。模块跟模块之间的联系表达的不清晰

georgehao avatar Jul 25 '23 08:07 georgehao

RoBot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


The singleton pattern used everywhere in getty is not acceptable. The relationship between modules and modules is not clearly expressed

Issues-translate-bot avatar Jul 25 '23 08:07 Issues-translate-bot