def test_container_convergence_no_matching_results(self): """ container_convergence only considers results which have the 'wallclock' metric and are for the 'create-container' operation. None is returned if no results match. """ results = [ { 'metric': { 'type': 'cputime' }, 'operation': { 'type': 'create-container' }, 'value': 4 }, { 'metric': { 'type': 'wallclock' }, 'operation': { 'type': 'read-request' }, 'value': 10, }, ] convergence_results = container_convergence(results, 10) self.assertEqual(convergence_results, None)
def test_container_convergence_no_matching_results(self): """ container_convergence only considers results which have the 'wallclock' metric and are for the 'create-container' operation. None is returned if no results match. """ results = [ {"metric": {"type": "cputime"}, "operation": {"type": "create-container"}, "value": 4}, {"metric": {"type": "wallclock"}, "operation": {"type": "read-request"}, "value": 10}, ] convergence_results = container_convergence(results, 10) self.assertEqual(convergence_results, None)
def test_container_convergence_calculates_result(self): """ container_convergence returns the percentage of 'create-container' operations that completed within the specified time limit. """ results = [ {"metric": {"type": "wallclock"}, "operation": {"type": "create-container"}, "value": 4}, {"metric": {"type": "wallclock"}, "operation": {"type": "create-container"}, "value": 2}, {"metric": {"type": "wallclock"}, "operation": {"type": "create-container"}, "value": 5}, {"metric": {"type": "wallclock"}, "operation": {"type": "create-container"}, "value": 9}, ] convergence_results = container_convergence(results, 5) self.assertEqual(convergence_results, 0.75)
def test_container_convergence_calculates_result(self): """ container_convergence returns the percentage of 'create-container' operations that completed within the specified time limit. """ results = [ { 'metric': { 'type': 'wallclock' }, 'operation': { 'type': 'create-container' }, 'value': 4 }, { 'metric': { 'type': 'wallclock' }, 'operation': { 'type': 'create-container' }, 'value': 2 }, { 'metric': { 'type': 'wallclock' }, 'operation': { 'type': 'create-container' }, 'value': 5 }, { 'metric': { 'type': 'wallclock' }, 'operation': { 'type': 'create-container' }, 'value': 9, }, ] convergence_results = container_convergence(results, 5) self.assertEqual(convergence_results, 0.75)