cds-snc / platform-forms-client

NextJS application that serves the public-facing website for Forms
https://forms-staging.cdssandbox.xyz/
MIT License
31 stars 13 forks source link

Smoke tests for production releases #3585

Open srtalbot opened 2 months ago

srtalbot commented 2 months ago

Description:

Add smoke tests to so that we know key aspects of the infrastructure and application are working live in production after a release.

Two approaches:

Acceptance criteria:

patheard commented 4 weeks ago

Started testing a Form submission heartbeat with curl and had no luck with the following:

curl \
    --request GET \
    --location \
    --cookie-jar ./cookies \
    --verbose \
    https://forms-staging.cdssandbox.xyz/en/id/clx95fa1y00049c9wgmzyz2ee

curl \
    --request POST \
    --location \
    --cookie ./cookies \
    --header "Content-Type: application/json" \
    --data '[{"1":"Yes","currentGroup":"start"},"en",{"id":"clx95fa1y00049c9wgmzyz2ee","updatedAt":"Mon Jun 10 2024 18:19:05 GMT+0000 (Coordinated Universal Time)","form":{"groups":{},"layout":[1],"titleEn":"Healthcheck","titleFr":"Contrôle de santé","elements":[{"id":1,"type":"radio","properties":{"choices":[{"en":"Yes","fr":"Oui"},{"en":"No","fr":"Non"}],"titleEn":"Things are working?","titleFr":"Les choses fonctionnent bien ?","validation":{"required":true},"subElements":[],"descriptionEn":"","descriptionFr":"","placeholderEn":"","placeholderFr":""}}],"confirmation":{"descriptionEn":"Form has been submitted!","descriptionFr":"Le formulaire a été soumis !","referrerUrlEn":"","referrerUrlFr":""},"introduction":{"descriptionEn":"Simple healthcheck form to confirm the system is able to handle submissions.","descriptionFr":"Formulaire simple de contrôle de santé pour confirmer que le système est en mesure de traiter les soumissions."},"privacyPolicy":{"descriptionEn":"No personal information will be collected as part of this form submission.","descriptionFr":"Aucune information personnelle ne sera collectée par le biais de ce formulaire."}},"isPublished":true,"securityAttribute":"Unclassified"}]' \
    --verbose \
    https://forms-staging.cdssandbox.xyz/en/id/clx95fa1y00049c9wgmzyz2ee

Will start looking at Puppeteer next.

patheard commented 4 weeks ago

Based on our chat after the App Router release, I'm going to start looking at the following:

  1. Define CloudWatch metric filters for the log events we want to monitor. I will start with form submissions, both from the client and lambda perspective. This may involve minor PRs to add new logging detail.
  2. Create a dashboard that graphs these metrics overtime to give a health snapshot.

Once that's taken care of, we can look at adding more metrics and alarms.

patheard commented 4 weeks ago

A service health dashboard has been started in Staging to graph metrics: https://ca-central-1.console.aws.amazon.com/cloudwatch/home?region=ca-central-1#dashboards/dashboard/Forms-System-Health

patheard commented 3 weeks ago

The service health dashboard and custom metrics were released today as part of v3.10.0. However after more investigation, it was realized that the custom metrics would end up being more expensive than they were worth.

These metrics will be removed as part of the v3.10.2 release and the service health dashboard will be updated to generate its graphs via log insight queries.

patheard commented 2 weeks ago
patheard commented 2 weeks ago

Proof-of-concept showing how a form submission can be triggered via a Lambda function using Playwright: https://github.com/patheard/playwright-lambda

patheard commented 2 weeks ago

After releasing the anomaly detection alarms to Prod as part of the v3.11.0 release, it is unlikely we'll be able to use AWS's expected invocations as an alarm:

Image

The above graph is at 4 standard deviations.