diff --git a/test/src/test/groovy/org/zstack/test/integration/kvm/vm/SimpleVmLifeCycleCase.groovy b/test/src/test/groovy/org/zstack/test/integration/kvm/vm/SimpleVmLifeCycleCase.groovy new file mode 100644 index 00000000000..601177a1f56 --- /dev/null +++ b/test/src/test/groovy/org/zstack/test/integration/kvm/vm/SimpleVmLifeCycleCase.groovy @@ -0,0 +1,51 @@ +package org.zstack.test.integration.kvm.vm + +import org.zstack.header.vm.VmInstanceState +import org.zstack.header.vm.VmInstanceVO +import org.zstack.sdk.VmInstanceInventory +import org.zstack.test.integration.kvm.Env +import org.zstack.test.integration.kvm.KvmTest +import org.zstack.testlib.EnvSpec +import org.zstack.testlib.SubCase + +/** + * 最小化虚拟机测试用例 + * 仅验证虚拟机创建后的状态 + */ +class SimpleVmLifeCycleCase extends SubCase { + + EnvSpec env + + @Override + void setup() { + useSpring(KvmTest.springSpec) + } + + @Override + void environment() { + env = Env.oneVmTwoHostNfsEnv() + } + + @Override + void test() { + env.create { + testVmIsRunningAfterCreation() + } + } + + /** + * 测试:创建后虚拟机应处于 Running 状态 + */ + void testVmIsRunningAfterCreation() { + VmInstanceInventory vm = env.inventoryByName("vm") as VmInstanceInventory + + VmInstanceVO vo = dbFindByUuid(vm.uuid, VmInstanceVO.class) + assert vo != null + assert vo.state == VmInstanceState.Running + } + + @Override + void clean() { + env.delete() + } +} diff --git a/test/src/test/resources/zstack.properties b/test/src/test/resources/zstack.properties index 42fa9e4f1ef..541391f0734 100755 --- a/test/src/test/resources/zstack.properties +++ b/test/src/test/resources/zstack.properties @@ -1,88 +1,88 @@ -#DbFacadeDataSource.jdbcUrl=jdbc:mysql://192.168.0.214:3306/zstack -DB.url=jdbc:mysql://localhost:3306/ -DB.user=root -DB.password= -DB.idleConnectionTestPeriod=500 -DB.maxIdleTime=600 - -DbFacadeDataSource.maxPoolSize=64 - -RESTFacade.hostname=localhost -RESTFacade.port=8989 -RESTFacade.path= - -KVMHostFactory.agentPort=8989 - -Ceph.backupStorageAgent.port=8989 -Ceph.primaryStorageAgent.port=8989 - -Zbs.primaryStorageAgent.port=8989 - -SftpBackupStorageFactory.deployPuppetModule=false -SftpBackupStorage.agentPort=8989 - -CdpBackupStorage.agentPort=8989 -ImageStoreBackupStorage.agentPort=8989 -Zabbix.port=8989 - -NfsPrimaryStorageKVMBackend.syncGetCapacity=true - -VirtualRouterManager.agentPort=8989 -VirtualRouterManager.cleanVirtualRouterVmWhenFail=true - -ManagementServerConsoleProxyBackend.agentPort=8989 - -IscsiFileSystemBackendPrimaryStorage.agentPort=8989 - -BaremetalPxeServer.agentPort=8989 - -httpConsoleProxyPort = 8989 - -AppBuildSystem.agentPort=8989 - -Zdfs.agentPort=8989 - -ApiMediator.apiWorkerNum=50 - -unitTestOn=true -elaboration.slowThresholdMs=200 -exitJVMOnStop=false - -#CloudBus.closeTracker=true -#CloudBus.messageTTL=1 -#CloudBus.closeTracker=true - -#vmTracerOn=false -#Simulator.notCacheAgentCommand=true - -ErrorFacade.dumpOnError=false - -#ThreadFacade.maxThreadNum=2100 - -Ansible.cfg.forks=100 -Ansible.cfg.host_key_checking=False -Ansible.cfg.pipelining=True - -CloudBus.serverIp.0 = localhost - -org.jboss.logging.provider=slf4j - -exposeSimulatorType=true - -Cassandra.contactPoints=127.0.0.1 -Cassandra.port=9042 -Cassandra.keyspace=zstack_billing -Cassandra.bin=~/apache-cassandra-2.2.3/bin/cassandra -Cassandra.cqlsh=~/apache-cassandra-2.2.3/bin/cqlsh - -PrimaryStorage.capacityTrackerOn=true -shadowEntityOn=true -isThreadContextMapInheritable=true -enableElaboration=true -Prometheus.versionMode=2.x -InfluxDB.metadata.version=v2 - -chain.task.qos=true - -identity.init.type= - +#DbFacadeDataSource.jdbcUrl=jdbc:mysql://192.168.0.214:3306/zstack +DB.url=jdbc:mysql://localhost:3306/ +DB.user=root +DB.password= +DB.idleConnectionTestPeriod=500 +DB.maxIdleTime=600 + +DbFacadeDataSource.maxPoolSize=64 + +RESTFacade.hostname=localhost +RESTFacade.port=8989 +RESTFacade.path= + +KVMHostFactory.agentPort=8989 + +Ceph.backupStorageAgent.port=8989 +Ceph.primaryStorageAgent.port=8989 + +Zbs.primaryStorageAgent.port=8989 + +SftpBackupStorageFactory.deployPuppetModule=false +SftpBackupStorage.agentPort=8989 + +CdpBackupStorage.agentPort=8989 +ImageStoreBackupStorage.agentPort=8989 +Zabbix.port=8989 + +NfsPrimaryStorageKVMBackend.syncGetCapacity=true + +VirtualRouterManager.agentPort=8989 +VirtualRouterManager.cleanVirtualRouterVmWhenFail=true + +ManagementServerConsoleProxyBackend.agentPort=8989 + +IscsiFileSystemBackendPrimaryStorage.agentPort=8989 + +BaremetalPxeServer.agentPort=8989 + +httpConsoleProxyPort = 8989 + +AppBuildSystem.agentPort=8989 + +Zdfs.agentPort=8989 + +ApiMediator.apiWorkerNum=50 + +unitTestOn=true +elaboration.slowThresholdMs=200 +exitJVMOnStop=false + +#CloudBus.closeTracker=true +#CloudBus.messageTTL=1 +#CloudBus.closeTracker=true + +#vmTracerOn=false +#Simulator.notCacheAgentCommand=true + +ErrorFacade.dumpOnError=false + +#ThreadFacade.maxThreadNum=2100 + +Ansible.cfg.forks=100 +Ansible.cfg.host_key_checking=False +Ansible.cfg.pipelining=True + +CloudBus.serverIp.0 = localhost + +org.jboss.logging.provider=slf4j + +exposeSimulatorType=true + +Cassandra.contactPoints=127.0.0.1 +Cassandra.port=9042 +Cassandra.keyspace=zstack_billing +Cassandra.bin=~/apache-cassandra-2.2.3/bin/cassandra +Cassandra.cqlsh=~/apache-cassandra-2.2.3/bin/cqlsh + +PrimaryStorage.capacityTrackerOn=true +shadowEntityOn=true +isThreadContextMapInheritable=true +enableElaboration=true +Prometheus.versionMode=2.x +InfluxDB.metadata.version=v2 + +chain.task.qos=true + +identity.init.type= +