def assert_mock_cluster_is(self,
                               mock_cluster,
                               starting=False,
                               bootstrapping=False,
                               done=False,
                               from_end_of_hour=timedelta(hours=1),
                               has_pending_steps=False,
                               idle_for=timedelta(0),
                               pool_hash=None,
                               pool_name=None,
                               running=False):

        self.assertEqual(starting, _is_cluster_starting(mock_cluster))
        self.assertEqual(bootstrapping,
                         _is_cluster_bootstrapping(mock_cluster))
        self.assertEqual(done, _is_cluster_done(mock_cluster))
        self.assertEqual(from_end_of_hour,
                         _est_time_to_hour(mock_cluster, self.now))
        self.assertEqual(has_pending_steps,
                         _cluster_has_pending_steps(mock_cluster['_Steps']))
        self.assertEqual(idle_for, self.time_mock_cluster_idle(mock_cluster))
        self.assertEqual(
            (pool_hash, pool_name),
            _pool_hash_and_name(mock_cluster['_BootstrapActions']))
        self.assertEqual(running, _is_cluster_running(mock_cluster['_Steps']))
示例#2
0
    def assert_mock_cluster_is(
            self, mock_cluster,
            starting=False,
            bootstrapping=False,
            done=False,
            has_pending_steps=False,
            idle_for=timedelta(0),
            pool_hash=None,
            pool_name=None,
            running=False):

        self.assertEqual(starting,
                         _is_cluster_starting(mock_cluster))
        self.assertEqual(bootstrapping,
                         _is_cluster_bootstrapping(mock_cluster))
        self.assertEqual(done,
                         _is_cluster_done(mock_cluster))
        self.assertEqual(has_pending_steps,
                         _cluster_has_pending_steps(mock_cluster['_Steps']))
        self.assertEqual(idle_for,
                         self.time_mock_cluster_idle(mock_cluster))
        self.assertEqual((pool_hash, pool_name),
                         _pool_hash_and_name(mock_cluster))
        self.assertEqual(running,
                         _is_cluster_running(mock_cluster['_Steps']))
    def assert_mock_cluster_is(
            self, mock_cluster,
            starting=False,
            bootstrapping=False,
            done=False,
            from_end_of_hour=timedelta(hours=1),
            has_pending_steps=False,
            idle_for=timedelta(0),
            pool_hash=None,
            pool_name=None,
            running=False):

        self.assertEqual(starting,
                         _is_cluster_starting(mock_cluster))
        self.assertEqual(bootstrapping,
                         _is_cluster_bootstrapping(mock_cluster))
        self.assertEqual(done,
                         _is_cluster_done(mock_cluster))
        self.assertEqual(from_end_of_hour,
                         _est_time_to_hour(mock_cluster, self.now))
        self.assertEqual(has_pending_steps,
                         _cluster_has_pending_steps(mock_cluster._steps))
        self.assertEqual(idle_for,
                         self.time_mock_cluster_idle(mock_cluster))
        self.assertEqual((pool_hash, pool_name),
                         _pool_hash_and_name(mock_cluster._bootstrapactions))
        self.assertEqual(running,
                         _is_cluster_running(mock_cluster._steps))
    def assert_mock_cluster_is(
            self, mock_cluster,
            starting=False,
            bootstrapping=False,
            done=False,
            has_pending_steps=False,
            idle_for=timedelta(0),
            pool_hash=None,
            pool_name=None,
            running=False):

        self.assertEqual(starting,
                         _is_cluster_starting(mock_cluster))
        self.assertEqual(bootstrapping,
                         _is_cluster_bootstrapping(mock_cluster))
        self.assertEqual(done,
                         _is_cluster_done(mock_cluster))
        self.assertEqual(has_pending_steps,
                         _cluster_has_pending_steps(mock_cluster['_Steps']))
        self.assertEqual(idle_for,
                         self.time_mock_cluster_idle(mock_cluster))
        self.assertEqual((pool_hash, pool_name),
                         _pool_hash_and_name(mock_cluster))
        self.assertEqual(running,
                         _is_cluster_running(mock_cluster['_Steps']))
 def time_mock_cluster_idle(self, mock_cluster):
     if (_is_cluster_starting(mock_cluster)
             or _is_cluster_bootstrapping(mock_cluster)
             or _is_cluster_running(mock_cluster['_Steps'])
             or _is_cluster_done(mock_cluster)):
         return timedelta(0)
     else:
         return self.now - _time_last_active(mock_cluster,
                                             mock_cluster['_Steps'])
 def time_mock_cluster_idle(self, mock_cluster):
     if (_is_cluster_starting(mock_cluster) or
             _is_cluster_bootstrapping(mock_cluster) or
             _is_cluster_running(mock_cluster._steps) or
             _is_cluster_done(mock_cluster)):
         return timedelta(0)
     else:
         return self.now - _time_last_active(
             mock_cluster, mock_cluster._steps)