Skip to content

Commit

Permalink
fix: flaky test for dashboard changed on (#19483)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhaoyongjie committed Apr 1, 2022
1 parent d954c3d commit a2e921b
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions tests/integration_tests/charts/api_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,9 @@
# isort:skip_file
"""Unit tests for Superset"""
import json
from datetime import datetime
from io import BytesIO
from zipfile import is_zipfile, ZipFile

import humanize
import prison
import pytest
import yaml
Expand Down Expand Up @@ -803,7 +801,6 @@ def test_get_charts_changed_on(self):
Dashboard API: Test get charts changed on
"""
admin = self.get_user("admin")
start_changed_on = datetime.now()
chart = self.insert_chart("foo_a", [admin.id], 1, description="ZY_bar")

self.login(username="admin")
Expand All @@ -817,9 +814,9 @@ def test_get_charts_changed_on(self):
rv = self.get_assert_metric(uri, "get_list")
self.assertEqual(rv.status_code, 200)
data = json.loads(rv.data.decode("utf-8"))
self.assertEqual(
data["result"][0]["changed_on_delta_humanized"],
humanize.naturaltime(datetime.now() - start_changed_on),
assert data["result"][0]["changed_on_delta_humanized"] in (
"now",
"a second ago",
)

# rollback changes
Expand Down

0 comments on commit a2e921b

Please sign in to comment.