离线模拟以进行自动化构建和单元测试 (linux)
在我看来,一旦签出工作副本,自动构建和构建就会完成。测试不需要网络连接来完成其工作。
在开发过程中,对网络服务的依赖可能会潜入 - 单元测试尝试调用 Web 服务 - xml 库尝试下载 DTD。我试图避免这种情况,因为它会使构建变得脆弱并且难以重现。
我想在离线环境中进行构建。是否可以为此设置一个沙箱,可以随意离线?
我考虑过在构建脚本中的适当位置简单地调用“ifdown”和“ifup”,尽管这看起来也很脆弱,但存在“ifup”永远不会被调用的风险。
我正在考虑的另一个解决方案是使用虚拟机。有人有这样的设置经验吗?
我们的构建服务器在 Linux (ubuntu 9.10) 上运行。
In my opinion, once a working copy is checked out, the automated build & test should not need a network connection to do its job.
During development, a dependency on network services may sneak in - a unit test tries to call a webservice - an xml library tries to download a DTD. I'm trying to avoid this because it makes the build fragile and fail in difficult to reproduce ways.
I'd like to do the build in an offline environment. Is it possible to set up a sandbox for that, that can be taken offline at will?
I've considered simply calling "ifdown" and "ifup" at appropriate points in the build script, although that seems fragile as well, there is the risk that "ifup" never gets called.
Another solution I'm considering is using a virtual machine. Does anyone have experience with such a setup?
Our build server is running on linux (ubuntu 9.10).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我以前用虚拟机做过这个。我会让主机从源代码管理中提取工作副本并与虚拟机共享该目录(其机制取决于您正在使用的虚拟机解决方案)。然后,虚拟机可以运行测试,而无需启动和关闭网络。
I have done this with a Virtual Machine before. I would have the host machine pull a working copy from source control and share that directory with the VM ( the mechanism for that depends on the VM solution you are using ). The VM can then run the tests without having to bring the network up and down.