Skip to content

Commit

Permalink
Fix replication tests
Browse files Browse the repository at this point in the history
  • Loading branch information
themylogin committed Apr 29, 2019
1 parent 1f84595 commit 1fc6522
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/middlewared/middlewared/plugins/replication.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ async def _validate(self, data):
if data["naming_schema"]:
verrors.add("naming_schema", "This field has no sense for push replication")

if not snapshot_tasks and not data["also_include_naming_schema"]:
if data["transport"] != "LEGACY" and not snapshot_tasks and not data["also_include_naming_schema"]:
verrors.add(
"periodic_snapshot_tasks", "You must at least either bind a periodic snapshot task or provide "
"\"Also Include Naming Schema\" for push replication task"
Expand Down
10 changes: 6 additions & 4 deletions tests/api2/replication.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,9 @@ def test_00_bootstrap(credentials, periodic_snapshot_tasks):
# Auto with periodic snapshot task
(dict(periodic_snapshot_tasks=["data-recursive"], auto=True), None),
# Auto with schedule
(dict(schedule={"minute": "*/2"}, auto=True), None),
(dict(also_include_naming_schema=["snap-%Y%m%d-%H%M-2m"], schedule={"minute": "*/2"}, auto=True), None),
# Auto without periodic snapshot task or schedule
(dict(auto=True), "auto"),
(dict(also_include_naming_schema=["snap-%Y%m%d-%H%M-2m"], auto=True), "auto"),
# Pull + periodic snapshot tasks
(dict(direction="PULL", periodic_snapshot_tasks=["data-recursive"]), "periodic_snapshot_tasks"),
Expand All @@ -150,7 +150,8 @@ def test_00_bootstrap(credentials, periodic_snapshot_tasks):
"hold_pending_snapshots"),
# SSH+Netcat
(dict(transport="SSH+NETCAT", ssh_credentials=True, netcat_active_side="LOCAL", netcat_active_side_port_min=1024,
(dict(periodic_snapshot_tasks=["data-recursive"],
transport="SSH+NETCAT", ssh_credentials=True, netcat_active_side="LOCAL", netcat_active_side_port_min=1024,
netcat_active_side_port_max=50000),
None),
# Bad netcat_active_side_port_max
Expand Down Expand Up @@ -202,7 +203,8 @@ def test_00_bootstrap(credentials, periodic_snapshot_tasks):
"exclude.0"),
# Custom retention policy
(dict(retention_policy="CUSTOM", lifetime_value=2, lifetime_unit="WEEK"), None),
(dict(periodic_snapshot_tasks=["data-recursive"],
retention_policy="CUSTOM", lifetime_value=2, lifetime_unit="WEEK"), None),
])
def test_create_replication(credentials, periodic_snapshot_tasks, req, error):
if "ssh_credentials" in req:
Expand Down

0 comments on commit 1fc6522

Please sign in to comment.