-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
加入mongodb审核,重写mongodb查询等 #900
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
感谢提交pr
- 单元测试一定要过
其他的事情看评论,另外不要重提pr,请直接在pr分支上提交,如果新开PR我就不再参与了。
说实话这是我们第一个有自己的审核机制的engine,mysql的是调外部审查的,关于这些希望还是保持和之前一样有配套的单元测试,不然后续没人敢改,不好维护的。 |
我把mysql的部分修改回来吧,第一次提pr不太熟悉流程,请多指教 |
不只是mysql的事情,mongo 的engine也是有单元测试的,mongo 的测试也得过 |
|
checks 里travis 里可以点 this build 链接,然后你就可以看到日志 |
我们的engine相关的测试除了mysql外,应该都是patch掉具体的调用,然后看内部逻辑的 #42 参考这个 |
Codecov Report
@@ Coverage Diff @@
## master #900 +/- ##
==========================================
- Coverage 78.27% 77.31% -0.97%
==========================================
Files 77 76 -1
Lines 11030 11503 +473
==========================================
+ Hits 8634 8893 +259
- Misses 2396 2610 +214
Continue to review full report at Codecov.
|
请问Codacy/PR Quality Review中所有的问题都要修改吗?新加的每个方法都要写单元测试? |
👏 恭喜测试全过了,你可以看到 codecov 的 覆盖率报告,里面可以看到哪些覆盖到哪些没覆盖,没有覆盖到的方法建议都写一下测试。 quality 的报告可以做参考,主要是风格方面的,也建议遵照改一下。 |
一是上面的提到的事情, 建议都看一下. Lines 58 to 63 in 20462a1
然后用 Line 84 in 20462a1
|
return self.error_info | ||
|
||
|
||
class JsonDecoder: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个 decoder , 如果有现成的用现成的, 没有现成的所有方法尽量都加上测试. 不然除了作者基本不敢动
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
目前还没有找到现成好用的decoder,这个类可以单独拿出来做一下测试的,我这边本地的测试环境配置有点问题,辛苦你加一下?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我没有办法帮你加测试环境呀,你得自己看是什么问题然后解决
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我没有办法帮你加测试环境呀,你得自己看是什么问题然后解决
它只是一个独立的工具类,它的主要工功能是对语句中db.col.find({"id":123})的{}部分解析成dict,它可以单独拿出来做测试和修改,应该不会像你说的"除了作者不敢动”这么严重,因为我本地测试环境有问题,只能push上来做测试,所以希望你帮忙加一下测试
Co-authored-by: Leo Q <LeoQuote@users.noreply.github.com>
我把语句为空的这个校验去了 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
就这一个地方改了就可以m了,单元测试什么的没条件后续再补吧
如果新的审核需要安装mongo client ,也需要改一下 dockerfile
self.db_name = self.db_name or 'admin' | ||
conn = pymongo.MongoClient(self.host, self.port, authSource=self.db_name, connect=True, connectTimeoutMS=10000) | ||
self.db_name = db_name or 'admin' #=======这里要注意一下 | ||
self.db_name = 'admin' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个按照讨论改一下吧
|
https://github.com/fancy-lee/Archery/blob/archery-fancy/src/docker/Dockerfile-base 帮忙改一下 dockerfile 吧, 在最后面加上你说的那些步骤就可以了. |
已经加完了 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏 LGTM
感谢两位 |
@@ -125,6 +127,10 @@ | |||
<input id="btn-submitsql" type="button" class="btn btn-success" value="SQL提交"/> | |||
</div> | |||
</div> | |||
<div class="text-info"> | |||
<li>提交的语句请以分号结束</li> | |||
<li>[指定执行时间]用于定时任务,不是必选项</li> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
执行时间可能理解有误,这个并不是用于定时,是用于错峰执行
@@ -266,6 +272,7 @@ <h4 class="modal-title text-danger">提交信息确认</h4> | |||
$("#instance_name").change(function () { | |||
var optgroup = $('#instance_name :selected').parent().attr('label'); | |||
$("#div-backup").show(); | |||
if (optgroup != "MySQL") {$("#div-backup").hide(); $("#is_backup").val("False");} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
目前Oracle也支持备份,这块后面我处理一下
1.加入mongodb审核,
2.重写mongodb查询支持原生查询语法
3.查询编辑框加入缓存,避免刷新丢失
4.mongo审核时关闭备份下拉框等
5.优化mongodb查询显示效果