我正在编写一些需要针对一系列不同数据库产品工作的代码。
- MySql
- Sql Server 2000 至 2008
- PostgreSQL
- Oracle 9i & 10g
- Jet 4.0 (MS Access)
- MSDE
- Sybase Adaptive Server Anywhere
- Sybase Sql Anywhere
- Progress OpenEdge
我们需要针对每个数据库产品运行一组通用集成测试,作为持续集成构建的一部分。
我确信其他人也必须设置类似的测试环境,我想利用其中的一些智慧 - 您最终使用了哪些策略,哪些有效或无效?
一些想法:
- 为每个产品提供单独的虚拟机,每个虚拟机分配少量内存(在某些情况下更容易管理,或者我们对各个产品的设置略有不同)。
- 几个虚拟机,甚至一个用于所有产品的虚拟机(即可能是用于 postgresql 和 mysql 的 ubuntu 盒子,以及用于其余产品的 Windows 2008 服务器机器) - 我喜欢一两个虚拟机,因为这是一个更用于运行测试的便携式环境,即在路上/异地时,因为我的笔记本电脑可能会在运行 8 或 10 个小型虚拟机时慢慢停止。
最后,您如何解决其中一些商业产品(例如 Oracle 或 Progress OpenEdge)高昂的成本问题?以前的版本是否仍然可用,即是否有免费的“单一开发人员”版本可用,或者购买这些产品的更便宜的途径?
I'm writing some code that needs to work against an array of different database products.
- MySql
- Sql Server 2000 to 2008
- PostgreSQL
- Oracle 9i & 10g
- Jet 4.0 (MS Access)
- MSDE
- Sybase Adaptive Server Anywhere
- Sybase Sql Anywhere
- Progress OpenEdge
We have a set of generic integration tests that we need to run against each database product, as part of a continuous integration build.
I'm sure other people have had to set-up similar test environments and I would like to tap into some of that wisdom - what strategies do you end up using, what worked well or did not work well?
Some thoughts:
- Separate virtual machines for each of the products, each allocated a small amount of memory (easier to manage for certain scenarios, or where we have slightly different setup's for individual products).
- A couple of virtual machines or even a single virtual machine for all the products (i.e. perhaps an ubuntu box for postgresql & mysql, and a windows 2008 server machine for the remaining products) - I like one or two vm's because this is a more portable environment for running the tests i.e. when on the road / off-site, as my laptop would probably crawl to a halt running 8 or 10 small VM's.
And finally how have you tackled the prohibitive cost of some of these commercial products i.e. Oracle or Progress OpenEdge, and are the previous versions still available i.e. are there free "single-developer" editions available, or cheaper routes to purchasing these products?
发布评论
评论(6)
我们在这里所做的(主要是)为每个所需的配置准备一个虚拟机,我们还针对不同的操作系统,因此我们正在测试大约 22 个配置。 这些虚拟机托管在 ESX 服务器中,并编写脚本以在需要时启动和停止,以便它们不会同时运行。 设置工作量很多。
就数据库服务器的成本而言,我们正在构建的软件类型需要高端版本,因此测试成本已计入总体开发成本(我们只能“忍耐”)
What we do here is (mostly) a VM for each configuration required, we also target different operating systems so have something like 22 configurations we are testing. These VM's are hosted in an ESX server, and scripted to start and stop when required so that they are not all running at once. It was a lot of work to set up.
In terms of cost of the Database servers, the kind of software we are building required top-end versions so the testing costs have been factored into the overall dev costs (we just had to "suck it up")
Oracle 确实有一个免费的“Express Edition”。 它不具备 Oracle 的所有功能,但如果您还针对 Jet 运行,那么这应该不是问题。
Oracle does have a free 'Express Edition'. It doesn't have all of Oracle's functionality but then if you are also running against Jet then that shouldn't be an issue.
从架构上来说,最好创建一个足够强大的服务器集成测试场来运行各种配置的虚拟机。 它前面可以有一个队列进程来监听集成测试请求(可以使用 svn 提交或其他源代码控制检查触发器来触发)。
为了获得最准确的测试范围,您可能希望每个配置都有一个单独的虚拟机。 这将降低配置冲突的风险,并提高运行自定义虚拟机集的灵活性(例如,Oracle + MySQL + PostgreSQL,而不是其他虚拟机等)。 根据您的构建过程,它还可能允许您运行 10 分钟的构建。
运行集成测试场的一个好处是,如果您在路上使用笔记本电脑,则可以在代码签入后触发集成构建,运行所有测试并让它通知您结果。 您还可以存档每个请求和结果,以帮助诊断失败的构建。
Architecturally, it may be better off creating an integration testing farm of server(s) that are powerful enough to run the variously configured VMs. It could be fronted with a queue process listening for integration testing requests (which could be triggered using svn commits or other source control check in triggers).
For the most accurate range of testing, you probably want to have a separate VM for each configuration. This will reduce the risk of conflicting configs and also increase the flexibility of running a custom set of VMs (e.g. Oracle + MySQL + PostgreSQL and not the others, etc.). Depending on your build process, it may also allow you to run 10-minute builds.
A benefit of running an integration test farm is that if you're on the road using your laptop, you can trigger off the integration build after code check-in, run all the tests and have it notify you of the results. You can also archive each request and the results to help diagnose failing builds.
Oracle 许可证摘录:
因此,您可以下载完整的 Oracle 版本 9、10 和 11,并按照许可证中的说明免费使用它们。
检查下载部分 www.oracle.com
Oracle license excerpt:
So, you can download full Oracle versions 9, 10 and 11 and use them free of charge as stated in license.
Check downloads section at www.oracle.com
听起来你已经很清楚该做什么了。 我建议采用以下 VM 布局:
托管以下虚拟机的 Windows Server 2008 机器:
在 Ubuntu 或 Red Hat 机器上:
我认为没有必要针对完整的 SQL 和 Oracle 进行测试版本。 免费版本已被精简,因此当您在这些服务器的完整版本上运行它时,代码破坏的风险非常小。 如果您已经针对完整服务器进行了测试并使用了免费的东西,那么是的,有些东西可能会损坏,但是通过使用最小公分母进行测试,您应该确保良好的质量。
It sounds like you have a good idea of what to do already. I'd suggest the following VM layouts:
A Windows Server 2008 box hosting the following:
On an Ubuntu or Red Hat box:
I don't see any need to test against the full blown SQL and Oracle editions. The free editions are stripped down, so there is very little risk of that code breaking when you run it against the full version of those servers. If you had tested against the full server and went down to the free stuff, then yes some things might break, but by testing with the least common denominator, you should ensure good quality.