Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

Conversion Host Settings - Unit tests for helpers, prevent corner case of reappearing failures #928

Merged
merged 2 commits into from
Apr 5, 2019

Conversation

mturley
Copy link
Contributor

@mturley mturley commented Apr 4, 2019

Part of the Conversion Hosts UI feature BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1693339

As part of #884, I started filling in the gaps in unit testing of the conversion host settings UI code. I started with the helpers that handle generating the combined list items from parsed and indexed task and conversion host objects, on a hunch that there was a corner case I had missed, and I was right:

If you checkout ce342e9 and try to run the new tests, you'll see two failures due to the { ...exampleTask(20, 'enable', '11'), ...failed } task appearing as an active enablement task even though there were successful enable and disable tasks after it. This means if a user had attempted to enable VM 11 and it failed, then attempted again and it succeeded, then removed it and it succeeded, when the removal completed it would show "enable failed" again instead of disappearing from the list.

This bug is due to the fact that the getActiveConversionHostEnableTasks performed these filters in the wrong order:

  • filter to only enable tasks that are in progress or failed
  • filter those to only the latest task per resource, and only those which don't match a configured conversion host

This was fine in the case of a failed enablement that had been retried, because the first filter would include the failure, but the second filter would remove it since it matched a configured host. But as soon as that host is removed, the second filter wouldn't remove the failure anymore, and we get the bug.

60e6246 fixes this bug by simply reversing the order of these two filters:

  • filter to only the latest task per resource, and only those which don't match a configured conversion host
  • filter those to only enable tasks that are in progress or failed

This way, only the latest task for each resource can be shown in the list, regardless of its state. With the filters reversed, all tasks for VM 11 are filtered out, because the latest task is a disable task, and when the disable completes, that resource is (correctly) no longer present in the list.

@mturley mturley added bug bz Issues filed by QE or having a BZ hammer/yes z-stream v1.2 labels Apr 4, 2019
@mturley mturley requested a review from mzazrivec April 4, 2019 20:51
@miq-bot
Copy link
Member

miq-bot commented Apr 4, 2019

Checked commits mturley/manageiq-v2v@ce342e9~...60e6246 with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0
0 files checked, 0 offenses detected
Everything looks fine. 🏆

@mzazrivec mzazrivec self-assigned this Apr 5, 2019
@mzazrivec mzazrivec merged commit f6dfc22 into ManageIQ:master Apr 5, 2019
@mturley mturley deleted the settings-helper-tests branch April 5, 2019 13:55
simaishi pushed a commit that referenced this pull request Apr 5, 2019
Conversion Host Settings - Unit tests for helpers, prevent corner case of reappearing failures

(cherry picked from commit f6dfc22)

https://bugzilla.redhat.com/show_bug.cgi?id=1696423
@simaishi
Copy link
Contributor

simaishi commented Apr 5, 2019

Hammer backport details:

$ git log -1
commit 11a670309d45854610682787dccf372b1cff3b42
Author: Milan Zázrivec <mzazrivec@redhat.com>
Date:   Fri Apr 5 10:19:52 2019 +0200

    Merge pull request #928 from mturley/settings-helper-tests
    
    Conversion Host Settings - Unit tests for helpers, prevent corner case of reappearing failures
    
    (cherry picked from commit f6dfc222053d10d30de268c253176aeea32dabbc)
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1696423

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants