Skip to content

Commit

Permalink
Merge branch 'release/2.15.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
vmalloc committed Feb 20, 2019
2 parents 989ce12 + 31f71c8 commit 5fd3ddb
Show file tree
Hide file tree
Showing 7 changed files with 91 additions and 27 deletions.
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## Version 2.15.5

* Sessions dead due to fatal exceptions now show a much clearer indication in their sidebar
* Fixed replication progress indication

## Version 2.15.4

Expand Down
17 changes: 17 additions & 0 deletions flask_app/blueprints/rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,23 @@ class ReplicationsResource(ModelResource):
'url'
]

def _render_many(self, objects, *, in_collection: bool):
returned = super()._render_many(objects, in_collection=in_collection)
[latest_timestamp] = models.db.session.query(func.max(models.Test.updated_at)).one()

if latest_timestamp:
latest_timestamp = latest_timestamp.timestamp()

for replication in returned['replications']:
last_replicated = replication['last_replicated_timestamp']
if not latest_timestamp or not last_replicated:
lag = None
else:
lag = latest_timestamp - last_replicated
replication['lag_seconds'] = lag

return returned


@blueprint.route('/admin_alerts')
def get_admin_alerts():
Expand Down
44 changes: 44 additions & 0 deletions tests/test_test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,50 @@ def test_cannot_report_interruption_on_planned_test(started_session, test_name,
assert test.refresh().status.lower() != 'interrupted'


def test_skipped_test_adds_error(started_session, started_test):
started_test.mark_skipped("skipped")
started_test.add_error("error")
started_test.report_end()
started_session.report_end()
assert started_session.refresh().num_skipped_tests == 0
assert started_session.num_error_tests == 1
assert started_session.num_finished_tests == 1


def test_errored_test_adds_skip(started_session, started_test):
started_test.add_error("error")
started_test.mark_skipped("skipped")
started_test.report_end()
started_session.report_end()
assert started_session.refresh().num_skipped_tests == 0
assert started_session.num_error_tests == 1
assert started_session.num_finished_tests == 1


def test_ended_error_test_adds_skip(started_session, started_test):
started_test.add_error("error")
started_test.report_end()
started_test.mark_skipped("skipped")
started_session.report_end()
started_session.refresh()
assert started_session.num_skipped_tests == 0
assert started_session.num_error_tests == 1
assert started_session.num_finished_tests == 1


def test_error_failure_test_adds_skip(started_session, started_test):
started_test.add_error("error", is_failure=True)
started_test.add_error("error", is_failure=False)
started_test.mark_skipped("skipped")
started_test.report_end()
started_session.report_end()
started_session.refresh()
assert started_session.num_skipped_tests == 0
assert started_session.num_error_tests == 1
assert started_session.num_failed_tests == 0



@pytest.fixture(params=[True, False])
def params(request):
encodable = request.param
Expand Down
18 changes: 17 additions & 1 deletion webapp/app/admin/replications/index/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,27 @@
<span class="label label-danger">error</span>
{{/if}}
{{/if}}
{{#if replication.lagging}}
<span class="label label-danger">lagging</span>
{{/if}}
</div>
</div>
<div class="row">
<div class="col-sm-12 pad-medium">
{{#if (and replication.active replication.lagging)}}
<div class="progress">
<div class="progress-bar progress-bar-striped active" role="progressbar" aria-valuenow="45" aria-valuemin="0" aria-valuemax="100" style="width: 45%">
Resyncing...
</div>
</div>
{{/if}}
</div>
</div>
<div class="row">
<div class="col-sm-9 faint">
Last test replicated from: <span title="{{replication.last_replicated_timestamp_str}}">{{moment-time ago=replication.last_replicated_timestamp}}</span>
<small>
Lagging by {{round replication.lag_seconds}} seconds
</small>
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion webapp/app/components/session-breakdown/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
{{#with (sub (or session.total_num_tests session.num_finished_tests) session.num_finished_tests) as |num_not_run|}}
<div class="not-run">
{{#elements/tool-tip title=(concat num_not_run " tests not run")}}
<i class="fa fa-minus"></i> {{num_not_run}}
<i class="fa fa-question-circle"></i> {{num_not_run}}
{{/elements/tool-tip}}
</div>

Expand Down
4 changes: 2 additions & 2 deletions webapp/app/components/session-overview/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
{{/if}}

{{#if session_model.has_fatal_errors}}
<p class="faint">
<div class="alert alert-danger" role="alert">
The session was terminated due to a fatal error encountered during its execution.
</p>
</div>
{{/if}}

{{#if session_model.is_parent_session}}
Expand Down
29 changes: 6 additions & 23 deletions webapp/app/models/replication.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,31 +11,14 @@ export default DS.Model.extend({
backlog_remaining: DS.attr("number"),
last_error: DS.attr(),
paused: DS.attr(),
lag_seconds: DS.attr("number"),
last_replicated_timestamp: DS.attr(),

last_replicated_timestamp_str: computed(
"last_replicated_timestamp",
function() {
let timestamp = this.get("last_replicated_timestamp");
if (timestamp) {
return moment.unix(timestamp);
}
}
),

time_remaining: computed("avg_per_second", "backlog_remaining", function() {
let remaining = this.get("backlog_remaining");
let avg = this.get("avg_per_second");
if (!avg) {
return 0;
}
let seconds_remaining = remaining / avg;
if (seconds_remaining > 3600) {
return `${Math.trunc(seconds_remaining / 3600)} hours`;
} else if (seconds_remaining > 60) {
return `${Math.trunc(seconds_remaining / 60)} minutes`;
} else {
return `${seconds_remaining} seconds`;
lagging: computed('lag_seconds', function() {
let lag_seconds = this.get('lag_seconds');
if (lag_seconds === null) {
return true;
}
return lag_seconds > 5 * 60;
}),
});

0 comments on commit 5fd3ddb

Please sign in to comment.