functional-tests: snapshot: Skip if filesystem doesn't support snapshots

Tested that on the Btrfs filesystem snapshot functional tests pass and
on the ext4 filesystem tests are skipped.

Signed-off-by: Veiko Aasa <veiko17@disroot.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Veiko Aasa 2020-07-28 17:22:19 +03:00 committed by James Valleroy
parent d92ca09e19
commit c454aa1019
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808
3 changed files with 17 additions and 2 deletions

View File

@ -7,7 +7,7 @@
{% load i18n %}
{% block configuration %}
<div class="alert alert-danger">
<div id="snapshot-not-supported" class="alert alert-danger">
{% blocktrans trimmed with fs_types_supported|join:', ' as types_supported %}
You have a filesystem of type <strong>{{ fs_type }}</strong>. Snapshots
are currently only available on <strong>{{ types_supported }}</strong>

View File

@ -6,7 +6,8 @@ Feature: Storage Snapshots
Background:
Given I'm a logged in user
Given the snapshot application is installed
And the snapshot application is installed
And the filesystem supports snapshots
Scenario: Create a snapshot
Given the list of snapshots is empty

View File

@ -3,6 +3,7 @@
Functional, browser based tests for snapshot app.
"""
import pytest
from pytest_bdd import given, parsers, scenarios, then, when
from plinth.tests import functional
@ -10,6 +11,13 @@ from plinth.tests import functional
scenarios('snapshot.feature')
@given('the filesystem supports snapshots')
def is_snapshots_supported(session_browser):
if not _is_snapshot_supported(session_browser):
pytest.skip('Filesystem doesn\'t support snapshots')
assert True
@given('the list of snapshots is empty')
def empty_snapshots_list(session_browser):
_delete_all(session_browser)
@ -99,6 +107,12 @@ def _get_count(browser):
return len(browser.find_by_xpath('//tr')) - 1
def _is_snapshot_supported(browser):
"""Return whether the filesystem supports snapshots."""
functional.nav_to_module(browser, 'snapshot')
return not bool(browser.find_by_id('snapshot-not-supported'))
def _set_configuration(browser, free_space, timeline_enabled, software_enabled,
hourly, daily, weekly, monthly, yearly):
"""Set the configuration for snapshots."""