Skip to content
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

Unit test bug: TestAPIAll TestAPIScanKV in api_test.go assert bug, data mixed with other testcase #427

Open
wooln opened this issue Jun 6, 2023 · 0 comments

Comments

@wooln
Copy link
Contributor

wooln commented Jun 6, 2023

TestAPIAll和TestAPIScanKV中均准备了三条数据,在测试分页查询时只断言了返回的position,并末断言trans和kv数量。增加assert.Equal(t, 2, len(m["transactions"].([]interface{})))断言后,单独跑TestAPIAll没问题,但api_test.go单测一起跑该断言会被其他用例产生的数据污染。

看代码只在main_test.go中第一次启动时清理持久层数据。不知道go的单测是否为顺序执行的,若是则可以在这两个单测前执行清理数据,若不是则这类非精确查找单测的数据隔离性有待改进。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant