コード例 #1
0
ファイル: test_filesystem.py プロジェクト: opencredo/kubefuse
 def test_read_yaml(self):
     client = KubernetesClient()
     fs = KubeFileSystem(client)
     pod = client.get_pods()[0]
     path = '/default/pod/%s/yaml' % pod
     data = fs.read(path, 50000, 0)
     assert_that(data, equal_to(client.get_object_in_format('default', 'pod', pod, 'yaml')))
コード例 #2
0
ファイル: test_filesystem.py プロジェクト: opencredo/kubefuse
 def test_getattr_size_for_yaml_action(self):
     client = KubernetesClient()
     pod = client.get_pods()[0]
     fs = KubeFileSystem(client)
     path = '/default/pod/%s/yaml' % pod
     attr = fs.getattr(path)
     data = client.get_object_in_format('default', 'pod', pod, 'yaml')
     assert_that(attr['st_size'], is_(len(data)))
コード例 #3
0
ファイル: test_filesystem.py プロジェクト: mboersma/kubefuse
 def test_getattr_size_for_yaml_action(self):
     client = KubernetesClient()
     pod = client.get_pods()[0]
     fs = KubeFileSystem(client)
     path = '/default/pod/%s/yaml' % pod
     attr = fs.getattr(path)
     data = client.get_object_in_format('default', 'pod', pod, 'yaml')
     assert_that(attr['st_size'], is_(len(data)))
コード例 #4
0
ファイル: test_filesystem.py プロジェクト: mboersma/kubefuse
 def test_read_length(self):
     client = KubernetesClient()
     fs = KubeFileSystem(client)
     pod = client.get_pods()[0]
     path = '/default/pod/%s/yaml' % pod
     data = fs.read(path, 10, 0)
     ref = client.get_object_in_format('default', 'pod', pod, 'yaml')
     assert_that(data, equal_to(ref[:10]))
コード例 #5
0
ファイル: test_filesystem.py プロジェクト: opencredo/kubefuse
 def test_read_offset(self):
     client = KubernetesClient()
     fs = KubeFileSystem(client)
     pod = client.get_pods()[0]
     path = '/default/pod/%s/yaml' % pod
     data = fs.read(path, 10, 5)
     ref = client.get_object_in_format('default', 'pod', pod, 'yaml')
     assert_that(data, equal_to(ref[5:15]))
     assert_that(len(data), is_(10))
コード例 #6
0
ファイル: test_filesystem.py プロジェクト: mboersma/kubefuse
 def test_read_offset(self):
     client = KubernetesClient()
     fs = KubeFileSystem(client)
     pod = client.get_pods()[0]
     path = '/default/pod/%s/yaml' % pod
     data = fs.read(path, 10, 5)
     ref = client.get_object_in_format('default', 'pod', pod, 'yaml')
     assert_that(data, equal_to(ref[5:15]))
     assert_that(len(data), is_(10))
コード例 #7
0
ファイル: test_filesystem.py プロジェクト: mboersma/kubefuse
 def test_read_json(self):
     client = KubernetesClient()
     fs = KubeFileSystem(client)
     pod = client.get_pods()[0]
     path = '/default/pod/%s/json' % pod
     data = fs.read(path, 50000, 0)
     assert_that(
         data,
         equal_to(client.get_object_in_format('default', 'pod', pod,
                                              'json')))
コード例 #8
0
ファイル: test_client.py プロジェクト: timstoop/kubefuse
 def test_get_object_in_json_format(self):
     client = KubernetesClient()
     pods = client.get_pods("default")
     pod = client.get_object_in_format('default', 'pod', pods[0], 'json')
     result = json.loads(pod.decode('utf-8'))
     assert_that(result['metadata']['name'], is_(pods[0]))
コード例 #9
0
ファイル: test_client.py プロジェクト: timstoop/kubefuse
 def test_get_object_in_yaml_format(self):
     client = KubernetesClient()
     pods = client.get_pods("default")
     pod = client.get_object_in_format('default', 'pod', pods[0], 'yaml')
     result = yaml.load(pod)
     assert_that(result['metadata']['name'], is_(pods[0]))
コード例 #10
0
ファイル: test_client.py プロジェクト: benmathews/kubefuse
 def test_get_object_in_json_format(self):
     client = KubernetesClient()
     pods = client.get_pods("default")
     pod = client.get_object_in_format('default', 'pod', pods[0], 'json')
     result = json.loads(pod)
     assert_that(result['metadata']['name'], is_(pods[0]))