Beispiel #1
0
def test_do_status(config, mocker):
    """Verify that the SiteMoveVerifier has additional state to offer."""
    logger_mock = mocker.MagicMock()
    run_mock = mocker.patch("lta.site_move_verifier.run",
                            new_callable=MagicMock)
    run_mock.return_value = ObjectLiteral(
        returncode=0,
        args=MYQUOTA_ARGS,
        stdout=
        b"FILESYSTEM   SPACE_USED   SPACE_QUOTA   SPACE_PCT   INODE_USED   INODE_QUOTA   INODE_PCT\nhome         1.90GiB      40.00GiB      4.7%        44.00        1.00M         0.0%\ncscratch1    12.00KiB     20.00TiB      0.0%        3.00         10.00M        0.0%\n",
        stderr="",
    )
    p = SiteMoveVerifier(config, logger_mock)
    assert p._do_status() == {
        "quota": [
            {
                "FILESYSTEM": "home",
                "SPACE_USED": "1.90GiB",
                "SPACE_QUOTA": "40.00GiB",
                "SPACE_PCT": "4.7%",
                "INODE_USED": "44.00",
                "INODE_QUOTA": "1.00M",
                "INODE_PCT": "0.0%",
            },
            {
                "FILESYSTEM": "cscratch1",
                "SPACE_USED": "12.00KiB",
                "SPACE_QUOTA": "20.00TiB",
                "SPACE_PCT": "0.0%",
                "INODE_USED": "3.00",
                "INODE_QUOTA": "10.00M",
                "INODE_PCT": "0.0%",
            },
        ]
    }
Beispiel #2
0
def test_do_status_myquota_fails(config, mocker):
    """Verify that the SiteMoveVerifier has no additional state to offer."""
    logger_mock = mocker.MagicMock()
    run_mock = mocker.patch("lta.site_move_verifier.run",
                            new_callable=MagicMock)
    run_mock.return_value = ObjectLiteral(
        returncode=1,
        args=MYQUOTA_ARGS,
        stdout="",
        stderr="nersc file systems burned down; again",
    )
    p = SiteMoveVerifier(config, logger_mock)
    assert p._do_status() == {"quota": []}