我正在尝试为Flutter项目构建TeamCity的CICD实例。当前,我具有用于克隆Flutter存储库并运行Flutter doctor
的命令脚本。但是,我的最后一步无法正常工作-运行Flutter test
。
在尝试进行默认widget_test.dart
的无限加载之前,会出现堆栈跟踪:
[19:05:51] [Step 2/2] Shell: #0 _WebSocketImpl.connect.<anonymous closure>.error (dart:_http/websocket_impl.dart:1049:9)
[19:05:51] [Step 2/2] Shell: #1 _WebSocketImpl.connect.<anonymous closure> (dart:_http/websocket_impl.dart:1058:14)
[19:05:51] [Step 2/2] Shell: #2 _rootRunUnary (dart:async/zone.dart:1132:38)
[19:05:51] [Step 2/2] Shell: #3 _CustomZone.runUnary (dart:async/zone.dart:1029:19)
[19:05:51] [Step 2/2] Shell: #4 _FutureListener.handleValue (dart:async/future_impl.dart:126:18)
[19:05:51] [Step 2/2] Shell: #5 Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:639:45)
[19:05:51] [Step 2/2] Shell: #6 Future._propagateToListeners (dart:async/future_impl.dart:668:32)
[19:05:51] [Step 2/2] Shell: #7 Future._completeWithValue (dart:async/future_impl.dart:483:5)
[19:05:51] [Step 2/2] Shell: #8 Future.wait.<anonymous closure> (dart:async/future.dart:400:22)
[19:05:51] [Step 2/2] Shell: #9 _rootRunUnary (dart:async/zone.dart:1132:38)
[19:05:51] [Step 2/2] Shell: #10 _CustomZone.runUnary (dart:async/zone.dart:1029:19)
[19:05:51] [Step 2/2] Shell: #11 _FutureListener.handleValue (dart:async/future_impl.dart:126:18)
[19:05:51] [Step 2/2] Shell: #12 Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:639:45)
[19:05:51] [Step 2/2] Shell: #13 Future._propagateToListeners (dart:async/future_impl.dart:668:32)
[19:05:51] [Step 2/2] Shell: #14 Future._completeWithValue (dart:async/future_impl.dart:483:5)
[19:05:51] [Step 2/2] Shell: #15 Future._asyncComplete.<anonymous closure> (dart:async/future_impl.dart:513:7)
[19:05:51] [Step 2/2] Shell: #16 _rootRun (dart:async/zone.dart:1124:13)
[19:05:51] [Step 2/2] Shell: #17 _CustomZone.run (dart:async/zone.dart:1021:19)
[19:05:51] [Step 2/2] Shell: #18 _CustomZone.runGuarded (dart:async/zone.dart:923:7)
[19:05:51] [Step 2/2] Shell: #19 _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:963:23)
[19:05:51] [Step 2/2] Shell: #20 _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
[19:05:51] [Step 2/2] Shell: #21 _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
最终错误是
Failed to load "/root/TeamCity/buildAgent/work/700f5361a835c53d/test/widget_test.dart":
[19:10:50] [Step 2/2] Test never connected to test harness.
[19:10:50] [Step 2/2] Test: /root/TeamCity/buildAgent/work/700f5361a835c53d/test/widget_test.dart
[19:10:50] [Step 2/2] Shell: /root/TeamCity/buildAgent/work/700f5361a835c53d/flutter/bin/cache/artifacts/engine/linux-x64/flutter_tester
任何人都可以解决此问题:Flutter还是很新的东西,关于如何设置它的文档也很少。
任何帮助将不胜感激。谢谢
这是用于新的TeamCity构建。我在下面添加了环境变量,因为Flutter Doctor的代理位抱怨:
env.NO_PROXY=localhost,127.0.0.1
答案 0 :(得分:0)
我的团队的默认代理覆盖了变量env变量no_proxy
在命令脚本中,我只需将127.0.0.1
附加到现有的env变量即可,并且可以正常工作。