Skip to content

Commit

Permalink
Remove ASK_CFPB_H1 cluster-testing flag (#6680)
Browse files Browse the repository at this point in the history
* Remove ASK_CFPB_H1 cluster-testing flag

This flag was used in 2018 to facilitate turning a feature on or off
in various "clusters" of pages. The cluster-testing method and the code that enables it
are documented [here](https://cfpb.github.io/consumerfinance.gov/split-testing/).

This change deletes the 2018-specific flag, but leaves open the question of whether
we want to maintain a rather involved custom method for testing clusters of pages.

* Thank you for your service, mighty cluster-testing code
  • Loading branch information
higs4281 authored Sep 21, 2021
1 parent 3dc9d83 commit e48a61b
Show file tree
Hide file tree
Showing 7 changed files with 2 additions and 289 deletions.
6 changes: 0 additions & 6 deletions cfgov/ask_cfpb/models/answer_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,9 +411,3 @@ def meta_image(self):
return None

return self.category.first().category_image

# Overrides the default of page.id for comparing against split testing
# clusters. See: core.feature_flags.in_split_testing_cluster
@property
def split_test_id(self):
return self.answer_base.id
8 changes: 0 additions & 8 deletions cfgov/ask_cfpb/tests/models/test_pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -1197,14 +1197,6 @@ def test_answer_meta_image_uses_category_image_if_no_social_image(self):
page.save_revision()
self.assertEqual(page.meta_image, self.test_image)

def test_answer_split_testing_id(self):
"""Confirm AnswerPage's split_testing_id is set to its answer_base.id,
which is checked by the core.feature_flags.in_split_testing_cluster
flag condition when doing split testing on Ask CFPB answer pages."""
answer = self.answer1234
page = answer.english_page
self.assertEqual(page.split_test_id, answer.id)

def test_validate_pagination_number(self):
paginator = Paginator([{"fake": "results"}] * 30, 25)
request = HttpRequest()
Expand Down
3 changes: 0 additions & 3 deletions cfgov/cfgov/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -717,9 +717,6 @@
"EMAIL_POPUP_DEBT": [("boolean", True)],
# Ping google on page publication in production only
"PING_GOOGLE_ON_PUBLISH": [("environment is", "production")],
# SPLIT TESTING FLAGS
# Ask CFPB page titles as H1s instead of H2s
"ASK_CFPB_H1": [("in split testing cluster", "ASK_CFPB_H1")],
# Manually enabled when Beta is being used for an external test.
# Controls the /beta_external_testing endpoint, which Jenkins jobs
# query to determine whether to refresh Beta database.
Expand Down
11 changes: 0 additions & 11 deletions cfgov/core/feature_flags.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
from itertools import chain

from django.conf import settings

from flags import conditions

from core.split_testing_clusters import CLUSTERS


def _get_deploy_environment():
return getattr(settings, 'DEPLOY_ENVIRONMENT', None)
Expand All @@ -19,10 +15,3 @@ def environment_is(environment, **kwargs):
@conditions.register('environment is not')
def environment_is_not(environment, **kwargs):
return environment != _get_deploy_environment()


@conditions.register('in split testing cluster')
def in_split_testing_cluster(cluster_group, page, clusters=CLUSTERS, **kwargs):
cluster_group = clusters[cluster_group]
lookup_value = getattr(page, 'split_test_id', page.id)
return lookup_value in chain(*cluster_group.values())
31 changes: 0 additions & 31 deletions cfgov/core/split_testing_clusters.py

This file was deleted.

40 changes: 2 additions & 38 deletions cfgov/core/tests/test_feature_flags.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
from django.conf import settings
from django.test import SimpleTestCase, TestCase, override_settings
from django.test import SimpleTestCase, override_settings

from wagtail.core.models import Page

from core.feature_flags import (
environment_is, environment_is_not, in_split_testing_cluster
)
from v1.models import BrowsePage
from core.feature_flags import environment_is, environment_is_not


class TestEnvironmentConditions(SimpleTestCase):
Expand All @@ -25,34 +20,3 @@ def test_setting_matches(self):
def test_setting_does_not_match(self):
self.assertFalse(environment_is('foo'))
self.assertTrue(environment_is_not('foo'))


class TestSplitTestingCondition(TestCase):
def setUp(self):
TEST_CLUSTERS = {
1: [4, 5, 6],
2: [7, 8],
3: [9],
}
self.CLUSTERS = {
'TEST_CLUSTERS': TEST_CLUSTERS,
}
root_page = Page.objects.get(pk=1)
self.page = BrowsePage(title="Split testing test page")
root_page.add_child(instance=self.page)

def test_basic_page_in_cluster(self):
self.page.id = 9
self.assertTrue(in_split_testing_cluster(
'TEST_CLUSTERS',
self.page,
self.CLUSTERS,
))

def test_basic_page_not_in_cluster(self):
self.page.id = 1
self.assertFalse(in_split_testing_cluster(
'TEST_CLUSTERS',
self.page,
self.CLUSTERS,
))
192 changes: 0 additions & 192 deletions docs/split-testing.md

This file was deleted.

0 comments on commit e48a61b

Please sign in to comment.