get_panel_group error with enabled panel tests

Bug #1479018 reported by Matt Borland on 2015-07-28
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Medium
David Lyle

Bug Description

When enabling panels in patches such as:
- https://review.openstack.org/#/c/205296/ (which involves setting Disabled to False)

The feature works perfectly fine when viewed. However, an error comes up when the tests are run, in openstack_dashboard.test.test_plugins.panel_test.

The call to get_panel_group fails:
ERROR: test_remove_panel (openstack_dashboard.test.test_plugins.panel_tests.PanelPluginTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/mborland/horizon/openstack_dashboard/test/test_plugins/panel_tests.py", line 65, in test_remove_panel
    [p.__class__ for p in dashboard.get_panels()])
  File "/home/mborland/horizon/horizon/base.py", line 451, in get_panels
    panel_groups = self.get_panel_groups()
  File "/home/mborland/horizon/horizon/base.py", line 470, in get_panel_groups
    registered.pop(panel.__class__)
KeyError: <class 'openstack_dashboard.dashboards.admin.ngdefaults.panel.NgDefaults'>

When this happens, it seems the panel groups are not quite aligned with what is enabled.

Fix proposed to branch: master
Review: https://review.openstack.org/206594

Changed in horizon:
assignee: nobody → Matt Borland (palecrow)
status: New → In Progress
David Lyle (david-lyle) wrote :

The problem is in the PanelPluginTests for testing plugin loading. The problem is we have a mixed model of how the dashboard and panels are loaded. Some panels are hardcoded into the dashboards. when you add new ones that aren't, they aren't picked up in this test, because it's specifying a different location for plugin files.

Since the addition is happening to the admin dashboard and not the project dashboard as with previous additions. We are seeing the error.

Changed in horizon:
importance: Undecided → Medium
David Lyle (david-lyle) wrote :

I've just spent two days working on deeper fix for this bug. So took ownership. Hope you don't mind Matt :)

Changed in horizon:
assignee: Matt Borland (palecrow) → David Lyle (david-lyle)
status: In Progress → Confirmed

Not at all..I appreciate you taking the time...let me know how I can help!

Matt

On Thursday, July 30, 2015, David Lyle <email address hidden> wrote:

> I've just spent two days working on deeper fix for this bug. So took
> ownership. Hope you don't mind Matt :)
>
>
> ** Changed in: horizon
> Assignee: Matt Borland (palecrow) => David Lyle (david-lyle)
>
> ** Changed in: horizon
> Status: In Progress => Confirmed
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1479018
>
> Title:
> get_panel_group error with enabled panel tests
>
> Status in OpenStack Dashboard (Horizon):
> Confirmed
>
> Bug description:
> When enabling panels in patches such as:
> - https://review.openstack.org/#/c/205296/ (which involves setting
> Disabled to False)
>
> The feature works perfectly fine when viewed. However, an error comes
> up when the tests are run, in
> openstack_dashboard.test.test_plugins.panel_test.
>
> The call to get_panel_group fails:
> ERROR: test_remove_panel
> (openstack_dashboard.test.test_plugins.panel_tests.PanelPluginTests)
> ----------------------------------------------------------------------
> Traceback (most recent call last):
> File
> "/home/mborland/horizon/openstack_dashboard/test/test_plugins/panel_tests.py",
> line 65, in test_remove_panel
> [p.__class__ for p in dashboard.get_panels()])
> File "/home/mborland/horizon/horizon/base.py", line 451, in get_panels
> panel_groups = self.get_panel_groups()
> File "/home/mborland/horizon/horizon/base.py", line 470, in
> get_panel_groups
> registered.pop(panel.__class__)
> KeyError: <class
> 'openstack_dashboard.dashboards.admin.ngdefaults.panel.NgDefaults'>
>
>
> When this happens, it seems the panel groups are not quite aligned with
> what is enabled.
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/horizon/+bug/1479018/+subscriptions
>

David Lyle (david-lyle) on 2015-08-05
Changed in horizon:
milestone: none → liberty-3

Reviewed: https://review.openstack.org/208643
Committed: https://git.openstack.org/cgit/openstack/horizon/commit/?id=8303782f1e67c00f3000acf12773a7df7581fc61
Submitter: Jenkins
Branch: master

commit 8303782f1e67c00f3000acf12773a7df7581fc61
Author: David Lyle <email address hidden>
Date: Mon Aug 3 14:23:42 2015 -0600

    Move Horizon to pure plugin loading only

    The root cause of 1479018 was the mixed method for loading content in
    horizon. This patch moves horizon to load purely from enabled files.
    There are a couple of things that were required to allow this change.

    1) Adding a mechanism, can_register() to horizon/base.py to handle the
    configuration based loading checks that had been accumulating in the
    panel.py files. This is an optional static method in Panel to
    encapsulate such configuration (read settings) based panel loading
    logic. And added testing for and documentation for this addition.

    2) Create a numbering scheme for plugins. Moved the base dashboards to
    _1000_project.py _2000_admin.py _3000_identity.py _5000_settings.py.
    then populated the required panel_group and panel enabled files sparsely
    in those ranges. The sparseness is to allow for future additions.
    Additionally, I moved the already added Angular based panels next to
    their Django counterparts.

    Once the configuration loading was normalized, the bug reported in
    1479018 was resolved and tests work with plugins panels in all
    dashboards.

    Close-Bug: #1479018
    Partially implements: blueprint plugin-sanity

    Change-Id: I657e7ce37b2593a901a859cebf3d6ff8ada91941

Change abandoned by Matt Borland (<email address hidden>) on branch: master
Review: https://review.openstack.org/206594
Reason: David Lyle came up with a better solution.

Thierry Carrez (ttx) on 2015-09-03
Changed in horizon:
milestone: liberty-3 → liberty-rc1
David Lyle (david-lyle) on 2015-09-15
Changed in horizon:
milestone: liberty-rc1 → none
status: Confirmed → Fix Committed
Thierry Carrez (ttx) on 2015-09-26
Changed in horizon:
milestone: none → liberty-rc1
status: Fix Committed → Fix Released
Thierry Carrez (ttx) on 2015-10-15
Changed in horizon:
milestone: liberty-rc1 → 8.0.0
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers