Skip to content

Conversation

@gbrian
Copy link
Contributor

@gbrian gbrian commented Sep 9, 2019

CATEGORY

Choose one

  • Bug Fix
  • Enhancement (new features, refinement)
  • Refactor
  • Add tests
  • Build / Development Environment
  • Documentation

SUMMARY

#8199

REVIEWERS

if (
"remote_id" in dash.params_dict
and dash.params_dict["remote_id"] == dashboard_to_import.id
and dash.params_dict["remote_id"] == remote_id
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would be nice to add a unit test

Copy link
Contributor Author

@gbrian gbrian Sep 9, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Looked at the tests and they seem to be testing a different approach than the one implemented but still I'm missing many parts.

This test should have cough the error: test_import_override_dashboard_2_slices but executes a different logic than the current one implemented.
Do you think we cab move on without the test? Ofc, is working on our project 😅 "Trust me I'm engineer!"

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was working on this part of the codebase a while ago and this one is quite tricky and easy to introduce a bug.
In addition to that if somebody would refactor this file in the future it would be nice to provide them some guardrails. This is not a blocker but just a suggestion.

A good test case would be importing:
dash1 {id: 1, remote_id: 101}
dash2 {id:2, remote_id: 101}
and making sure that override will happen

@mistercrunch
Copy link
Member

We really need to introduce uuid as part of ImportExportMixin, some work has been started but needs to be resumed.
#7829
#7472

@gbrian
Copy link
Contributor Author

gbrian commented Sep 10, 2019

@bkyryliuk , @mistercrunch can we merge this in the meantime? Moved to other issues and the fix is so small so does not introduce more complexity and current import is not updating existing dashboards. Thanks in advance


# override the dashboard
existing_dashboard = None
remote_id = dashboard_to_import.params_dict.get("remote_id")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we do remote_id = dashboard_to_import.params_dict.get("remote_id") or dashboard_to_import.id to be prudent here

@mistercrunch
Copy link
Member

I'd also like to see a test that fails before the fix and succeed after. Maybe it's just a matter of adding a new assertion counting the number of dashboards (?) to check if it gets added instead of updated (?)

@mistercrunch
Copy link
Member

@stale
Copy link

stale bot commented Nov 10, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. For admin, please label this issue .pinned to prevent stale bot from closing the issue.

@stale stale bot added the inactive Inactive for >= 30 days label Nov 10, 2019
@stale stale bot closed this Nov 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

inactive Inactive for >= 30 days size/XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants