Skip to content
This repository has been archived by the owner on Nov 27, 2020. It is now read-only.

Add smoke_test environment #225

Merged
merged 1 commit into from Apr 15, 2020
Merged

Add smoke_test environment #225

merged 1 commit into from Apr 15, 2020

Conversation

bilbof
Copy link
Contributor

@bilbof bilbof commented Apr 14, 2020

This will get the smoke tests working in concourse.

This new environment will be used for smoke testing only.
E.g. RAILS_ENV=smoke_test TEST_URL=... bundle exec rake spec:features

A new environment is required since RSpec requires a DB to be running
and connected to in order to run the tests. We could delete the constant
ActiveRecord e.g. Object.send(:remove_const, :ActiveRecord), but I decided
to use a new env that doesn't load it instead.

I applied this branch to the pipeline and ran a build with it: https://cd.gds-reliability.engineering/teams/govuk-tools/pipelines/govuk-corona-business-volunteer-form/jobs/smoke-test-staging/builds/124

Alternative approaches:

https://trello.com/c/g66yEmsa/44-run-feature-tests-against-staging-in-the-business-volunteers-pipeline

@bevanloon bevanloon temporarily deployed to coronavirus-bilbof-fix--3q1o35 April 14, 2020 14:45 Inactive
@bevanloon bevanloon temporarily deployed to coronavirus-bilbof-fix--3q1o35 April 14, 2020 14:59 Inactive
@bevanloon bevanloon temporarily deployed to coronavirus-bilbof-fix--3q1o35 April 14, 2020 17:14 Inactive
@bevanloon bevanloon temporarily deployed to coronavirus-bilbof-fix--3q1o35 April 14, 2020 17:21 Inactive
@bilbof bilbof changed the title Fix smoke test Add smoke_test environment Apr 14, 2020
@bevanloon bevanloon temporarily deployed to coronavirus-bilbof-fix--3q1o35 April 14, 2020 17:28 Inactive
This new environment will be used for smoke testing only.
E.g. RAILS_ENV=smoke_test TEST_URL=... bundle exec rake spec:features

A new environment is required since RSpec requires a DB to be running
and connected to in order to run the tests. We could delete the constant
ActiveRecord e.g. Object.send(:remove_const, :ActiveRecord), but I decided
to use a new env that doesn't load it instead.

Alternative approaches:
- We could use https://github.com/nulldb/nulldb rather than not requiring
  ActiveRecord
- There might be a way to use rspec/rspec-rails#2266
  but I don't think it helps our situations, since we do need ActiveRecord.
@bevanloon bevanloon temporarily deployed to coronavirus-bilbof-fix--3q1o35 April 14, 2020 17:29 Inactive
@bilbof bilbof marked this pull request as ready for review April 14, 2020 17:32
@@ -141,7 +141,7 @@ jobs:
- task: run-smoke-tests
file: govuk-coronavirus-business-volunteer-form/concourse/tasks/run-smoke-tests.yml
params:
TEST_URL: 'https://coronavirus-business-volunteers.service.gov.uk/medical-equipment'
TEST_URL: 'https://coronavirus-business-volunteers.service.gov.uk'
Copy link
Contributor

Choose a reason for hiding this comment

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

This should go back to the way it was. The / route redirects back to GOV.UK, and we don't have any feature tests that click "Start now". Probably want to remove the first feature, actually...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah sorry I should've separated this out into another commit for clarity. This change is intended, since TEST_URL is used by the feature tests as the Capybara.app_host, so when one writes visit "medical_equipment_path" behind the scenes this gets translated into Capybara.app_host + path or https://coronavirus-business-volunteers.service.gov.uk/medical-equipment.

The previous commit was broken, so if I left it as-is the calls to visit_path would take the test browser to e.g. /medical-equipment/medical-equipment/.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, that makes more sense!

@bilbof bilbof merged commit 6cd732c into master Apr 15, 2020
@bilbof bilbof deleted the bilbof/fix-smoke-test-2 branch April 15, 2020 08:44
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants