예제 #1
0
 def test_basic(self):
     self.patchProxyCmd(KUBE_CTL_PROXY_FAKE)
     self.config = config = kubeclientservice.KubeCtlProxyConfigLoader()
     yield config.startService()
     self.assertEqual(config.getConfig(), {
         'master_url': 'http://localhost:8001',
         'namespace': 'default'
     })
 def test_basic(self):
     self.patchProxyCmd(KUBE_CTL_PROXY_FAKE)
     self.config = config = kubeclientservice.KubeCtlProxyConfigLoader()
     yield config.startService()
     self.assertEqual(config.getConfig(), {
         'master_url': 'http://localhost:8001',
         'namespace': 'default'
     })
예제 #3
0
 def test_config_args(self):
     self.patchProxyCmd(KUBE_CTL_PROXY_FAKE)
     self.config = config = kubeclientservice.KubeCtlProxyConfigLoader(
         proxy_port=8002, namespace="system")
     yield config.startService()
     self.assertEqual(config.kube_proxy_output,
                      b'Starting to serve on 127.0.0.1:8002')
     self.assertEqual(config.getConfig(), {
         'master_url': 'http://localhost:8002',
         'namespace': 'system'
     })
     yield config.stopService()
 def test_config_args(self):
     self.patchProxyCmd(KUBE_CTL_PROXY_FAKE)
     self.config = config = kubeclientservice.KubeCtlProxyConfigLoader(
         proxy_port=8002, namespace="system")
     yield config.startService()
     self.assertEqual(config.kube_proxy_output,
                      b'Starting to serve on 127.0.0.1:8002')
     self.assertEqual(config.getConfig(), {
         'master_url': 'http://localhost:8002',
         'namespace': 'system'
     })
     yield config.stopService()
예제 #5
0
 def test_basic(self):
     self.patchExist(True)
     config = kubeclientservice.KubeInClusterConfigLoader()
     self.successResultOf(config.startService())
     self.assertEqual(
         config.getConfig(), {
             'headers': {
                 'Authorization': 'Bearer BASE64_TOKEN'
             },
             'master_url': 'https://foo',
             'namespace': 'buildbot_namespace',
             'verify':
             '/var/run/secrets/kubernetes.io/serviceaccount/ca.crt'
         })
 def test_basic(self):
     self.patchExist(True)
     config = kubeclientservice.KubeInClusterConfigLoader()
     self.successResultOf(config.startService())
     self.assertEqual(
         config.getConfig(), {
             'headers': {
                 'Authorization': 'Bearer BASE64_TOKEN'
             },
             'master_url': 'https://foo',
             'namespace': 'buildbot_namespace',
             'verify':
             '/var/run/secrets/kubernetes.io/serviceaccount/ca.crt'
         })
예제 #7
0
 def test_config_with_error(self):
     self.patchProxyCmd(KUBE_CTL_PROXY_FAKE_ERROR)
     self.config = config = kubeclientservice.KubeCtlProxyConfigLoader()
     with self.assertRaises(RuntimeError):
         yield config.startService()
 def test_config_with_error(self):
     self.patchProxyCmd(KUBE_CTL_PROXY_FAKE_ERROR)
     self.config = config = kubeclientservice.KubeCtlProxyConfigLoader()
     with self.assertRaises(RuntimeError):
         yield config.startService()