コード例 #1
0
ファイル: test_k8s.py プロジェクト: x-native/calrissian
 def test_remove_after_cleanup(self, mock_log, mock_client):
     # Depending upon timing cleanup may get called before we receive a remove pod event
     pod = self.make_mock_pod('pod-123')
     with PodMonitor() as monitor:
         monitor.add(pod)
     PodMonitor.cleanup()
     with PodMonitor() as monitor:
         monitor.remove(pod)
     mock_log.info.assert_has_calls([
         call('PodMonitor adding pod-123'),
         call('PodMonitor deleting pod pod-123'),
     ])
     mock_log.warning.assert_called_with(
         'PodMonitor pod-123 has already been removed')
コード例 #2
0
ファイル: test_k8s.py プロジェクト: x-native/calrissian
 def test_remove(self):
     pod2 = self.make_mock_pod('pod2')
     PodMonitor.pod_names = ['pod1', 'pod2']
     with PodMonitor() as monitor:
         monitor.remove(pod2)
     self.assertEqual(PodMonitor.pod_names, ['pod1'])
コード例 #3
0
ファイル: test_k8s.py プロジェクト: x-native/calrissian
 def test_cleanup(self, mock_client):
     mock_delete_pod_name = mock_client.return_value.delete_pod_name
     PodMonitor.pod_names = ['cleanup-pod']
     PodMonitor.cleanup()
     self.assertEqual(mock_delete_pod_name.call_args, call('cleanup-pod'))
コード例 #4
0
ファイル: test_k8s.py プロジェクト: x-native/calrissian
 def test_add(self):
     pod = self.make_mock_pod('pod-123')
     self.assertEqual(len(PodMonitor.pod_names), 0)
     with PodMonitor() as monitor:
         monitor.add(pod)
     self.assertEqual(PodMonitor.pod_names, ['pod-123'])