def test_info_key_non_container(self): fake_cluster = "fake" fake_name = "client.fake" fake_user = "******" fake_key = "/tmp/my-key" fake_output_format = "json" expected_command_list = [ [ 'ceph', '-n', "fake-user", '-k', "/tmp/my-key", '--cluster', fake_cluster, 'auth', # noqa E501 'get', fake_name, '-f', 'json' ], ] result = ceph_key.info_key(fake_cluster, fake_name, fake_user, fake_key, fake_output_format) assert result == expected_command_list
def test_info_key_container_json(self, output_format): fake_cluster = "fake" fake_name = "client.fake" fake_user = '******' fake_user_key = '/etc/ceph/fake.client.admin.keyring' fake_container_image = "quay.ceph.io/ceph-ci/daemon:latest-luminous" expected_command_list = [[ 'docker', # noqa E128 'run', '--rm', '--net=host', '-v', '/etc/ceph:/etc/ceph:z', '-v', '/var/lib/ceph/:/var/lib/ceph/:z', '-v', '/var/log/ceph/:/var/log/ceph/:z', '--entrypoint=ceph', 'quay.ceph.io/ceph-ci/daemon:latest-luminous', '-n', fake_user, '-k', fake_user_key, '--cluster', fake_cluster, 'auth', 'get', fake_name, '-f', output_format ]] result = ceph_key.info_key(fake_cluster, fake_name, fake_user, fake_user_key, output_format, fake_container_image) # noqa E501 assert result == expected_command_list
def test_info_key_container(self): fake_cluster = "fake" fake_name = "client.fake" fake_user = "******" fake_key = "/tmp/my-key" fake_output_format = "json" fake_container_image = "docker.io/ceph/daemon:latest-luminous" expected_command_list = [['docker', # noqa E128 'run', '--rm', '--net=host', '-v', '/etc/ceph:/etc/ceph:z', '-v', '/var/lib/ceph/:/var/lib/ceph/:z', '-v', '/var/log/ceph/:/var/log/ceph/:z', '--entrypoint=ceph', 'docker.io/ceph/daemon:latest-luminous', '-n', "fake-user", '-k', "/tmp/my-key", '--cluster', fake_cluster, 'auth', 'get', fake_name, '-f', 'json'] ] result = ceph_key.info_key( fake_cluster, fake_name, fake_user, fake_key, fake_output_format, fake_container_image) # noqa E501 assert result == expected_command_list
def test_info_key_non_container(self, output_format): fake_user = '******' fake_user_key = '/etc/ceph/fake.client.admin.keyring' fake_cluster = "fake" fake_name = "client.fake" fake_user = "******" expected_command_list = [ [ 'ceph', '-n', fake_user, '-k', fake_user_key, '--cluster', fake_cluster, 'auth', 'get', fake_name, '-f', output_format ], ] result = ceph_key.info_key(fake_cluster, fake_name, fake_user, fake_user_key, output_format) assert result == expected_command_list