Skip to content

[BD-21] Make use of edx_toggles newest API for testing - #118

Merged
robrap merged 1 commit into
openedx:masterfrom
regisb:regisb/waffle-override
Nov 4, 2020
Merged

[BD-21] Make use of edx_toggles newest API for testing#118
robrap merged 1 commit into
openedx:masterfrom
regisb:regisb/waffle-override

Conversation

@regisb

@regisb regisb commented Oct 23, 2020

Copy link
Copy Markdown
Contributor

Description: Make use of edx_toggles API for overriding waffle switches in tests

JIRA: https://openedx.atlassian.net/wiki/spaces/COMM/pages/1596358943

Dependencies: openedx/edx-toggles#75 ✔️ merged

Reviewers:

Merge checklist:

  • All reviewers approved
  • @robrap to confirm deprecated_waffle_utils custom attribute data exists before landing this
  • CI build is green
  • Version bumped
  • Changelog record added
  • Documentation updated (not only docstrings)
  • Commits are squashed

Post merge:

  • Create a tag
  • Check new version is pushed to PyPi after tag-triggered build is
    finished.
  • Delete working branch (if not needed anymore)

@openedx-webhooks openedx-webhooks added blended PR is managed through 2U's blended developmnt program needs triage labels Oct 23, 2020
@openedx-webhooks

Copy link
Copy Markdown

Thanks for the pull request, @regisb! I've created BLENDED-642 to keep track of it in Jira. More details are on the BD-21 project page.

When this pull request is ready, tag your edX technical lead.

@regisb
regisb force-pushed the regisb/waffle-override branch from 89f6426 to a438a44 Compare October 23, 2020 14:32
@regisb

regisb commented Oct 23, 2020

Copy link
Copy Markdown
Contributor Author

This is ready for review @robrap.

@regisb
regisb force-pushed the regisb/waffle-override branch from a438a44 to 92e5cc3 Compare October 23, 2020 14:40
Comment thread completion/test_utils.py Outdated
override (bool): True if tracking should be enabled.
"""
_waffle_overrider = waffle.waffle().override(waffle.ENABLE_COMPLETION_TRACKING, override)
_waffle_overrider = override_waffle_switch(waffle.waffle_switch(waffle.ENABLE_COMPLETION_TRACKING), override)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If this is working, can we just leave this as-is until we have the final version of all of this code without namespacing, so we don't have to test and retest this with every revision? We'll just add it once the dust settles.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is unfortunately not working, as we remove the .override methods from the waffle namespace classes in edx-platform. edx-platform tests themselves depend on edx-completion's test_utils, so tests will not pass until we merge this.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

  1. I presume you mean in this PR: https://github.com/edx/edx-platform/pull/25417/files?
  2. In the edx-platform, I'd rather deprecate and then remove. I usually add something like set_custom_attribute('deprecated_THING_TO_BE_DEPRECATED', True) to the deprecated methods so I can track that there really is no usage before removal.

We can still land this, but it might be better to land it after, rather than before, so I can see that the deprecated_X custom attribute was firing and finally stops. The main point is to see if anything else is using it that we didn't notice before removal.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, this is linked to https://github.com/edx/edx-platform/pull/25417.

The override functions are test methods, so my thinking was that it would be overkill to go through the deprecation process for them. But sure, I can do that.

We can still land this, but it might be better to land it after, rather than before, so I can see that the deprecated_X custom attribute was firing and finally stops. The main point is to see if anything else is using it that we didn't notice before removal.

This needs to be merged before https://github.com/edx/edx-platform/pull/25417, or unit tests will fail in edx-platform -- unless we go through a deprecation process.

Comment thread completion/waffle.py Outdated
@regisb

regisb commented Oct 29, 2020

Copy link
Copy Markdown
Contributor Author

@robrap I updated this PR -- and did not squash my changes this time :)

@regisb
regisb force-pushed the regisb/waffle-override branch from 3db74f1 to 67f276a Compare October 29, 2020 09:15

@robrap robrap left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

In terms of timing, assuming we add a custom attribute for monitoring deprecation of the edx-platform WaffleSwitch and WaffleSwitchNamespace before removing them, I'd like to land this after the edx-platform deprecation, and before the removal.

Comment thread completion/test_utils.py
@regisb

regisb commented Oct 29, 2020

Copy link
Copy Markdown
Contributor Author

I'd like to land this after the edx-platform deprecation, and before the removal.

Sounds good. I'll add back the override method to https://github.com/edx/edx-platform/pull/25417 so that we can merge this completion PR after.

@robrap robrap left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I plan on delaying merge until I can see the monitoring custom attribute from the edx-platform PR. Please ensure this is squashed as you wish.

Comment thread completion/waffle.py
# .. toggle_description: Indicates whether or not to track completion of individual blocks. Keeping this disabled
# will prevent creation of BlockCompletion objects in the database, as well as preventing completion-related
# network access by certain xblocks.
# .. toggle_use_cases: open_edx

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@regisb: Do you know that this is meant to be a permanent flag, or was this just a guess?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

My bet is that this is meant to be a platform-togglable flag, because I was bit by this in Tutor: https://discuss.overhang.io/t/course-not-starting/962/12 I assumed that the fact that the flag was not enabled by default was a feature, and not a bug. Also, this flag has been there for a very long time, so even if the flag was meant to be temporary, it's now permanent.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sounds good. I'm not clear on why it is an option and why it is off by default. I asked the team and we'll see.
Either way, we can merge and it can always be updated later.

@regisb
regisb force-pushed the regisb/waffle-override branch from 67f276a to 0df071a Compare November 3, 2020 08:38
@regisb

regisb commented Nov 3, 2020

Copy link
Copy Markdown
Contributor Author

I plan on delaying merge until I can see the monitoring custom attribute from the edx-platform PR. Please ensure this is squashed as you wish.

Yes, this makes sense. I rebased my changes so this should be ready to merge once you see the deprecation warnings in edx-platform.

@robrap
robrap merged commit e1db6a1 into openedx:master Nov 4, 2020
@regisb
regisb deleted the regisb/waffle-override branch November 5, 2020 08:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

blended PR is managed through 2U's blended developmnt program merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants