Uploaded image for project: 'Common Controller SDK'
  1. Common Controller SDK
  2. CCSDK-1930

Helm tests for rollback and update always succeed

XMLWordPrintable

    • Icon: Task Task
    • Resolution: Unresolved
    • Icon: Low Low
    • None
    • None
    • sli/plugins
    • None

      Two tests in helm/plugin/tests/test_plugin.py, test_rollback and test_upgrade, are currently written to always succeed, by first catching any exception that might occur, then performing an assertTrue on a string constant, which is a True object.

      The messages suggest that at the time of writing, the tested functions were not available. That seems to no longer be the case - when the wrapping is removed, both operations get called.

      Although they fail anyway, the tests create a wrong impression that it's due to the unavailability of both functions, which need not be true. Excerpts from the attached logs indicate that they may have been called wrongly.

      For rollback:

        File "ccsdk/plugins/helm/plugin/workflows.py", line 64, in rollback
          node_instance.execute_operation(**operation_args)
      AttributeError: 'NoneType' object has no attribute 'execute_operation' 

      However, upgrade sees a different error

         File "ccsdk/plugins/helm/.tox/py27/local/lib/python2.7/site-packages/cloudify/workflows/local.py", line 341, in _merge_and_validate_execution_parameters
          .format(workflow_name, ','.join(custom_parameters.keys())))
      ValueError: Workflow "upgrade" does not have the following parameters declared: repo_user,repo_user_password. Remove these parameters or use the flag for allowing custom parameters

      Interestingly, when the two offending parameters are excluded, they're missing again:

        File "ccsdk/plugins/helm/.tox/py27/local/lib/python2.7/site-packages/cloudify/dispatch.py", line 544, in _execute_workflow_function
          result = self.func(*self.args, **self.kwargs)
      TypeError: upgrade() takes exactly 9 arguments (7 given)
        File "ccsdk/plugins/helm/.tox/py36/lib/python3.6/site-packages/cloudify/dispatch.py", line 692, in _execute_workflow_function
          result = self.func(*self.args, **self.kwargs)
      TypeError: upgrade() missing 2 required positional arguments: 'repo_user' and 'repo_user_password'
      -------------------- >> begin captured stdout << ---------------------
      2019-11-14 18:35:03.696  CFY <test_upgrade> b"Starting 'upgrade' workflow execution"
      2019-11-14 18:35:03.696  CFY <test_upgrade> b"'upgrade' workflow execution failed: upgrade() missing 2 required positional arguments: 'repo_user' and 'repo_user_password'" 

      In case these were actually the original errors, then either the tests should use pytest.raises(AttributeError / TypeError) and check the message, or be marked with pytest.mark.xfail, so that any change in the availability of the functions is reported properly.

      Assigning to Hong Guan as he wrote the tests, and is thus knowledgeable about them.

            hg4105 hg4105
            mirlos mirlos
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: