コード例 #1
0
    def test_list_backup(self):
        create_backup(self.client, live=self.is_live)
        create_backup(self.client,
                      backup_name=TEST_BACKUP_2,
                      backup_only=True,
                      live=self.is_live)

        backup_list = get_backup_list(self.client)
        self.assertEqual(len(list(backup_list)), 2)
        idx = 0
        for backup in backup_list:
            self.assertEqual(backup.name, backups[idx])
            idx += 1

        disable_backup(self.client, live=self.is_live)
        disable_backup(self.client,
                       backup_name=TEST_BACKUP_2,
                       live=self.is_live)

        backup_list = get_backup_list(self.client)
        self.assertEqual(len(list(backup_list)), 0)

        delete_volume(self.client,
                      BACKUP_RG,
                      TEST_ACC_1,
                      TEST_POOL_1,
                      TEST_VOL_1,
                      live=self.is_live)
        delete_pool(self.client,
                    BACKUP_RG,
                    TEST_ACC_1,
                    TEST_POOL_1,
                    live=self.is_live)
        delete_account(self.client, BACKUP_RG, TEST_ACC_1, live=self.is_live)
コード例 #2
0
    def test_patch_volume(self):
        raise unittest.SkipTest("Skipping Volume test")
        volume = create_volume(self.client,
                               TEST_RG,
                               TEST_ACC_1,
                               TEST_POOL_1,
                               TEST_VOL_1,
                               live=self.is_live)
        self.assertEqual("Premium", volume.service_level)
        self.assertEqual(100 * GIGABYTE, volume.usage_threshold)

        volume_patch = VolumePatch(usage_threshold=200 * GIGABYTE)
        volume = self.client.volumes.update(volume_patch, TEST_RG, TEST_ACC_1,
                                            TEST_POOL_1, TEST_VOL_1)
        self.assertEqual("Premium", volume.service_level)
        # unchanged
        self.assertEqual(200 * GIGABYTE, volume.usage_threshold)

        self.client.volumes.delete(TEST_RG, TEST_ACC_1, TEST_POOL_1,
                                   TEST_VOL_1).wait()
        wait_for_no_volume(self.client,
                           TEST_RG,
                           TEST_ACC_1,
                           TEST_POOL_1,
                           TEST_VOL_1,
                           live=self.is_live)
        delete_pool(self.client,
                    TEST_RG,
                    TEST_ACC_1,
                    TEST_POOL_1,
                    live=self.is_live)
        delete_account(self.client, TEST_RG, TEST_ACC_1, live=self.is_live)
コード例 #3
0
    def test_patch_volume(self):
        volume = create_volume(self.client,
                               TEST_RG,
                               TEST_ACC_1,
                               TEST_POOL_1,
                               TEST_VOL_1,
                               live=self.is_live)
        self.assertEqual("Premium", volume.service_level)

        volume_patch = VolumePatch(service_level="Standard")
        volume = self.client.volumes.update(volume_patch, TEST_RG, TEST_ACC_1,
                                            TEST_POOL_1, TEST_VOL_1)
        self.assertEqual("Standard", volume.service_level)

        self.client.volumes.delete(TEST_RG, TEST_ACC_1, TEST_POOL_1,
                                   TEST_VOL_1).wait()
        wait_for_no_volume(self.client,
                           TEST_RG,
                           TEST_ACC_1,
                           TEST_POOL_1,
                           TEST_VOL_1,
                           live=self.is_live)
        delete_pool(self.client,
                    TEST_RG,
                    TEST_ACC_1,
                    TEST_POOL_1,
                    live=self.is_live)
        delete_account(self.client, TEST_RG, TEST_ACC_1, live=self.is_live)
コード例 #4
0
    def test_update_backup(self):
        create_backup(self.client, live=self.is_live)

        tag = {'Tag1': 'Value1'}
        backup_body = BackupPatch(location=BACKUP_LOCATION, tags=tag)
        self.client.backups.begin_update(BACKUP_RG, TEST_ACC_1, TEST_POOL_1,
                                         TEST_VOL_1, TEST_BACKUP_1,
                                         backup_body).wait()

        backup = get_backup(self.client)
        self.assertTrue(backup.tags['Tag1'] == 'Value1')

        disable_backup(self.client, live=self.is_live)
        delete_volume(self.client,
                      BACKUP_RG,
                      TEST_ACC_1,
                      TEST_POOL_1,
                      TEST_VOL_1,
                      live=self.is_live)
        delete_pool(self.client,
                    BACKUP_RG,
                    TEST_ACC_1,
                    TEST_POOL_1,
                    live=self.is_live)
        delete_account(self.client, BACKUP_RG, TEST_ACC_1, live=self.is_live)
コード例 #5
0
    def test_list_pools(self):
        create_pool(self.client, TEST_RG, TEST_ACC_1, TEST_POOL_1, LOCATION)
        create_pool(self.client,
                    TEST_RG,
                    TEST_ACC_1,
                    TEST_POOL_2,
                    LOCATION,
                    pool_only=True)
        pools = [TEST_POOL_1, TEST_POOL_2]

        pool_list = self.client.pools.list(TEST_RG, TEST_ACC_1)
        assert len(list(pool_list)) == 2
        idx = 0
        for pool in pool_list:
            assert pool.name == pools[idx]
            idx += 1

        delete_pool(self.client,
                    TEST_RG,
                    TEST_ACC_1,
                    TEST_POOL_1,
                    live=self.is_live)
        delete_pool(self.client,
                    TEST_RG,
                    TEST_ACC_1,
                    TEST_POOL_2,
                    live=self.is_live)
        delete_account(self.client, TEST_RG, TEST_ACC_1, live=self.is_live)
コード例 #6
0
    def test_create_delete_list_volume(self):
        raise unittest.SkipTest("Skipping Volume test")
        volume = create_volume(self.client,
                               TEST_RG,
                               TEST_ACC_1,
                               TEST_POOL_1,
                               TEST_VOL_1,
                               live=self.is_live)
        self.assertEqual(volume.name,
                         TEST_ACC_1 + '/' + TEST_POOL_1 + '/' + TEST_VOL_1)
        # check default export policy and protocol
        self.assertTrue(volume.export_policy.rules[0].nfsv3),
        self.assertFalse(volume.export_policy.rules[0].nfsv41)
        self.assertEqual("0.0.0.0/0",
                         volume.export_policy.rules[0].allowed_clients)
        self.assertEqual(volume.protocol_types[0], "NFSv3")

        volume_list = self.client.volumes.list(TEST_RG, TEST_ACC_1,
                                               TEST_POOL_1)
        self.assertEqual(len(list(volume_list)), 1)

        self.client.volumes.delete(TEST_RG, TEST_ACC_1, TEST_POOL_1,
                                   TEST_VOL_1).wait()
        volume_list = self.client.volumes.list(TEST_RG, TEST_ACC_1,
                                               TEST_POOL_1)
        self.assertEqual(len(list(volume_list)), 0)

        wait_for_no_volume(self.client, TEST_RG, TEST_ACC_1, TEST_POOL_1,
                           TEST_VOL_1)
        delete_pool(self.client,
                    TEST_RG,
                    TEST_ACC_1,
                    TEST_POOL_1,
                    live=self.is_live)
        delete_account(self.client, TEST_RG, TEST_ACC_1, live=self.is_live)
コード例 #7
0
    def test_get_volume_by_name(self):
        raise unittest.SkipTest("Skipping Volume test")
        volume = create_volume(self.client,
                               TEST_RG,
                               TEST_ACC_1,
                               TEST_POOL_1,
                               TEST_VOL_1,
                               LOCATION,
                               live=self.is_live)

        volume = self.client.volumes.get(TEST_RG, TEST_ACC_1, TEST_POOL_1,
                                         TEST_VOL_1)
        self.assertEqual(volume.name,
                         TEST_ACC_1 + '/' + TEST_POOL_1 + '/' + TEST_VOL_1)

        self.client.volumes.delete(TEST_RG, TEST_ACC_1, TEST_POOL_1,
                                   TEST_VOL_1).wait()
        wait_for_no_volume(self.client,
                           TEST_RG,
                           TEST_ACC_1,
                           TEST_POOL_1,
                           TEST_VOL_1,
                           live=self.is_live)
        delete_pool(self.client,
                    TEST_RG,
                    TEST_ACC_1,
                    TEST_POOL_1,
                    live=self.is_live)
        delete_account(self.client, TEST_RG, TEST_ACC_1, live=self.is_live)
コード例 #8
0
    def test_update_volume(self):
        volume = create_volume(self.client, TEST_RG, TEST_ACC_1, TEST_POOL_1, TEST_VOL_1, live=self.is_live)
        self.assertEqual("Premium", volume.service_level)
        self.assertEqual(100 * GIGABYTE, volume.usage_threshold)

        volume_body = Volume(
            usage_threshold = 200 * GIGABYTE,
            creation_token=TEST_VOL_1,
            service_level="Premium", # cannot differ from pool
            location=LOCATION,
            subnet_id = "/subscriptions/" + SUBSID + "/resourceGroups/" + TEST_RG + "/providers/Microsoft.Network/virtualNetworks/" + VNET + "/subnets/default"
        )

        volume = self.client.volumes.create_or_update(
            volume_body,
            TEST_RG,
            TEST_ACC_1,
            TEST_POOL_1,
            TEST_VOL_1
        ).result()
        self.assertEqual("Premium", volume.service_level);  # unchanged
        self.assertEqual(200 * GIGABYTE, volume.usage_threshold)

        delete_volume(self.client, TEST_RG, TEST_ACC_1, TEST_POOL_1, TEST_VOL_1, live=self.is_live)
        delete_pool(self.client, TEST_RG, TEST_ACC_1, TEST_POOL_1, live=self.is_live)
        delete_account(self.client, TEST_RG, TEST_ACC_1, live=self.is_live)
コード例 #9
0
    def test_update_volume(self):
        volume = create_volume(self.client, TEST_RG, TEST_ACC_1, TEST_POOL_1, TEST_VOL_1)
        self.assertEqual(volume.service_level, "Premium")
        self.assertEqual(volume.usage_threshold, 100 * GIGABYTE)

        volume_body = Volume(
            usage_threshold = 100 * GIGABYTE,
            creation_token=TEST_VOL_1,
            service_level="Standard",
            location=LOCATION,
            subnet_id = "/subscriptions/" + SUBSID + "/resourceGroups/" + TEST_RG + "/providers/Microsoft.Network/virtualNetworks/" + VNET + "/subnets/default"
        )

        volume = self.client.volumes.create_or_update(
            volume_body,
            TEST_RG,
            TEST_ACC_1,
            TEST_POOL_1,
            TEST_VOL_1
        ).result()
        self.assertEqual(volume.service_level, "Standard")

        delete_volume(self.client, TEST_RG, TEST_ACC_1, TEST_POOL_1, TEST_VOL_1)
        delete_pool(self.client, TEST_RG, TEST_ACC_1, TEST_POOL_1)
        delete_account(self.client, TEST_RG, TEST_ACC_1)
コード例 #10
0
    def test_get_volume_by_name(self):
        # this can be reverted to set_bodiless_matcher() after tests are re-recorded and don't contain these headers
        set_custom_default_matcher(
            compare_bodies=False,
            excluded_headers=
            "Authorization,Content-Length,x-ms-client-request-id,x-ms-request-id"
        )
        create_volume(self.client,
                      TEST_RG,
                      TEST_ACC_1,
                      TEST_POOL_1,
                      TEST_VOL_1,
                      LOCATION,
                      live=self.is_live)

        volume = self.client.volumes.get(TEST_RG, TEST_ACC_1, TEST_POOL_1,
                                         TEST_VOL_1)
        assert volume.name == TEST_ACC_1 + '/' + TEST_POOL_1 + '/' + TEST_VOL_1

        delete_volume(self.client,
                      TEST_RG,
                      TEST_ACC_1,
                      TEST_POOL_1,
                      TEST_VOL_1,
                      live=self.is_live)
        delete_pool(self.client,
                    TEST_RG,
                    TEST_ACC_1,
                    TEST_POOL_1,
                    live=self.is_live)
        delete_account(self.client, TEST_RG, TEST_ACC_1, live=self.is_live)
コード例 #11
0
    def test_patch_volume(self):
        volume = create_volume(self.client,
                               TEST_RG,
                               TEST_ACC_1,
                               TEST_POOL_1,
                               TEST_VOL_1,
                               live=self.is_live)
        self.assertEqual("Premium", volume.service_level)
        self.assertEqual(100 * GIGABYTE, volume.usage_threshold)

        volume_patch = VolumePatch(usage_threshold=200 * GIGABYTE)
        volume = self.client.volumes.begin_update(TEST_RG, TEST_ACC_1,
                                                  TEST_POOL_1, TEST_VOL_1,
                                                  volume_patch).result()
        self.assertEqual("Premium", volume.service_level)
        self.assertEqual(200 * GIGABYTE, volume.usage_threshold)

        delete_volume(self.client,
                      TEST_RG,
                      TEST_ACC_1,
                      TEST_POOL_1,
                      TEST_VOL_1,
                      live=self.is_live)
        delete_pool(self.client,
                    TEST_RG,
                    TEST_ACC_1,
                    TEST_POOL_1,
                    live=self.is_live)
        delete_account(self.client, TEST_RG, TEST_ACC_1, live=self.is_live)
コード例 #12
0
    def test_patch_volume(self):
        # this can be reverted to set_bodiless_matcher() after tests are re-recorded and don't contain these headers
        set_custom_default_matcher(
            compare_bodies=False,
            excluded_headers=
            "Authorization,Content-Length,x-ms-client-request-id,x-ms-request-id"
        )
        volume = create_volume(self.client,
                               TEST_RG,
                               TEST_ACC_1,
                               TEST_POOL_1,
                               TEST_VOL_1,
                               live=self.is_live)
        assert "Premium" == volume.service_level
        assert 100 * GIGABYTE == volume.usage_threshold

        volume_patch = VolumePatch(usage_threshold=200 * GIGABYTE)
        volume = self.client.volumes.begin_update(TEST_RG, TEST_ACC_1,
                                                  TEST_POOL_1, TEST_VOL_1,
                                                  volume_patch).result()
        assert "Premium" == volume.service_level
        assert 200 * GIGABYTE == volume.usage_threshold

        delete_volume(self.client,
                      TEST_RG,
                      TEST_ACC_1,
                      TEST_POOL_1,
                      TEST_VOL_1,
                      live=self.is_live)
        delete_pool(self.client,
                    TEST_RG,
                    TEST_ACC_1,
                    TEST_POOL_1,
                    live=self.is_live)
        delete_account(self.client, TEST_RG, TEST_ACC_1, live=self.is_live)
コード例 #13
0
    def test_create_delete_list_volume(self):
        volume = create_volume(self.client,
                               TEST_RG,
                               TEST_ACC_1,
                               TEST_POOL_1,
                               TEST_VOL_1,
                               live=self.is_live)
        self.assertEqual(volume.name,
                         TEST_ACC_1 + '/' + TEST_POOL_1 + '/' + TEST_VOL_1)

        volume_list = self.client.volumes.list(TEST_RG, TEST_ACC_1,
                                               TEST_POOL_1)
        self.assertEqual(len(list(volume_list)), 1)

        self.client.volumes.delete(TEST_RG, TEST_ACC_1, TEST_POOL_1,
                                   TEST_VOL_1).wait()
        volume_list = self.client.volumes.list(TEST_RG, TEST_ACC_1,
                                               TEST_POOL_1)
        self.assertEqual(len(list(volume_list)), 0)

        wait_for_no_volume(self.client, TEST_RG, TEST_ACC_1, TEST_POOL_1,
                           TEST_VOL_1)
        delete_pool(self.client,
                    TEST_RG,
                    TEST_ACC_1,
                    TEST_POOL_1,
                    live=self.is_live)
        delete_account(self.client, TEST_RG, TEST_ACC_1, live=self.is_live)
コード例 #14
0
    def test_list_backup_policies(self):
        create_backup_policy(self.client, TEST_BACKUP_POLICY_1)
        create_backup_policy(self.client,
                             TEST_BACKUP_POLICY_2,
                             backup_policy_only=True)

        backup_policies_list = self.client.backup_policies.list(
            TEST_RG, TEST_ACC_1)
        assert len(list(backup_policies_list)) == 2
        idx = 0
        for backup_policy in backup_policies_list:
            assert backup_policy.name == BACKUP_POLICIES[idx]
            idx += 1

        delete_backup_policy(self.client,
                             TEST_BACKUP_POLICY_1,
                             live=self.is_live)
        delete_backup_policy(self.client,
                             TEST_BACKUP_POLICY_2,
                             live=self.is_live)

        backup_policies_list = self.client.backup_policies.list(
            TEST_RG, TEST_ACC_1)
        assert len(list(backup_policies_list)) == 0

        delete_account(self.client, TEST_RG, TEST_ACC_1)
コード例 #15
0
    def test_delete_account_backups(self):
        create_backup(self.client,
                      backup_name=TEST_BACKUP_1,
                      live=self.is_live)

        account_backup_list = self.client.account_backups.list(
            BACKUP_RG, TEST_ACC_1)
        self.assertGreaterEqual(len(list(account_backup_list)), 1)

        delete_volume(self.client,
                      BACKUP_RG,
                      TEST_ACC_1,
                      TEST_POOL_1,
                      TEST_VOL_1,
                      live=self.is_live)
        self.client.account_backups.begin_delete(BACKUP_RG, TEST_ACC_1,
                                                 TEST_BACKUP_1).wait()

        account_backup_list = self.client.account_backups.list(
            BACKUP_RG, TEST_ACC_1)
        for backup in account_backup_list:
            self.assertNotEqual(backup.name, TEST_ACC_1 + "/" + TEST_BACKUP_1)

        delete_pool(self.client,
                    BACKUP_RG,
                    TEST_ACC_1,
                    TEST_POOL_1,
                    live=self.is_live)
        delete_account(self.client, BACKUP_RG, TEST_ACC_1, live=self.is_live)
コード例 #16
0
    def test_get_account_backups(self):
        # this can be reverted to set_bodiless_matcher() after tests are re-recorded and don't contain these headers
        set_custom_default_matcher(
            compare_bodies=False,
            excluded_headers=
            "Authorization,Content-Length,x-ms-client-request-id,x-ms-request-id"
        )
        create_backup(self.client,
                      backup_name=TEST_BACKUP_1,
                      live=self.is_live)

        account_backup = self.client.account_backups.get(
            TEST_RG, TEST_ACC_1, TEST_BACKUP_1)
        assert account_backup.name == TEST_ACC_1 + "/" + TEST_BACKUP_1

        disable_backup(self.client, TEST_BACKUP_1, live=self.is_live)
        delete_volume(self.client,
                      TEST_RG,
                      TEST_ACC_1,
                      TEST_POOL_1,
                      TEST_VOL_1,
                      live=self.is_live)
        delete_pool(self.client,
                    TEST_RG,
                    TEST_ACC_1,
                    TEST_POOL_1,
                    live=self.is_live)
        delete_account(self.client, TEST_RG, TEST_ACC_1, live=self.is_live)
コード例 #17
0
    def test_list_snapshots(self):
        snapshot = create_snapshot(self.client, TEST_RG, TEST_ACC_1,
                                   TEST_POOL_1, TEST_VOL_1, TEST_SNAPSHOT_1,
                                   LOCATION)
        snapshot = create_snapshot(self.client,
                                   TEST_RG,
                                   TEST_ACC_1,
                                   TEST_POOL_1,
                                   TEST_VOL_1,
                                   TEST_SNAPSHOT_2,
                                   LOCATION,
                                   snapshot_only=True)

        snapshot_list = self.client.snapshots.list(TEST_RG, TEST_ACC_1,
                                                   TEST_POOL_1, TEST_VOL_1)
        self.assertEqual(len(list(snapshot_list)), 2)
        idx = 0
        for snapshot in snapshot_list:
            self.assertEqual(snapshot.name, snapshots[idx])
            idx += 1

        delete_snapshot(self.client, TEST_RG, TEST_ACC_1, TEST_POOL_1,
                        TEST_VOL_1, TEST_SNAPSHOT_1)
        delete_snapshot(self.client, TEST_RG, TEST_ACC_1, TEST_POOL_1,
                        TEST_VOL_1, TEST_SNAPSHOT_2)
        delete_volume(self.client, TEST_RG, TEST_ACC_1, TEST_POOL_1,
                      TEST_VOL_1)
        delete_pool(self.client, TEST_RG, TEST_ACC_1, TEST_POOL_1)
        delete_account(self.client, TEST_RG, TEST_ACC_1)
コード例 #18
0
    def test_get_volume_by_name(self):
        create_volume(self.client,
                      TEST_RG,
                      TEST_ACC_1,
                      TEST_POOL_1,
                      TEST_VOL_1,
                      LOCATION,
                      live=self.is_live)

        volume = self.client.volumes.get(TEST_RG, TEST_ACC_1, TEST_POOL_1,
                                         TEST_VOL_1)
        self.assertEqual(volume.name,
                         TEST_ACC_1 + '/' + TEST_POOL_1 + '/' + TEST_VOL_1)

        delete_volume(self.client,
                      TEST_RG,
                      TEST_ACC_1,
                      TEST_POOL_1,
                      TEST_VOL_1,
                      live=self.is_live)
        delete_pool(self.client,
                    TEST_RG,
                    TEST_ACC_1,
                    TEST_POOL_1,
                    live=self.is_live)
        delete_account(self.client, TEST_RG, TEST_ACC_1, live=self.is_live)
コード例 #19
0
    def test_list_backup_policies(self):
        create_backup_policy(self.client, TEST_BACKUP_POLICY_1)
        create_backup_policy(self.client,
                             TEST_BACKUP_POLICY_2,
                             backup_policy_only=True)

        backup_policies_list = self.client.backup_policies.list(
            TEST_RG, TEST_ACC_1)
        self.assertEqual(len(list(backup_policies_list)), 2)
        idx = 0
        for backup_policy in backup_policies_list:
            self.assertEqual(backup_policy.name, BACKUP_POLICIES[idx])
            idx += 1

        delete_backup_policy(self.client,
                             TEST_BACKUP_POLICY_1,
                             live=self.is_live)
        delete_backup_policy(self.client,
                             TEST_BACKUP_POLICY_2,
                             live=self.is_live)

        backup_policies_list = self.client.backup_policies.list(
            TEST_RG, TEST_ACC_1)
        self.assertEqual(len(list(backup_policies_list)), 0)

        delete_account(self.client, TEST_RG, TEST_ACC_1)
コード例 #20
0
    def test_list_snapshot_policies(self):
        create_snapshot_policy(self.client, TEST_SNAPSHOT_POLICY_1)
        create_snapshot_policy(self.client,
                               TEST_SNAPSHOT_POLICY_2,
                               snapshot_policy_only=True)

        snapshot_policies_list = self.client.snapshot_policies.list(
            TEST_RG, TEST_ACC_1)
        self.assertEqual(len(list(snapshot_policies_list)), 2)
        snapshot_policies = [TEST_SNAPSHOT_POLICY_1, TEST_SNAPSHOT_POLICY_2]

        idx = 0
        for snapshot_policy in snapshot_policies_list:
            self.assertEqual(snapshot_policy.name, snapshot_policies[idx])
            idx += 1

        delete_snapshot_policy(self.client,
                               TEST_SNAPSHOT_POLICY_1,
                               live=self.is_live)
        delete_snapshot_policy(self.client,
                               TEST_SNAPSHOT_POLICY_2,
                               live=self.is_live)

        snapshot_policies_list = self.client.snapshot_policies.list(
            TEST_RG, TEST_ACC_1)
        self.assertEqual(len(list(snapshot_policies_list)), 0)

        delete_account(self.client, TEST_RG, TEST_ACC_1)
コード例 #21
0
    def test_assign_snapshot_policy_to_volume(self):
        # create volume and snapshot policy
        create_volume(self.client, TEST_RG, TEST_ACC_1, TEST_POOL_1,
                      TEST_VOL_1)
        snapshot_policy = create_snapshot_policy(self.client,
                                                 TEST_SNAPSHOT_POLICY_1)
        # assign the snapshot policy to the volume
        snapshot = VolumeSnapshotProperties(
            snapshot_policy_id=snapshot_policy.id)
        data_protection = VolumePatchPropertiesDataProtection(
            snapshot=snapshot)
        volume_patch = VolumePatch(data_protection=data_protection)
        volume = self.client.volumes.begin_update(TEST_RG, TEST_ACC_1,
                                                  TEST_POOL_1, TEST_VOL_1,
                                                  volume_patch).result()

        self.assertEqual(volume.data_protection.snapshot.snapshot_policy_id,
                         snapshot_policy.id)

        # cleanup
        delete_volume(self.client,
                      TEST_RG,
                      TEST_ACC_1,
                      TEST_POOL_1,
                      TEST_VOL_1,
                      live=self.is_live)
        delete_snapshot_policy(self.client,
                               TEST_SNAPSHOT_POLICY_1,
                               live=self.is_live)
        delete_pool(self.client,
                    TEST_RG,
                    TEST_ACC_1,
                    TEST_POOL_1,
                    live=self.is_live)
        delete_account(self.client, TEST_RG, TEST_ACC_1, live=self.is_live)
コード例 #22
0
    def test_list_pools(self):
        pool = create_pool(self.client, TEST_RG, TEST_ACC_1, TEST_POOL_1,
                           LOCATION)
        pool = create_pool(self.client,
                           TEST_RG,
                           TEST_ACC_1,
                           TEST_POOL_2,
                           LOCATION,
                           pool_only=True)

        pool_list = self.client.pools.list(TEST_RG, TEST_ACC_1)
        self.assertEqual(len(list(pool_list)), 2)
        idx = 0
        for pool in pool_list:
            self.assertEqual(pool.name, pools[idx])
            idx += 1

        self.client.pools.delete(TEST_RG, TEST_ACC_1, TEST_POOL_1).wait()
        self.client.pools.delete(TEST_RG, TEST_ACC_1, TEST_POOL_2).wait()
        for pool in pools:
            wait_for_no_pool(self.client,
                             TEST_RG,
                             TEST_ACC_1,
                             pools[idx],
                             live=self.is_live)
        delete_account(self.client, TEST_RG, TEST_ACC_1, live=self.is_live)
コード例 #23
0
    def test_get_pool_by_name(self):
        create_pool(self.client, TEST_RG, TEST_ACC_1, TEST_POOL_1, LOCATION)

        pool = self.client.pools.get(TEST_RG, TEST_ACC_1, TEST_POOL_1)
        self.assertEqual(pool.name, TEST_ACC_1 + '/' + TEST_POOL_1)

        delete_pool(self.client, TEST_RG, TEST_ACC_1, TEST_POOL_1, live=self.is_live)
        delete_account(self.client, TEST_RG, TEST_ACC_1, live=self.is_live)
コード例 #24
0
    def test_get_snapshot_policy_by_name(self):
        create_snapshot_policy(self.client, TEST_SNAPSHOT_POLICY_1)

        snapshot_policy = self.client.snapshot_policies.get(TEST_RG, TEST_ACC_1, TEST_SNAPSHOT_POLICY_1)
        assert snapshot_policy.name == TEST_ACC_1 + "/" + TEST_SNAPSHOT_POLICY_1

        delete_snapshot_policy(self.client, TEST_SNAPSHOT_POLICY_1, live=self.is_live)
        delete_account(self.client, TEST_RG, TEST_ACC_1)
コード例 #25
0
    def test_get_pool_by_name(self):
        pool = create_pool(self.client, TEST_RG, TEST_ACC_1, TEST_POOL_1, LOCATION)

        pool = self.client.pools.get(TEST_RG, TEST_ACC_1, TEST_POOL_1)
        self.assertEqual(pool.name, TEST_ACC_1 + '/' + TEST_POOL_1)

        self.client.pools.delete(TEST_RG, TEST_ACC_1, TEST_POOL_1).wait()
        wait_for_no_pool(self.client, TEST_RG, TEST_ACC_1, TEST_POOL_1, live=self.is_live)
        delete_account(self.client, TEST_RG, TEST_ACC_1, live=self.is_live)
コード例 #26
0
    def test_get_pool_by_name(self):
        pool = create_pool(self.client, TEST_RG, TEST_ACC_1, TEST_POOL_1, LOCATION)

        pool = self.client.pools.get(TEST_RG, TEST_ACC_1, TEST_POOL_1)
        self.assertEqual(pool.name, TEST_ACC_1 + '/' + TEST_POOL_1)

        self.client.pools.delete(TEST_RG, TEST_ACC_1, TEST_POOL_1).wait()
        wait_for_no_pool(self.client, TEST_RG, TEST_ACC_1, TEST_POOL_1)
        delete_account(self.client, TEST_RG, TEST_ACC_1)
コード例 #27
0
    def test_get_snapshot_by_name(self):
        snapshot = create_snapshot(self.client, TEST_RG, TEST_ACC_1, TEST_POOL_1, TEST_VOL_1, TEST_SNAPSHOT_1, LOCATION)

        snapshot = self.client.snapshots.get(TEST_RG, TEST_ACC_1, TEST_POOL_1, TEST_VOL_1, TEST_SNAPSHOT_1)
        self.assertEqual(snapshot.name, TEST_ACC_1 + '/' + TEST_POOL_1 + '/' + TEST_VOL_1+ '/' + TEST_SNAPSHOT_1)

        delete_snapshot(self.client, TEST_RG, TEST_ACC_1, TEST_POOL_1, TEST_VOL_1, TEST_SNAPSHOT_1)
        delete_volume(self.client, TEST_RG, TEST_ACC_1, TEST_POOL_1, TEST_VOL_1)
        delete_pool(self.client, TEST_RG, TEST_ACC_1, TEST_POOL_1)
        delete_account(self.client, TEST_RG, TEST_ACC_1)
コード例 #28
0
    def test_get_volume_by_name(self):
        volume = create_volume(self.client, TEST_RG, TEST_ACC_1, TEST_POOL_1, TEST_VOL_1, LOCATION)

        volume = self.client.volumes.get(TEST_RG, TEST_ACC_1, TEST_POOL_1, TEST_VOL_1)
        self.assertEqual(volume.name, TEST_ACC_1 + '/' + TEST_POOL_1 + '/' + TEST_VOL_1)

        self.client.volumes.delete(TEST_RG, TEST_ACC_1, TEST_POOL_1, TEST_VOL_1).wait()
        wait_for_no_volume(self.client, TEST_RG, TEST_ACC_1, TEST_POOL_1, TEST_VOL_1)
        delete_pool(self.client, TEST_RG, TEST_ACC_1, TEST_POOL_1)
        delete_account(self.client, TEST_RG, TEST_ACC_1)
コード例 #29
0
    def test_get_backup_policy_by_name(self):
        create_backup_policy(self.client, TEST_BACKUP_POLICY_1)

        backup_policy = self.client.backup_policies.get(
            TEST_RG, TEST_ACC_1, TEST_BACKUP_POLICY_1)
        assert backup_policy.name == TEST_ACC_1 + "/" + TEST_BACKUP_POLICY_1

        delete_backup_policy(self.client,
                             TEST_BACKUP_POLICY_1,
                             live=self.is_live)
        delete_account(self.client, TEST_RG, TEST_ACC_1)
コード例 #30
0
def clean_up(client, disable_bp=True, live=False):
    if disable_bp:
        disable_backup(client, live=live)

    delete_volume(client,
                  TEST_RG,
                  TEST_ACC_1,
                  TEST_POOL_1,
                  TEST_VOL_1,
                  live=live)
    delete_pool(client, TEST_RG, TEST_ACC_1, TEST_POOL_1, live=live)
    delete_account(client, TEST_RG, TEST_ACC_1, live=live)
コード例 #31
0
    def test_create_delete_snapshot_policy(self):
        create_snapshot_policy(self.client, TEST_SNAPSHOT_POLICY_1)

        snapshot_policies_list = self.client.snapshot_policies.list(TEST_RG, TEST_ACC_1)
        assert len(list(snapshot_policies_list)) == 1

        delete_snapshot_policy(self.client, TEST_SNAPSHOT_POLICY_1, live=self.is_live)

        snapshot_policies_list = self.client.snapshot_policies.list(TEST_RG, TEST_ACC_1)
        assert len(list(snapshot_policies_list)) == 0

        delete_account(self.client, TEST_RG, TEST_ACC_1, live=self.is_live)
コード例 #32
0
    def test_patch_volume(self):
        volume = create_volume(self.client, TEST_RG, TEST_ACC_1, TEST_POOL_1, TEST_VOL_1)
        self.assertEqual("Premium", volume.service_level);

        volume_patch = VolumePatch(service_level = "Standard")
        volume = self.client.volumes.update(volume_patch, TEST_RG, TEST_ACC_1, TEST_POOL_1, TEST_VOL_1);
        self.assertEqual("Standard", volume.service_level);

        self.client.volumes.delete(TEST_RG, TEST_ACC_1, TEST_POOL_1, TEST_VOL_1).wait()
        wait_for_no_volume(self.client, TEST_RG, TEST_ACC_1, TEST_POOL_1, TEST_VOL_1)
        delete_pool(self.client, TEST_RG, TEST_ACC_1, TEST_POOL_1)
        delete_account(self.client, TEST_RG, TEST_ACC_1)
コード例 #33
0
    def test_create_delete_snapshot(self):
        snapshot = create_snapshot(self.client, TEST_RG, TEST_ACC_1, TEST_POOL_1, TEST_VOL_1, TEST_SNAPSHOT_1, LOCATION)

        snapshot_list = self.client.snapshots.list(TEST_RG, TEST_ACC_1, TEST_POOL_1, TEST_VOL_1)
        self.assertEqual(len(list(snapshot_list)), 1)

        self.client.snapshots.delete(TEST_RG, TEST_ACC_1, TEST_POOL_1, TEST_VOL_1, TEST_SNAPSHOT_1).wait()
        snapshot_list = self.client.snapshots.list(TEST_RG, TEST_ACC_1, TEST_POOL_1, TEST_VOL_1)
        self.assertEqual(len(list(snapshot_list)), 0)

        delete_volume(self.client, TEST_RG, TEST_ACC_1, TEST_POOL_1, TEST_VOL_1)
        delete_pool(self.client, TEST_RG, TEST_ACC_1, TEST_POOL_1)
        delete_account(self.client, TEST_RG, TEST_ACC_1)
コード例 #34
0
    def test_patch_pool(self):
        create_pool(self.client, TEST_RG, TEST_ACC_1, TEST_POOL_1)

        tag = {'Tag2': 'Value1'}
        capacity_pool_patch = CapacityPoolPatch(service_level="Standard", tags=tag)

        pool = self.client.pools.update(capacity_pool_patch, TEST_RG, TEST_ACC_1, TEST_POOL_1)
        self.assertEqual(pool.service_level, "Standard")
        self.assertTrue(pool.tags['Tag2'] == 'Value1')

        self.client.pools.delete(TEST_RG, TEST_ACC_1, TEST_POOL_1).wait()
        wait_for_no_pool(self.client, TEST_RG, TEST_ACC_1, TEST_POOL_1, live=self.is_live)
        delete_account(self.client, TEST_RG, TEST_ACC_1, live=self.is_live)
コード例 #35
0
    def test_create_delete_pool(self):
        pool = create_pool(self.client, TEST_RG, TEST_ACC_1, TEST_POOL_1, LOCATION)
        self.assertEqual(pool.size, DEFAULT_SIZE)
        self.assertEqual(pool.name, TEST_ACC_1 + '/' + TEST_POOL_1)

        pool_list = self.client.pools.list(TEST_RG, TEST_ACC_1)
        self.assertEqual(len(list(pool_list)), 1)

        self.client.pools.delete(TEST_RG, TEST_ACC_1, TEST_POOL_1).wait()
        pool_list = self.client.pools.list(TEST_RG, TEST_ACC_1)
        self.assertEqual(len(list(pool_list)), 0)

        wait_for_no_pool(self.client, TEST_RG, TEST_ACC_1, TEST_POOL_1, live=self.is_live)
        delete_account(self.client, TEST_RG, TEST_ACC_1, live=self.is_live)
コード例 #36
0
    def test_list_mount_target(self):
        volume = create_volume(self. client,TEST_RG, TEST_ACC_1, TEST_POOL_1, TEST_VOL_1)
        self.assertEqual(volume.name, TEST_ACC_1 + '/' + TEST_POOL_1 + '/' + TEST_VOL_1)

        mount_target_list = self.client.mount_targets.list(
            TEST_RG,
            TEST_ACC_1,
            TEST_POOL_1,
            TEST_VOL_1
        )
        self.assertEqual(len(list(mount_target_list)), 1)

        delete_volume(self.client, TEST_RG, TEST_ACC_1, TEST_POOL_1, TEST_VOL_1)
        delete_pool(self.client, TEST_RG, TEST_ACC_1, TEST_POOL_1)
        delete_account(self.client, TEST_RG, TEST_ACC_1)
コード例 #37
0
    def test_list_pools(self):
        pool = create_pool(self.client, TEST_RG, TEST_ACC_1, TEST_POOL_1, LOCATION)
        pool = create_pool(self.client, TEST_RG, TEST_ACC_1, TEST_POOL_2, LOCATION, pool_only=True)

        pool_list = self.client.pools.list(TEST_RG, TEST_ACC_1)
        self.assertEqual(len(list(pool_list)), 2)
        idx = 0
        for pool in pool_list:
            self.assertEqual(pool.name, pools[idx])
            idx += 1

        self.client.pools.delete(TEST_RG, TEST_ACC_1, TEST_POOL_1).wait()
        self.client.pools.delete(TEST_RG, TEST_ACC_1, TEST_POOL_2).wait()
        for pool in pools:
            wait_for_no_pool(self.client, TEST_RG, TEST_ACC_1, pools[idx], live=self.is_live)
        delete_account(self.client, TEST_RG, TEST_ACC_1, live=self.is_live)
コード例 #38
0
    def test_list_snapshots(self):
        snapshot = create_snapshot(self.client, TEST_RG, TEST_ACC_1, TEST_POOL_1, TEST_VOL_1, TEST_SNAPSHOT_1, LOCATION)
        snapshot = create_snapshot(self.client, TEST_RG, TEST_ACC_1, TEST_POOL_1, TEST_VOL_1, TEST_SNAPSHOT_2, LOCATION, snapshot_only=True)

        snapshot_list = self.client.snapshots.list(TEST_RG, TEST_ACC_1, TEST_POOL_1, TEST_VOL_1)
        self.assertEqual(len(list(snapshot_list)), 2)
        idx = 0
        for snapshot in snapshot_list:
            self.assertEqual(snapshot.name, snapshots[idx])
            idx += 1

        delete_snapshot(self.client, TEST_RG, TEST_ACC_1, TEST_POOL_1, TEST_VOL_1, TEST_SNAPSHOT_1)
        delete_snapshot(self.client, TEST_RG, TEST_ACC_1, TEST_POOL_1, TEST_VOL_1, TEST_SNAPSHOT_2)
        delete_volume(self.client, TEST_RG, TEST_ACC_1, TEST_POOL_1, TEST_VOL_1)
        delete_pool(self.client, TEST_RG, TEST_ACC_1, TEST_POOL_1)
        delete_account(self.client, TEST_RG, TEST_ACC_1)
コード例 #39
0
    def test_update_pool(self):
        pool = create_pool(self.client, TEST_RG, TEST_ACC_1, TEST_POOL_1)
        self.assertEqual(pool.service_level, "Premium")

        pool_body = CapacityPool(service_level="Standard", size=DEFAULT_SIZE, location=LOCATION)
        pool = self.client.pools.create_or_update(
            pool_body,
            TEST_RG,
            TEST_ACC_1,
            TEST_POOL_1,
            {'location': LOCATION}
        ).result()
        self.assertEqual(pool.service_level, "Standard")

        self.client.pools.delete(TEST_RG, TEST_ACC_1, TEST_POOL_1).wait()
        wait_for_no_pool(self.client, TEST_RG, TEST_ACC_1, TEST_POOL_1, live=self.is_live)
        delete_account(self.client, TEST_RG, TEST_ACC_1, live=self.is_live)
コード例 #40
0
    def test_list_volumes(self):
        volume = create_volume(self.client, TEST_RG, TEST_ACC_1, TEST_POOL_1, TEST_VOL_1, LOCATION)
        volume = create_volume(self.client, TEST_RG, TEST_ACC_1, TEST_POOL_1, TEST_VOL_2, LOCATION, volume_only=True)

        volume_list = self.client.volumes.list(TEST_RG, TEST_ACC_1, TEST_POOL_1)
        self.assertEqual(len(list(volume_list)), 2)
        idx = 0
        for volume in volume_list:
            self.assertEqual(volume.name, volumes[idx])
            idx += 1

        self.client.volumes.delete(TEST_RG, TEST_ACC_1, TEST_POOL_1, TEST_VOL_1).wait()
        self.client.volumes.delete(TEST_RG, TEST_ACC_1, TEST_POOL_1, TEST_VOL_2).wait()
        for volume in volumes:
            wait_for_no_volume(self.client, TEST_RG, TEST_ACC_1, TEST_POOL_1, volumes[idx])
        delete_pool(self.client, TEST_RG, TEST_ACC_1, TEST_POOL_1)
        delete_account(self.client, TEST_RG, TEST_ACC_1)
コード例 #41
0
    def test_create_delete_list_volume(self):
        volume = create_volume(
            self.client,
            TEST_RG,
            TEST_ACC_1,
            TEST_POOL_1,
            TEST_VOL_1
        )
        self.assertEqual(volume.name, TEST_ACC_1 + '/' + TEST_POOL_1 + '/' + TEST_VOL_1)

        volume_list = self.client.volumes.list(TEST_RG, TEST_ACC_1, TEST_POOL_1)
        self.assertEqual(len(list(volume_list)), 1)

        self.client.volumes.delete(TEST_RG, TEST_ACC_1, TEST_POOL_1, TEST_VOL_1).wait()
        volume_list = self.client.volumes.list(TEST_RG, TEST_ACC_1, TEST_POOL_1)
        self.assertEqual(len(list(volume_list)), 0)

        wait_for_no_volume(self.client, TEST_RG, TEST_ACC_1, TEST_POOL_1, TEST_VOL_1)
        delete_pool(self.client, TEST_RG, TEST_ACC_1, TEST_POOL_1)
        delete_account(self.client, TEST_RG, TEST_ACC_1)