Skip to content
This repository was archived by the owner on Oct 31, 2023. It is now read-only.

Commit

Permalink
Merge pull request #3470 from golemfactory/0.18.0-add-provider-income…
Browse files Browse the repository at this point in the history
…-check-to-integration-test

add a provider income check to the integration test
jiivan authored Oct 19, 2018

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
2 parents f0e2f3f + c864804 commit dcfa11f
Showing 1 changed file with 36 additions and 1 deletion.
37 changes: 36 additions & 1 deletion scripts/concent_integration_tests/tests/playbooks/base.py
Original file line number Diff line number Diff line change
@@ -45,6 +45,7 @@ class NodeTestPlaybook:
started = False
task_in_creation = False
output_path = None
subtasks = None

task_package = None
task_settings = 'default'
@@ -279,11 +280,43 @@ def step_verify_output(self):
print("Verifying the output file: {}".format(output_file))
if Path(output_file).is_file():
print("Output present :)")
self.success()
self.next()
else:
print("Failed to find the output.")
self.fail()

def step_get_subtasks(self):
def on_success(result):
self.subtasks = [
s.get('subtask_id')
for s in result
if s.get('status') == 'Finished'
]
if not self.subtasks:
self.fail("No subtasks found???")
self.next()

call_requestor('comp.task.subtasks', self.task_id,
on_success=on_success, on_error=self.print_error)

def step_verify_provider_income(self):
def on_success(result):
payments = [
p.get('subtask')
for p in result
if p.get('payer') == self.requestor_key
]
unpaid = set(self.subtasks) - set(payments)
if unpaid:
print("Found subtasks with no matching payments: %s", unpaid)
self.fail()

print("All subtasks accounted for.")
self.success()

call_provider(
'pay.incomes', on_success=on_success, on_error=self.print_error)

steps: typing.Tuple = (
step_get_provider_key,
step_get_requestor_key,
@@ -299,6 +332,8 @@ def step_verify_output(self):
step_get_task_status,
step_wait_task_finished,
step_verify_output,
step_get_subtasks,
step_verify_provider_income,
)

def start_nodes(self):

0 comments on commit dcfa11f

Please sign in to comment.