示例#1
0
def test_fixture_amq(request, storageclass_factory):
    cephfs_sc_obj = storageclass_factory(interface=constants.CEPHFILESYSTEM,
                                         sc_name='amq-workload')

    # Change the above created StorageClass to default
    log.info(f"Changing the default StorageClass to {cephfs_sc_obj.name}")
    helpers.change_default_storageclass(scname=cephfs_sc_obj.name)

    # Confirm that the default StorageClass is changed
    tmp_default_sc = helpers.get_default_storage_class()
    assert len(tmp_default_sc) == 1, "More than 1 default storage class exist"
    log.info(f"Current Default StorageClass is:{tmp_default_sc[0]}")
    assert tmp_default_sc[0] == cephfs_sc_obj.name, (
        "Failed to change default StorageClass")
    log.info(f"Successfully changed the default StorageClass to "
             f"{cephfs_sc_obj.name}")

    amq = AMQ()
    amq.namespace = "my-project"

    def teardown():
        amq.cleanup()

    request.addfinalizer(teardown)
    return amq
def test_fixture_amq(request, storageclass_factory):
    # Change the above created StorageClass to default
    log.info(
        f"Changing the default StorageClass to {constants.DEFAULT_STORAGECLASS_CEPHFS}"
    )
    helpers.change_default_storageclass(
        scname=constants.DEFAULT_STORAGECLASS_CEPHFS)

    # Confirm that the default StorageClass is changed
    tmp_default_sc = helpers.get_default_storage_class()
    assert len(tmp_default_sc) == 1, "More than 1 default storage class exist"
    log.info(f"Current Default StorageClass is:{tmp_default_sc[0]}")
    assert tmp_default_sc[0] == constants.DEFAULT_STORAGECLASS_CEPHFS, (
        "Failed to change default StorageClass")
    log.info(f"Successfully changed the default StorageClass to "
             f"{constants.DEFAULT_STORAGECLASS_CEPHFS}")

    amq = AMQ()
    amq.namespace = "my-project"

    def teardown():
        amq.cleanup()

    request.addfinalizer(teardown)
    return amq