diff --git a/Childrens-Social-Care-CPD-Tests/Configuration/FeaturesConfigBackgroundServiceTests.cs b/Childrens-Social-Care-CPD-Tests/Configuration/FeaturesConfigBackgroundServiceTests.cs index 158fd51d..5ef0409a 100644 --- a/Childrens-Social-Care-CPD-Tests/Configuration/FeaturesConfigBackgroundServiceTests.cs +++ b/Childrens-Social-Care-CPD-Tests/Configuration/FeaturesConfigBackgroundServiceTests.cs @@ -2,7 +2,6 @@ using Microsoft.Extensions.Logging; using NSubstitute; using NUnit.Framework; -using NUnit.Framework.Constraints; using System.Threading; using System.Threading.Tasks; namespace Childrens_Social_Care_CPD_Tests.Configuration; @@ -22,8 +21,8 @@ public void Setup() _featuresConfigUpdater = Substitute.For(); } - [TestCase(500)] - [TestCase(1000)] + [TestCase(1)] + [TestCase(2)] public async Task Calls_Updater_At_Specified_Interval(int interval) { // arrange @@ -38,7 +37,7 @@ public async Task Calls_Updater_At_Specified_Interval(int interval) using (var cancellationTokenSource = new CancellationTokenSource()) { var task = featuresConfigBackgroundService.StartAsync(cancellationTokenSource.Token); - await Task.Delay((int)(interval * 1.1)); + await Task.Delay((int)(interval * 1100)); cancellationTokenSource.Cancel(); task.Wait(); } @@ -62,7 +61,7 @@ public async Task Returns_If_Interval_Is_Zero() using (var cancellationTokenSource = new CancellationTokenSource()) { var task = featuresConfigBackgroundService.StartAsync(cancellationTokenSource.Token); - await Task.Delay(5000); + await Task.Delay(50); cancellationTokenSource.Cancel(); task.Wait(); } diff --git a/Childrens-Social-Care-CPD/Configuration/FeaturesConfigBackgroundService.cs b/Childrens-Social-Care-CPD/Configuration/FeaturesConfigBackgroundService.cs index 92f22712..1a130ccf 100644 --- a/Childrens-Social-Care-CPD/Configuration/FeaturesConfigBackgroundService.cs +++ b/Childrens-Social-Care-CPD/Configuration/FeaturesConfigBackgroundService.cs @@ -24,7 +24,7 @@ protected override async Task ExecuteAsync(CancellationToken stoppingToken) if (_applicationConfiguration.FeaturePollingInterval == 0) return; - var timer = new PeriodicTimer(TimeSpan.FromMilliseconds(_applicationConfiguration.FeaturePollingInterval)); + var timer = new PeriodicTimer(TimeSpan.FromSeconds(_applicationConfiguration.FeaturePollingInterval)); while (await timer.WaitForNextTickAsync(stoppingToken)) { _logger.LogInformation("Polling at: {utcNow}", DateTime.UtcNow.ToShortTimeString()); diff --git a/Childrens-Social-Care-CPD/Program.cs b/Childrens-Social-Care-CPD/Program.cs index 9baba7c8..c8f096be 100644 --- a/Childrens-Social-Care-CPD/Program.cs +++ b/Childrens-Social-Care-CPD/Program.cs @@ -1,4 +1,5 @@ using Childrens_Social_Care_CPD; +using Childrens_Social_Care_CPD.Configuration; using System.Diagnostics.CodeAnalysis; var builder = WebApplication.CreateBuilder(args); @@ -6,6 +7,14 @@ builder.AddFeatures(); var app = builder.Build(); + +// Ensure the features are fetched before starting the app +var updater = app.Services.GetService(); +using (CancellationTokenSource cts = new CancellationTokenSource()) +{ + await updater.UpdateFeaturesAsync(cts.Token); +} + app.UseResponseCompression(); app.UseExceptionHandler("/error/error"); app.UseStatusCodePagesWithReExecute("/error/{0}"); diff --git a/README.md b/README.md index f23fbfcd..c082211f 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,7 @@ The following environment variables are to be configured | CPD_PREVIEW_KEY | The preview content for the environment set | | CPD_AZURE_ENVIRONMENT | The environment for the system | | CPD_INSTRUMENTATION_CONNECTIONSTRING | Application insights connection string | +| CPD_FEATURE_POLLING_INTERVAL | Polling interval for feature configuration udpates | In order to run the application locally, you can either open the solution, build and run in the IDE of your choice or there is a [docker-compose](~/docker-compose.yml) file that allows for local running of the app. diff --git a/browser-tests/content-regression-tests/tests/career-stages/experienced-practitioners.spec.ts b/browser-tests/content-regression-tests/tests/career-stages/experienced-practitioners.spec.ts index e58e8606..3ade971b 100644 --- a/browser-tests/content-regression-tests/tests/career-stages/experienced-practitioners.spec.ts +++ b/browser-tests/content-regression-tests/tests/career-stages/experienced-practitioners.spec.ts @@ -26,7 +26,7 @@ test.describe('Experienced Practitioners', () => { ['Pathway 1: practice supervisors', '/pathway-1', 'Pathway 1: practice supervisors'], ['Pathway 2: middle managers', '/pathway-2', 'Pathway 2: middle managers'], ['View all programmes', '/development-programmes', 'Child and family social work development programmes'], - ['Explore all roles', '/explore-roles', 'Roles in child and family social work'], + ['Explore all roles', '/explore-roles', 'Explore roles in child and family social work'], ] for (const link of links) { diff --git a/browser-tests/content-regression-tests/tests/career-stages/leaders.spec.ts b/browser-tests/content-regression-tests/tests/career-stages/leaders.spec.ts index ee1f76e2..f127a875 100644 --- a/browser-tests/content-regression-tests/tests/career-stages/leaders.spec.ts +++ b/browser-tests/content-regression-tests/tests/career-stages/leaders.spec.ts @@ -26,7 +26,7 @@ test.describe('Leaders', () => { ['Upon: new directors programme', '/new-directors-programme', 'Upon: new directors programme'], ['Pathway 4: practice leaders', '/pathway-4', 'Pathway 4: practice leaders'], ['View all programmes', '/development-programmes', 'Child and family social work development programmes'], - ['Explore all roles', '/explore-roles', 'Roles in child and family social work'], + ['Explore all roles', '/explore-roles', 'Explore roles in child and family social work'], ] for (const link of links) { diff --git a/browser-tests/content-regression-tests/tests/career-stages/managers.spec.ts b/browser-tests/content-regression-tests/tests/career-stages/managers.spec.ts index 58972a94..9f0f06aa 100644 --- a/browser-tests/content-regression-tests/tests/career-stages/managers.spec.ts +++ b/browser-tests/content-regression-tests/tests/career-stages/managers.spec.ts @@ -25,7 +25,7 @@ test.describe('Managers', () => { ['Pathway 2: middle managers', '/pathway-2', 'Pathway 2: middle managers'], ['Pathway 3: heads of service', '/pathway-3', 'Pathway 3: heads of service'], ['View all programmes', '/development-programmes', 'Child and family social work development programmes'], - ['Explore all roles', '/explore-roles', 'Roles in child and family social work'], + ['Explore all roles', '/explore-roles', 'Explore roles in child and family social work'], ] for (const link of links) { diff --git a/browser-tests/content-regression-tests/tests/career-stages/pathway-2-middle-managers.spec.ts b/browser-tests/content-regression-tests/tests/career-stages/pathway-2-middle-managers.spec.ts index 1acd1790..5e0e3aa3 100644 --- a/browser-tests/content-regression-tests/tests/career-stages/pathway-2-middle-managers.spec.ts +++ b/browser-tests/content-regression-tests/tests/career-stages/pathway-2-middle-managers.spec.ts @@ -46,7 +46,7 @@ test.describe('Pathway 2: middle managers', () => { const links = [ ['Frontline', 'https://thefrontline.org.uk/develop-your-career/pathways-programme/'], ['Frontline\'s network of leaders', 'https://thefrontline.org.uk/develop-your-career/frontline-fellowship/'], - ['Find out more about Pathway 2 including how to apply', 'https://thefrontline.org.uk/develop-your-career/pathways-programme/'], + //['Find out more about Pathway 2 including how to apply', 'https://thefrontline.org.uk/develop-your-career/pathways-programme/'], // Currently closed ['Social work post-qualifying standards', 'https://www.gov.uk/government/publications/knowledge-and-skills-statements-for-child-and-family-social-work'], ] diff --git a/browser-tests/content-regression-tests/tests/career-stages/practitioners.spec.ts b/browser-tests/content-regression-tests/tests/career-stages/practitioners.spec.ts index b5e5ac3e..54257049 100644 --- a/browser-tests/content-regression-tests/tests/career-stages/practitioners.spec.ts +++ b/browser-tests/content-regression-tests/tests/career-stages/practitioners.spec.ts @@ -25,7 +25,7 @@ test.describe('Practitioners', () => { ['Assessed and supported year in employment (ASYE)', '/asye', 'Assessed and supported year in employment \\(ASYE\\)'], ['View all programmes', '/development-programmes', 'Child and family social work development programmes'], ['Develop your social work practice', '/develop-social-work-practice', 'Develop your social work practice'], - ['Explore all roles', '/explore-roles', 'Roles in child and family social work'], + ['Explore all roles', '/explore-roles', 'Explore roles in child and family social work'], ] for (const link of links) { diff --git a/browser-tests/content-regression-tests/tests/career-stages/senior-managers.spec.ts b/browser-tests/content-regression-tests/tests/career-stages/senior-managers.spec.ts index 9ed2b10d..844d209d 100644 --- a/browser-tests/content-regression-tests/tests/career-stages/senior-managers.spec.ts +++ b/browser-tests/content-regression-tests/tests/career-stages/senior-managers.spec.ts @@ -25,7 +25,7 @@ test.describe('Senior managers', () => { ['Pathway 3: heads of service', '/pathway-3', 'Pathway 3: heads of service'], ['Pathway 4: practice leaders', '/pathway-4', 'Pathway 4: practice leaders'], ['View all programmes', '/development-programmes', 'Child and family social work development programmes'], - ['Explore all roles', '/explore-roles', 'Roles in child and family social work'], + ['Explore all roles', '/explore-roles', 'Explore roles in child and family social work'], ] for (const link of links) { diff --git a/browser-tests/content-regression-tests/tests/explore-area-of-practice/child-protection-and-family-safeguarding.spec.ts b/browser-tests/content-regression-tests/tests/explore-area-of-practice/child-protection-and-family-safeguarding.spec.ts index cdb7485e..b760f5f7 100644 --- a/browser-tests/content-regression-tests/tests/explore-area-of-practice/child-protection-and-family-safeguarding.spec.ts +++ b/browser-tests/content-regression-tests/tests/explore-area-of-practice/child-protection-and-family-safeguarding.spec.ts @@ -1,6 +1,6 @@ import { test, expect } from '@playwright/test' -test.describe('Child Protection & Family Safeguarding', () => { +test.describe.skip('Child Protection & Family Safeguarding', () => { test('User journey via Explore menu @journey', async ({ page }) => { await page.goto('/') await page.getByLabel('Menu').getByRole('link', { name: 'Explore roles', exact: true }).click() diff --git a/browser-tests/content-regression-tests/tests/explore-roles/external-links.spec.ts b/browser-tests/content-regression-tests/tests/explore-roles/external-links.spec.ts index a21df534..e0fd4343 100644 --- a/browser-tests/content-regression-tests/tests/explore-roles/external-links.spec.ts +++ b/browser-tests/content-regression-tests/tests/explore-roles/external-links.spec.ts @@ -62,7 +62,6 @@ test.describe('External links @external', () => { test.describe('Practice supervisor', () => { const links = [ - ['enhanced background checks', 'https://www.gov.uk/criminal-record-checks-apply-role'], ['Find a job service', 'https://findajob.dwp.gov.uk/'], ] @@ -153,7 +152,6 @@ test.describe('External links @external', () => { test.describe('Principal social worker', () => { const links = [ - ['enhanced background checks', 'https://www.gov.uk/criminal-record-checks-apply-role'], ['Find a job service', 'https://findajob.dwp.gov.uk/'], ] @@ -172,7 +170,6 @@ test.describe('External links @external', () => { test.describe('Service manager', () => { const links = [ - ['enhanced background checks', 'https://www.gov.uk/criminal-record-checks-apply-role'], ['Find a job service', 'https://findajob.dwp.gov.uk/'], ] @@ -191,7 +188,6 @@ test.describe('External links @external', () => { test.describe('Head of service', () => { const links = [ - ['enhanced background checks', 'https://www.gov.uk/criminal-record-checks-apply-role'], ['Find a job service', 'https://findajob.dwp.gov.uk/'], ] @@ -210,7 +206,6 @@ test.describe('External links @external', () => { test.describe('Assistant director', () => { const links = [ - ['enhanced background checks', 'https://www.gov.uk/criminal-record-checks-apply-role'], ['Find a job service', 'https://findajob.dwp.gov.uk/'], ] @@ -229,7 +224,6 @@ test.describe('External links @external', () => { test.describe('Director of children\'s services', () => { const links = [ - ['enhanced background checks', 'https://www.gov.uk/criminal-record-checks-apply-role'], ['Find a job service', 'https://findajob.dwp.gov.uk/'], ] diff --git a/browser-tests/content-regression-tests/tests/homepage.spec.ts b/browser-tests/content-regression-tests/tests/homepage.spec.ts index 7d01b5d9..4ba0b2f4 100644 --- a/browser-tests/content-regression-tests/tests/homepage.spec.ts +++ b/browser-tests/content-regression-tests/tests/homepage.spec.ts @@ -26,7 +26,7 @@ test.describe('Homepage', () => { test.describe('Useful information', () => { const links = [ ['DfE funded programmes', '/development-programmes', 'Child and family social work development programmes'], - ['Explore roles', '/explore-roles', 'Roles in child and family social work'], + ['Explore roles', '/explore-roles', 'Explore roles in child and family social work'], ] for (const link of links) { diff --git a/browser-tests/dev-integration-tests/docker-compose.yaml b/browser-tests/dev-integration-tests/docker-compose.yaml index a019acf9..e924002e 100644 --- a/browser-tests/dev-integration-tests/docker-compose.yaml +++ b/browser-tests/dev-integration-tests/docker-compose.yaml @@ -14,6 +14,7 @@ services: - ASPNETCORE_URLS=http://+ - ASPNETCORE_ENVIRONMENT=dev-integration - CPD_DISABLE_SECURE_COOKIES=true + - CPD_FEATURE_POLLING_INTERVAL=0 dev-integration-tests: build: context: ./ diff --git a/docker-compose.yml b/docker-compose.yml index 7d1cbd47..ab7452db 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -13,5 +13,6 @@ services: - CPD_PREVIEW_KEY=$CPD_PREVIEW_KEY - CPD_AZURE_ENVIRONMENT=$CPD_AZURE_ENVIRONMENT - CPD_INSTRUMENTATION_CONNECTIONSTRING=$CPD_INSTRUMENTATION_CONNECTIONSTRING + - CPD_FEATURE_POLLING_INTERVAL=$CPD_FEATURE_POLLING_INTERVAL ports: - 5001:80 \ No newline at end of file