|
| 1 | +""" Code is generated by ucloud-model, DO NOT EDIT IT. """ |
| 2 | + |
| 3 | +import pytest |
| 4 | +import logging |
| 5 | + |
| 6 | +from ucloud.core import exc |
| 7 | +from ucloud.testing import env, funcs, op, utest |
| 8 | + |
| 9 | +logger = logging.getLogger(__name__) |
| 10 | + |
| 11 | + |
| 12 | +scenario = utest.Scenario(113) |
| 13 | + |
| 14 | + |
| 15 | +@pytest.mark.skipif(env.is_ut(), reason=env.get_skip_reason()) |
| 16 | +def test_set_113(client: utest.Client, variables: dict): |
| 17 | + scenario.initial(variables) |
| 18 | + |
| 19 | + scenario.variables["Region"] = "cn-bj2" |
| 20 | + scenario.variables["Zone"] = "cn-bj2-02" |
| 21 | + |
| 22 | + scenario.run(client) |
| 23 | + |
| 24 | + |
| 25 | +@scenario.step( |
| 26 | + max_retries=0, |
| 27 | + retry_interval=0, |
| 28 | + startup_delay=3, |
| 29 | + fast_fail=False, |
| 30 | + validators=lambda variables: [("str_eq", "RetCode", 0)], |
| 31 | + action="CreateUFSVolume", |
| 32 | +) |
| 33 | +def create_ufs_volume_00(client: utest.Client, variables: dict): |
| 34 | + d = {"Zone": variables.get("Zone"), "Size": 1024, "Region": variables.get("Region")} |
| 35 | + |
| 36 | + try: |
| 37 | + resp = client.invoke("CreateUFSVolume", d) |
| 38 | + except exc.RetCodeException as e: |
| 39 | + resp = e.json() |
| 40 | + |
| 41 | + variables["Volume_Id"] = utest.value_at_path(resp, "VolumeId") |
| 42 | + variables["Volume_Name"] = utest.value_at_path(resp, "VolumeName") |
| 43 | + return resp |
| 44 | + |
| 45 | + |
| 46 | +@scenario.step( |
| 47 | + max_retries=0, |
| 48 | + retry_interval=0, |
| 49 | + startup_delay=0, |
| 50 | + fast_fail=False, |
| 51 | + validators=lambda variables: [("str_eq", "RetCode", 0)], |
| 52 | + action="DescribeUFSVolume", |
| 53 | +) |
| 54 | +def describe_ufs_volume_01(client: utest.Client, variables: dict): |
| 55 | + d = { |
| 56 | + "Zone": variables.get("Zone"), |
| 57 | + "VolumeId": variables.get("Volume_Id"), |
| 58 | + "Region": variables.get("Region"), |
| 59 | + } |
| 60 | + |
| 61 | + try: |
| 62 | + resp = client.invoke("DescribeUFSVolume", d) |
| 63 | + except exc.RetCodeException as e: |
| 64 | + resp = e.json() |
| 65 | + |
| 66 | + return resp |
| 67 | + |
| 68 | + |
| 69 | +@scenario.step( |
| 70 | + max_retries=0, |
| 71 | + retry_interval=0, |
| 72 | + startup_delay=0, |
| 73 | + fast_fail=False, |
| 74 | + validators=lambda variables: [("str_eq", "RetCode", 0)], |
| 75 | + action="DescribeUHostLite", |
| 76 | +) |
| 77 | +def describe_uhost_lite_02(client: utest.Client, variables: dict): |
| 78 | + d = {"Zone": variables.get("Zone"), "Region": variables.get("Region")} |
| 79 | + |
| 80 | + try: |
| 81 | + resp = client.invoke("DescribeUHostLite", d) |
| 82 | + except exc.RetCodeException as e: |
| 83 | + resp = e.json() |
| 84 | + |
| 85 | + return resp |
| 86 | + |
| 87 | + |
| 88 | +@scenario.step( |
| 89 | + max_retries=0, |
| 90 | + retry_interval=0, |
| 91 | + startup_delay=0, |
| 92 | + fast_fail=False, |
| 93 | + validators=lambda variables: [("str_eq", "RetCode", 0)], |
| 94 | + action="DescribeUFSVolume", |
| 95 | +) |
| 96 | +def describe_ufs_volume_03(client: utest.Client, variables: dict): |
| 97 | + d = { |
| 98 | + "Zone": variables.get("Zone"), |
| 99 | + "VolumeId": "Volume_Id", |
| 100 | + "Region": variables.get("Region"), |
| 101 | + } |
| 102 | + |
| 103 | + try: |
| 104 | + resp = client.invoke("DescribeUFSVolume", d) |
| 105 | + except exc.RetCodeException as e: |
| 106 | + resp = e.json() |
| 107 | + |
| 108 | + return resp |
| 109 | + |
| 110 | + |
| 111 | +@scenario.step( |
| 112 | + max_retries=0, |
| 113 | + retry_interval=0, |
| 114 | + startup_delay=0, |
| 115 | + fast_fail=False, |
| 116 | + validators=lambda variables: [("str_eq", "RetCode", 0)], |
| 117 | + action="ClearUFSVolumeWhiteList", |
| 118 | +) |
| 119 | +def clear_ufs_volume_white_list_04(client: utest.Client, variables: dict): |
| 120 | + d = {"VolumeId": variables.get("Volume_Id"), "Region": variables.get("Region")} |
| 121 | + |
| 122 | + try: |
| 123 | + resp = client.invoke("ClearUFSVolumeWhiteList", d) |
| 124 | + except exc.RetCodeException as e: |
| 125 | + resp = e.json() |
| 126 | + |
| 127 | + return resp |
| 128 | + |
| 129 | + |
| 130 | +@scenario.step( |
| 131 | + max_retries=0, |
| 132 | + retry_interval=0, |
| 133 | + startup_delay=0, |
| 134 | + fast_fail=False, |
| 135 | + validators=lambda variables: [("str_eq", "RetCode", 0)], |
| 136 | + action="DescribeUFSVolume", |
| 137 | +) |
| 138 | +def describe_ufs_volume_05(client: utest.Client, variables: dict): |
| 139 | + d = { |
| 140 | + "Zone": variables.get("Zone"), |
| 141 | + "VolumeId": "Volume_Id", |
| 142 | + "Region": variables.get("Region"), |
| 143 | + } |
| 144 | + |
| 145 | + try: |
| 146 | + resp = client.invoke("DescribeUFSVolume", d) |
| 147 | + except exc.RetCodeException as e: |
| 148 | + resp = e.json() |
| 149 | + |
| 150 | + return resp |
| 151 | + |
| 152 | + |
| 153 | +@scenario.step( |
| 154 | + max_retries=0, |
| 155 | + retry_interval=0, |
| 156 | + startup_delay=0, |
| 157 | + fast_fail=False, |
| 158 | + validators=lambda variables: [("str_eq", "RetCode", 0)], |
| 159 | + action="ExtendUFSVolume", |
| 160 | +) |
| 161 | +def extend_ufs_volume_06(client: utest.Client, variables: dict): |
| 162 | + d = { |
| 163 | + "VolumeId": variables.get("Volume_Id"), |
| 164 | + "Size": 2048, |
| 165 | + "Region": variables.get("Region"), |
| 166 | + } |
| 167 | + |
| 168 | + try: |
| 169 | + resp = client.invoke("ExtendUFSVolume", d) |
| 170 | + except exc.RetCodeException as e: |
| 171 | + resp = e.json() |
| 172 | + |
| 173 | + return resp |
| 174 | + |
| 175 | + |
| 176 | +@scenario.step( |
| 177 | + max_retries=0, |
| 178 | + retry_interval=0, |
| 179 | + startup_delay=0, |
| 180 | + fast_fail=False, |
| 181 | + validators=lambda variables: [("str_eq", "RetCode", 0)], |
| 182 | + action="DescribeUFSVolume", |
| 183 | +) |
| 184 | +def describe_ufs_volume_07(client: utest.Client, variables: dict): |
| 185 | + d = { |
| 186 | + "Zone": variables.get("Zone"), |
| 187 | + "VolumeId": "Volume_Id", |
| 188 | + "Region": variables.get("Region"), |
| 189 | + } |
| 190 | + |
| 191 | + try: |
| 192 | + resp = client.invoke("DescribeUFSVolume", d) |
| 193 | + except exc.RetCodeException as e: |
| 194 | + resp = e.json() |
| 195 | + |
| 196 | + return resp |
| 197 | + |
| 198 | + |
| 199 | +@scenario.step( |
| 200 | + max_retries=3, |
| 201 | + retry_interval=1, |
| 202 | + startup_delay=30, |
| 203 | + fast_fail=False, |
| 204 | + validators=lambda variables: [("str_eq", "RetCode", 0)], |
| 205 | + action="RemoveUFSVolume", |
| 206 | +) |
| 207 | +def remove_ufs_volume_08(client: utest.Client, variables: dict): |
| 208 | + d = {"VolumeId": variables.get("Volume_Id"), "Region": variables.get("Region")} |
| 209 | + |
| 210 | + try: |
| 211 | + resp = client.invoke("RemoveUFSVolume", d) |
| 212 | + except exc.RetCodeException as e: |
| 213 | + resp = e.json() |
| 214 | + |
| 215 | + return resp |
0 commit comments