Skip to content

Commit

Permalink
Remove underscores from AB test name
Browse files Browse the repository at this point in the history
nginx no likey underscores in headers - https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/#missing-disappearing-http-headers

This was resulting in the HTTP header that Fastly sets for the AB test
being dropped by one of the nginxs which sit in front of rails.
  • Loading branch information
richardTowers committed Oct 20, 2023
1 parent de26cdc commit 6c378ee
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/controllers/content_items_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ def temporary_ab_test_find_utr_page
placeholder = "{{ab_test_find_utr_number_video_links}}"
if @content_item.base_path == "/find-utr-number" && @content_item.body.include?(placeholder)
ab_test = GovukAbTesting::AbTest.new(
"find_utr_number_video_links",
"FindUtrNumberVideoLinks",
dimension: 61, # https://docs.google.com/spreadsheets/d/1h4vGXzIbhOWwUzourPLIc8WM-iU1b6WYOVDOZxmU1Uo/edit#gid=254065189&range=69:69
allowed_variants: %w[A B Z],
control_variant: "Z",
Expand Down
6 changes: 3 additions & 3 deletions test/controllers/content_items_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ class ContentItemsControllerTest < ActionController::TestCase

stub_content_store_has_item(content_item["base_path"], content_item)

request.headers["HTTP_GOVUK_ABTEST_FIND_UTR_NUMBER_VIDEO_LINKS"] = nil
request.headers["HTTP_GOVUK_ABTEST_FINDUTRNUMBERVIDEOLINKS"] = nil

get :show, params: { path: path_for(content_item) }
assert_response :success
Expand All @@ -386,7 +386,7 @@ class ContentItemsControllerTest < ActionController::TestCase

stub_content_store_has_item(content_item["base_path"], content_item)

request.headers["HTTP_GOVUK_ABTEST_FIND_UTR_NUMBER_VIDEO_LINKS"] = "A"
request.headers["HTTP_GOVUK_ABTEST_FINDUTRNUMBERVIDEOLINKS"] = "A"

get :show, params: { path: path_for(content_item) }
assert_response :success
Expand All @@ -401,7 +401,7 @@ class ContentItemsControllerTest < ActionController::TestCase

stub_content_store_has_item(content_item["base_path"], content_item)

request.headers["HTTP_GOVUK_ABTEST_FIND_UTR_NUMBER_VIDEO_LINKS"] = "B"
request.headers["HTTP_GOVUK_ABTEST_FINDUTRNUMBERVIDEOLINKS"] = "B"

get :show, params: { path: path_for(content_item) }
assert_response :success
Expand Down

0 comments on commit 6c378ee

Please sign in to comment.