创建资源池接口测试用例

接口参数描述:

  1. clusterName String类型,必填字段,表示资源池所在的集群名称
  2. name String类型,必填字段,表示资源池名称
  3. namespace String类型,必填字段, 表示资源池所属的命名空间。如果集群限制用户使用的命名空间,则该值必须为cluster namespaceList中值。如果集群不限制用户使用的命名空间,则该值可以是集群上任意命名空间。命名空间取值规范:a-z0-9?且长度不超过63 当namespace在集群中不存在时,会自动在集群中创建该namespace
  4. quotaType String类型,必填字段,表示资源池上资源Quota的类型,枚举类型,分别是 :volcanoCapabilityQuota、elasticQuota,默认类型elasticQuota
  5. maxResources String类型,必填字段,表示资源池的资源上限
  6. minResources String类型,非必填字段, 表示资源池的最小资源保障,当Quota类型为elasticQuota时,必填参数
  7. schedulingPolicy List,非必填字段, 表示资源池上任务的排队策略,保留字段
  8. location Map[String]String,非必填字段, 表示资源池的亲和性,队列与哪些节点绑定,保留字段

测试用例:

  1. 测试case名称:创建资源池-必填字段缺失

    • 测试步骤:

      1. 将clusterName参数设为空。
      2. 将name参数设为空。
      3. 将namespace参数设为空。
      4. 将quotaType参数设为空。
      5. 将maxResources参数设为空。
      6. 发送请求。
    • 预期结果:

      1. 返回状态码400,返回信息包含'clusterName参数为必填字段'。
      2. 返回状态码400,返回信息包含'name参数为必填字段'。
      3. 返回状态码400,返回信息包含'namespace参数为必填字段'。
      4. 返回状态码400,返回信息包含'quotaType参数为必填字段'。
      5. 返回状态码400,返回信息包含'maxResources参数为必填字段'。
  2. 测试case名称:创建资源池-成功创建

    • 测试步骤:

      1. 设置clusterName参数为'test_cluster'。
      2. 设置name参数为'test_pool'。
      3. 设置namespace参数为'test_namespace'。
      4. 设置quotaType参数为'elasticQuota'。
      5. 设置maxResources参数为'100'。
      6. 发送请求。
    • 预期结果:

      1. 返回状态码200。
      2. 返回信息中包含'资源池创建成功'。
      3. 能够在'test_cluster'集群中找到名称为'test_pool'的资源池。
      4. 能够在'test_cluster'集群中找到名称为'test_namespace'的命名空间。
  3. 测试case名称:创建资源池-命名空间不存在自动创建

    • 测试步骤:

      1. 设置clusterName参数为'test_cluster'。
      2. 设置name参数为'test_pool'。
      3. 设置namespace参数为'new_namespace'。
      4. 设置quotaType参数为'elasticQuota'。
      5. 设置maxResources参数为'100'。
      6. 发送请求。
    • 预期结果:

      1. 返回状态码200。
      2. 返回信息中包含'资源池创建成功'。
      3. 能够在'test_cluster'集群中找到名称为'test_pool'的资源池。
      4. 能够在'test_cluster'集群中找到名称为'new_namespace'的命名空间。
  4. 测试case名称:创建资源池-命名空间不存在且命名空间名称非法

    • 测试步骤:

      1. 设置clusterName参数为'test_cluster'。
      2. 设置name参数为'test_pool'。
      3. 设置namespace参数为'invalid_@_namespace'。
      4. 设置quotaType参数为'elasticQuota'。
      5. 设置maxResources参数为'100'。
      6. 发送请求。
    • 预期结果:

      1. 返回状态码400,返回信息包含'namespace参数格式不合法'。
  5. 测试case名称:创建资源池-Quota类型为volcanoCapabilityQuota

    • 测试步骤:

      1. 设置clusterName参数为'test_cluster'。
      2. 设置name参数为'test_pool'。
      3. 设置namespace参数为'test_namespace'。
      4. 设置quotaType参数为'volcanoCapabilityQuota'。
      5. 设置maxResources参数为'100'。
      6. 发送请求。
    • 预期结果:

      1. 返回状态码200。
      2. 返回信息中包含'资源池创建成功'。
      3. 能够在'test_cluster'集群中找到名称为'test_pool'的资源池。
      4. 资源池上的资源Quota类型为'volcanoCapabilityQuota'。
  6. 测试case名称:创建资源池-Quota类型为elasticQuota且minResources参数为空

    • 测试步骤:

      1. 设置clusterName参数为'test_cluster'。
      2. 设置name参数为'test_pool'。
      3. 设置namespace参数为'test_namespace'。
      4. 设置quotaType参数为'elasticQuota'。
      5. 设置maxResources参数为'100'。
      6. 发送请求。
    • 预期结果:

      1. 返回状态码400,返回信息包含'minResources参数为必填字段'。
  7. 测试case名称:创建资源池-Quota类型为elasticQuota且minResources参数为非数字

    • 测试步骤:

      1. 设置clusterName参数为'test_cluster'。
      2. 设置name参数为'test_pool'。
      3. 设置namespace参数为'test_namespace'。
      4. 设置quotaType参数为'elasticQuota'。
      5. 设置maxResources参数为'100'。
      6. 将minResources参数设为'abc'。
      7. 发送请求。
    • 预期结果:

      1. 返回状态码400,返回信息包含'minResources参数格式不合法'。
  8. 测试case名称:创建资源池-Quota类型为elasticQuota且minResources参数为数字

    • 测试步骤:

      1. 设置clusterName参数为'test_cluster'。
      2. 设置name参数为'test_pool'。
      3. 设置namespace参数为'test_namespace'。
      4. 设置quotaType参数为'elasticQuota'。
      5. 设置maxResources参数为'100'。
      6. 将minResources参数设为'50'。
      7. 发送请求。
    • 预期结果:

      1. 返回状态码200。
      2. 返回信息中包含'资源池创建成功'。
      3. 能够在'test_cluster'集群中找到名称为'test_pool'的资源池。
      4. 资源池上的最小资源保障为50。
创建资源池接口测试用例

原文地址: https://www.cveoy.top/t/topic/nF3f 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录