Skip to content

Commit

Permalink
Merge branch 'main' into Feature/ApplicationFrameworkUpdate
Browse files Browse the repository at this point in the history
  • Loading branch information
nileshgnagepatil committed Sep 18, 2023
2 parents 0eddef0 + e14b9da commit 3c5f570
Show file tree
Hide file tree
Showing 15 changed files with 25 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -22,8 +21,8 @@ public void Setup()
_featuresConfigUpdater = Substitute.For<IFeaturesConfigUpdater>();
}

[TestCase(500)]
[TestCase(1000)]
[TestCase(1)]
[TestCase(2)]
public async Task Calls_Updater_At_Specified_Interval(int interval)
{
// arrange
Expand All @@ -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();
}
Expand All @@ -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();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
9 changes: 9 additions & 0 deletions Childrens-Social-Care-CPD/Program.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
using Childrens_Social_Care_CPD;
using Childrens_Social_Care_CPD.Configuration;
using System.Diagnostics.CodeAnalysis;

var builder = WebApplication.CreateBuilder(args);
builder.AddDependencies();
builder.AddFeatures();

var app = builder.Build();

// Ensure the features are fetched before starting the app
var updater = app.Services.GetService<IFeaturesConfigUpdater>();
using (CancellationTokenSource cts = new CancellationTokenSource())
{
await updater.UpdateFeaturesAsync(cts.Token);
}

app.UseResponseCompression();
app.UseExceptionHandler("/error/error");
app.UseStatusCodePagesWithReExecute("/error/{0}");
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
@@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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/'],
]

Expand Down Expand Up @@ -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/'],
]

Expand All @@ -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/'],
]

Expand All @@ -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/'],
]

Expand All @@ -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/'],
]

Expand All @@ -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/'],
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
1 change: 1 addition & 0 deletions browser-tests/dev-integration-tests/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: ./
Expand Down
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 3c5f570

Please sign in to comment.