Skip to content

Commit

Permalink
Fix timestamps for skipped tests, as coverage ignore skip
Browse files Browse the repository at this point in the history
  • Loading branch information
Molaire committed Jul 27, 2023
1 parent 1b057c6 commit 9ea9dbc
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
6 changes: 3 additions & 3 deletions tests/api/test_instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ def test_app_status(
"tasks_healthy": 2,
"tasks_staged": 0,
"tasks_total": 4,
"create_timestamp": 1560515696,
"create_timestamp": 1560540896.0,
"deploy_status": "Running",
"unused_offers": mock_summarize_unused_offers.return_value,
"dashboard_url": "https://paasta.party/ui/#/apps/%2Ffoo",
Expand Down Expand Up @@ -394,7 +394,7 @@ def test_list_tasks(
"id": "baz",
"host": "host1",
"port": 123,
"deployed_timestamp": 1560517200,
"deployed_timestamp": 1560542400.0,
"is_healthy": True,
}
]
Expand Down Expand Up @@ -773,7 +773,7 @@ async def test_get_mesos_running_task_dict(self, mock_task):
"cpu_shares": {"value": 2.1},
"cpu_used_seconds": {"value": 1.5},
"deployed_timestamp": 1560888500,
"duration_seconds": 7540,
"duration_seconds": 32740,
"tail_lines": {},
}

Expand Down
2 changes: 1 addition & 1 deletion tests/api/tweens/test_request_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def test_request_logger_tween_factory_log(mock_clog, mock_factory):
'{"additional_key": "additional_value", '
'"cluster": "a_cluster", '
'"hostname": "a_hostname", '
'"human_timestamp": "2020-05-18T18:54:09", '
'"human_timestamp": "2020-05-18T11:54:09", '
'"level": "ERROR", '
'"unix_timestamp": 1589828049.0}'
),
Expand Down
20 changes: 10 additions & 10 deletions tests/cli/test_cmds_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -2395,13 +2395,13 @@ def test_output(
expected_output += [
f" Pods:",
f" Pod ID Host deployed to Deployed at what localtime Health",
f" app_1 fake_host1 2019-07-12T20:31 ({mock_naturaltime.return_value}) {PaastaColors.green('Healthy')}",
f" app_2 fake_host2 2019-07-12T20:31 ({mock_naturaltime.return_value}) {PaastaColors.green('Healthy')}",
f" app_3 fake_host3 2019-07-12T20:31 ({mock_naturaltime.return_value}) {PaastaColors.red('Evicted')}",
f" app_1 fake_host1 2019-07-12T13:31 ({mock_naturaltime.return_value}) {PaastaColors.green('Healthy')}",
f" app_2 fake_host2 2019-07-12T13:31 ({mock_naturaltime.return_value}) {PaastaColors.green('Healthy')}",
f" app_3 fake_host3 2019-07-12T13:31 ({mock_naturaltime.return_value}) {PaastaColors.red('Evicted')}",
f" {PaastaColors.grey(' Disk quota exceeded')}",
f" ReplicaSets:",
f" ReplicaSet Name Ready / Desired Created at what localtime Service git SHA Config hash",
f" replicaset_1 {PaastaColors.red('2/3')} 2019-07-12T20:31 ({mock_naturaltime.return_value}) Unknown Unknown",
f" replicaset_1 {PaastaColors.red('2/3')} 2019-07-12T13:31 ({mock_naturaltime.return_value}) Unknown Unknown",
]

assert expected_output == output
Expand Down Expand Up @@ -3062,7 +3062,7 @@ def test_marathon_app_status_human(self, mock_naturaltime, mock_app_status):
assert uncolored_output == [
f"Dashboard: {mock_app_status.dashboard_url}",
f" 5 running, 4 healthy, 3 staged out of 12",
f" App created: 2019-08-13 21:28:01 ({mock_naturaltime.return_value})",
f" App created: 2019-08-13 14:28:01 ({mock_naturaltime.return_value})",
f" Status: Deploying",
]

Expand Down Expand Up @@ -3107,7 +3107,7 @@ def test_format_marathon_task_table(self, mock_naturaltime, mock_marathon_task):
assert task_table_dict == {
"Mesos Task ID": "abc123",
"Host deployed to": "paasta.cloud:4321",
"Deployed at what localtime": f"2019-08-12T22:23 ({mock_naturaltime.return_value})",
"Deployed at what localtime": f"2019-08-12T15:23 ({mock_naturaltime.return_value})",
"Health": PaastaColors.green("Healthy"),
}

Expand Down Expand Up @@ -3168,7 +3168,7 @@ def test_format_kubernetes_pod_table(
assert pod_table_dict == {
"Pod ID": "abc123",
"Host deployed to": "paasta.cloud",
"Deployed at what localtime": f"2019-08-12T22:23 ({mock_naturaltime.return_value})",
"Deployed at what localtime": f"2019-08-12T15:23 ({mock_naturaltime.return_value})",
"Health": PaastaColors.green("Healthy"),
}

Expand All @@ -3183,7 +3183,7 @@ def test_format_kubernetes_replicaset_table(
assert replicaset_table_dict == {
"ReplicaSet Name": "abc123",
"Ready / Desired": PaastaColors.green("3/3"),
"Created at what localtime": f"2019-08-12T22:23 ({mock_naturaltime.return_value})",
"Created at what localtime": f"2019-08-12T15:23 ({mock_naturaltime.return_value})",
"Service git SHA": "def456",
"Config hash": "Unknown",
}
Expand Down Expand Up @@ -3326,7 +3326,7 @@ def test_create_mesos_running_tasks_table(
"Host deployed to": mock_running_task.hostname,
"Ram": "1/2MB",
"CPU": "0.8%",
"Deployed at what localtime": f"2019-08-11T23:51 ({mock_naturaltime.return_value})",
"Deployed at what localtime": f"2019-08-11T16:51 ({mock_naturaltime.return_value})",
}
assert output[2:] == ["tail line 1", "tail line 2"]
mock_format_tail_lines_for_mesos_task.assert_called_once_with(
Expand Down Expand Up @@ -3391,7 +3391,7 @@ def test_create_mesos_non_running_tasks_table(
assert task_dict == {
"Mesos Task ID": mock_non_running_task.id,
"Host deployed to": mock_non_running_task.hostname,
"Deployed at what localtime": f"2019-08-01T07:00 ({mock_naturaltime.return_value})",
"Deployed at what localtime": f"2019-08-01T00:00 ({mock_naturaltime.return_value})",
"Status": mock_non_running_task.state,
}
assert uncolored_output[2:] == ["tail line 1", "tail line 2"]
Expand Down
4 changes: 2 additions & 2 deletions tests/test_mesos_maintenance.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def test_parse_datetime_invalid():


def test_parse_datetime():
assert parse_datetime("November 11, 2011 11:11:11Z") == 1321009871000000000
assert parse_datetime("November 11, 2011 11:11:11Z") == 1321038671000000000


@mock.patch("paasta_tools.mesos_maintenance.now", autospec=True)
Expand All @@ -109,7 +109,7 @@ def test_seconds_to_nanoseconds():

def test_datetime_to_nanoseconds():
dt = datetime.datetime(2016, 4, 16, 0, 23, 40, 157145, tzinfo=tz.tzutc())
expected = 1460766220000000000
expected = 1460795020000000000
assert datetime_to_nanoseconds(dt) == expected


Expand Down

0 comments on commit 9ea9dbc

Please sign in to comment.