avocado-framework / avocado

Avocado is a set of tools and libraries to help with automated testing. One can call it a test framework with benefits. Native tests are written in Python and they follow the unittest pattern, but any executable can serve as a test.
https://avocado-framework.github.io/
Other
345 stars 343 forks source link

Dependency in recipes is not working #5918

Closed richtja closed 6 months ago

richtja commented 7 months ago

Describe the bug After the introduction of recipe resolver in #5897. The avocado should support dependencies inside recipes. But when you try to add dependencies into recipe, avocado will crases.

Steps to reproduce recipe with dependencies:

{
  "kind": "exec-test",
  "uri": "/bin/echo",
  "kwargs": {"dependencies": [{"type": "package", "name": "bash"}]}
}

Expected behavior

$ avocado run ../testing/exec_recipe.json
JOB ID     : 5e05819125e0f69d22f854fd22fe0fa3424fa2bc
JOB LOG    : /home/janrichter/avocado/job-results/job-2024-04-26T17.31-5e05819/job.log
 (1/1) /bin/true: STARTED
 (1/1) /bin/true: PASS (0.01 s)
RESULTS    : PASS 1 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0
JOB HTML   : /home/janrichter/avocado/job-results/job-2024-04-26T17.31-5e05819/results.html
JOB TIME   : 1.09 s

Current behavior

$ avocado run ../testing/exec_recipe.json
JOB ID     : 96fd2cf4f2b2a07ac65d9905b5fa36c907c40623
JOB LOG    : /home/janrichter/avocado/job-results/job-2024-04-26T17.32-96fd2cf/job.log

Avocado crashed: TypeError: unhashable type: 'dict'
Traceback (most recent call last):

  File "/home/janrichter/Avocado/avocado/avocado/core/job.py", line 653, in run_tests
    summary |= suite.run(self)
               ^^^^^^^^^^^^^^^

  File "/home/janrichter/Avocado/avocado/avocado/core/suite.py", line 313, in run
    return self.runner.run_suite(job, self)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/home/janrichter/Avocado/avocado/avocado/plugins/runner_nrunner.py", line 316, in run_suite
    graph = RuntimeTaskGraph(
            ^^^^^^^^^^^^^^^^^

  File "/home/janrichter/Avocado/avocado/avocado/core/task/runtime.py", line 337, in __init__
    pre_tasks = PreRuntimeTask.get_tasks_from_test_task(
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/home/janrichter/Avocado/avocado/avocado/core/task/runtime.py", line 241, in get_tasks_from_test_task
    runnables = test_runnables_method(runnable, suite_config)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/home/janrichter/Avocado/avocado/avocado/plugins/dependency.py", line 44, in pre_test_runnables
    unique_dependencies = list(dict.fromkeys(test_runnable.dependencies))
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

TypeError: unhashable type: 'dict'

Please include the traceback info and command line used on your bug report
Report bugs visiting https://github.com/avocado-framework/avocado/issues/new
clebergnu commented 6 months ago

Resolved in #5925