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 tests fail in component package; 修复ut报错 #528

Closed
1 task
seeflood opened this issue May 3, 2022 · 6 comments · Fixed by #658
Closed
1 task

Unit tests fail in component package; 修复ut报错 #528

seeflood opened this issue May 3, 2022 · 6 comments · Fixed by #658
Assignees
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed kind/bug kind/easy

Comments

@seeflood
Copy link
Member

seeflood commented May 3, 2022

What happened:
Run unit tests under component package:
image

Then you will get some errors:

image

The test cases have dependency on remote environment (and even need some token to run).
We should fix them by mocking all the remote environment.

The failed tests include:

  • qiniu oss
    - [ ] aws s3
  • maybe others?

What you expected to happen:
Run unit tests locally with success

How to reproduce it (as minimally and precisely as possible):

Anything else we need to know?:

@seeflood seeflood added bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed labels May 3, 2022
@seeflood seeflood mentioned this issue May 3, 2022
4 tasks
@Xunzhuo Xunzhuo mentioned this issue May 3, 2022
25 tasks
@Xunzhuo
Copy link
Member

Xunzhuo commented May 3, 2022

Subtask of #529

@seeflood seeflood reopened this Jun 12, 2022
@seeflood seeflood changed the title Unit tests fail in component package Unit tests fail in component package 修复ut报错 Jun 14, 2022
@seeflood seeflood changed the title Unit tests fail in component package 修复ut报错 Unit tests fail in component package; 修复ut报错 Jun 15, 2022
@leemos-xx
Copy link
Member

这个问题可以让我跟进下吗?

@seeflood
Copy link
Member Author

@leemos-xx Ok. Thanks!

@leemos-xx
Copy link
Member

你好,这个问题在 #529 中似乎被标记为fixed,目前我在component目录运行单测时,并没有失败的提示

@wangxingyu000
Copy link

@seeflood seeflood reopened this 5天前

你好,这个问题在 #529 中似乎被标记为fixed,目前我在component目录运行单测时,并没有失败的提示

hello~ 领取任务后欢迎添加 SOFAGirl 微信:SOFAGirl180419,备注“飞船计划”,方便我们之后跟进任务以及发布奖品

@seeflood
Copy link
Member Author

@leemos-xx 我现在本地不报错,但是看了下代码、以及上面的报错信息,猜测是:
ut会给 example.com 发http请求,如果在杭州运行,这个请求会被杭州电信拦截、跳转到 http://safe.zj.189.cn/
image
我查了下这个域名,确实是电信拦截
https://www.v2ex.com/t/807511

anyway, 不管这个拦截的事情,ut其实不该依赖外部环境,或者说,这个ut 最好不要给 example.com发请求
因此可以修改下ut, 有两种改法:

A. mock掉发请求的部分,不发出真实请求
B. 不好mock的话,干脆让ut别测试发请求了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed kind/bug kind/easy
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants