鲲鹏社区首页
中文
注册
我要评分
文档获取效率
文档正确性
内容完整性
文档易理解
在线提单
论坛求助

虚拟化场景用例

以运行hello world的Docker镜像为例,编写功能测试用例。

#! /bin/bash
##################################
# 功能描述: 云测试平台功能性测试案例
# 版本信息: 华为技术有限公司,版权所有(C) 2020-2021
# 修改记录:2021-12-05 修改
# 案例软件为:Docker
# 预置条件:
#   1. Docker已安装完成
##################################
# 测试用例一:运行hello-world镜像
testHelloWorld() {
  result=`docker run hello-world`
  if [[ ! "$result" =~ "Hello from Docker" ]];then
    assertTrue "'$result' not contain 'Hello from Docker'" false
    exit
  fi
  result=`docker run hello-world`
  docker rm $(docker ps -a -f 'ancestor=hello-world' -q)
  if [[ "$result" =~ "hello-world" ]];then
    assertTrue true
  else
    assertTrue "'$result' not contain 'hello-world'" false
  fi
}
# Load and run sUnit2.
. ../shunit2