From a5b15f00b4777b074b8e6ebf6c30c47329f252ea Mon Sep 17 00:00:00 2001 From: Minno Dang Date: Fri, 20 Sep 2024 12:30:02 +0100 Subject: [PATCH] Get tests to run locally The Github pipelines are checking out helm charts, whereas it is not doing so locally. Changing the test to look at a local version of helm-charts. Unfortunately this means that we are tied to having the helm charts repo checked out to get it passing locally. --- .github/workflows/rspec.yml | 1 + README.md | 2 ++ spec/db/scrub_access_limited_spec.rb | 3 ++- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/rspec.yml b/.github/workflows/rspec.yml index a638699364..003edf50a9 100644 --- a/.github/workflows/rspec.yml +++ b/.github/workflows/rspec.yml @@ -65,6 +65,7 @@ jobs: env: RAILS_ENV: test GOVUK_CONTENT_SCHEMAS_PATH: vendor/publishing-api/content_schemas + GOVUK_HELM_CHARTS_PATH: vendor/govuk-helm-charts TEST_DATABASE_URL: ${{ steps.setup-postgres.outputs.db-url }} run: bundle exec rake spec diff --git a/README.md b/README.md index f2bcaa5780..5c7781904a 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,8 @@ To enable them for your GOV.UK account add them to your account in [Signon](http ### Running the test suite +**Note:** You will need to checkout `govuk-helm-charts` into your `govuk` repository in order to have local tests passing. + ``` bundle exec rake ``` diff --git a/spec/db/scrub_access_limited_spec.rb b/spec/db/scrub_access_limited_spec.rb index 76f6102331..949bc48012 100644 --- a/spec/db/scrub_access_limited_spec.rb +++ b/spec/db/scrub_access_limited_spec.rb @@ -1,6 +1,7 @@ RSpec.describe "Scrub Access Limited SQL Script" do def execute_sql - sql = File.read(Rails.root.join("vendor/govuk-helm-charts/charts/db-backup/scripts/content-publisher.sql")) + helm_charts_path = ENV.fetch("GOVUK_HELM_CHARTS_PATH", "../govuk-helm-charts") + sql = File.read(Rails.root.join("#{helm_charts_path}/charts/db-backup/scripts/content-publisher.sql")) ActiveRecord::Base.connection.execute(sql) end