Skip to content

Commit

Permalink
Add more monitoring functional tests (#1941)
Browse files Browse the repository at this point in the history
* Update PR CI workflow

* Rework monitoring tests to pass more info into metrics search

* Improve tests readability. Add commands tests

* Fix command tests

* Improve read model resolver tests

* Implement internal errors tests

* Implement api handler tests

* Delete redundant metrics

* Add view model resolver tests

* Add view model projection tests

* Add yarn.lock change after install check

* Delete one package from yarn.lock

* Improve yarn.lock check

* Revert "Delete one package from yarn.lock"

This reverts commit b56f465

* Run prettier

* Fix lint

* Fix CI

* Fix view models monitoring functional tests
  • Loading branch information
timbset authored Jul 13, 2021
1 parent 597a7ed commit 1e6e932
Show file tree
Hide file tree
Showing 25 changed files with 1,224 additions and 245 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,7 @@ module.exports = {
'undef',
'unfetch',
'unicode',
'uint',
'unlink',
'unmarshall',
'unmocked',
Expand Down
75 changes: 45 additions & 30 deletions .github/workflows/pr-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,37 +25,42 @@ jobs:
uses: actions/cache@v2
with:
path: 'node_modules'
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock', '!**/node_modules/**') }}-modules-root
key: ${{ runner.os }}-modules-root-${{ hashFiles('**/yarn.lock', '!**/node_modules/**') }}
restore-keys: ${{ runner.os }}-modules-root-

- name: Cache packages node_modules
uses: actions/cache@v2
with:
path: |
packages/**/node_modules
internal/**/node_modules
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock', '!**/node_modules/**') }}-modules-packages
key: ${{ runner.os }}-modules-packages-${{ hashFiles('**/yarn.lock', '!**/node_modules/**') }}
restore-keys: ${{ runner.os }}-modules-packages-

- name: Cache examples node_modules
uses: actions/cache@v2
with:
path: |
examples/**/node_modules
templates/**/node_modules
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock', '!**/node_modules/**') }}-modules-examples
key: ${{ runner.os }}-modules-examples-${{ hashFiles('**/yarn.lock', '!**/node_modules/**') }}
restore-keys: ${{ runner.os }}-modules-examples-

- name: Cache functional tests node_modules
uses: actions/cache@v2
with:
path: 'functional-tests/**/node_modules'
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock', '!**/node_modules/**') }}-modules-functional-tests
key: ${{ runner.os }}-modules-functional-tests-${{ hashFiles('**/yarn.lock', '!**/node_modules/**') }}
restore-keys: ${{ runner.os }}-modules-functional-tests-

- name: Cache tests and website node_modules
uses: actions/cache@v2
with:
path: |
tests/**/node_modules
website/**/node_modules
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock', '!**/node_modules/**') }}-modules-tests
key: ${{ runner.os }}-modules-tests-${{ hashFiles('**/yarn.lock', '!**/node_modules/**') }}
restore-keys: ${{ runner.os }}-modules-tests-

- name: Cache build
uses: actions/cache@v2
Expand All @@ -72,12 +77,20 @@ jobs:
internal/**/*.tsbuildinfo
!internal/**/node_modules/**
.packages/**
key: ${{ runner.os }}-${{ github.run_id }}-build
key: ${{ runner.os }}-build-${{ github.run_id }}

- name: Install
run: |
yarn install --frozen-lockfile
yarn validate-lock-file
run: yarn install

- name: Check if yarn.lock changed
run: echo "git_diff=$(git diff --name-only yarn.lock)" >> $GITHUB_ENV

- name: Fail job if yarn.lock changed
if: env.git_diff
run: exit 1

- name: Validate yarn.lock
run: yarn validate-lock-file

- name: Run Prettier
run: yarn prettier:check
Expand Down Expand Up @@ -117,23 +130,23 @@ jobs:
uses: actions/cache@v2
with:
path: 'node_modules'
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock', '!**/node_modules/**') }}-modules-root
key: ${{ runner.os }}-modules-root-${{ hashFiles('**/yarn.lock', '!**/node_modules/**') }}

- name: Cache packages node_modules
uses: actions/cache@v2
with:
path: |
packages/**/node_modules
internal/**/node_modules
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock', '!**/node_modules/**') }}-modules-packages
key: ${{ runner.os }}-modules-packages-${{ hashFiles('**/yarn.lock', '!**/node_modules/**') }}

- name: Cache tests and website node_modules
uses: actions/cache@v2
with:
path: |
tests/**/node_modules
website/**/node_modules
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock', '!**/node_modules/**') }}-modules-tests
key: ${{ runner.os }}-modules-tests-${{ hashFiles('**/yarn.lock', '!**/node_modules/**') }}

- name: Cache build
uses: actions/cache@v2
Expand All @@ -150,7 +163,7 @@ jobs:
internal/**/*.tsbuildinfo
!internal/**/node_modules/**
.packages/**
key: ${{ runner.os }}-${{ github.run_id }}-build
key: ${{ runner.os }}-build-${{ github.run_id }}

- name: Install
run: |
Expand Down Expand Up @@ -184,23 +197,23 @@ jobs:
uses: actions/cache@v2
with:
path: 'node_modules'
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock', '!**/node_modules/**') }}-modules-root
key: ${{ runner.os }}-modules-root-${{ hashFiles('**/yarn.lock', '!**/node_modules/**') }}

- name: Cache packages node_modules
uses: actions/cache@v2
with:
path: |
packages/**/node_modules
internal/**/node_modules
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock', '!**/node_modules/**') }}-modules-packages
key: ${{ runner.os }}-modules-packages-${{ hashFiles('**/yarn.lock', '!**/node_modules/**') }}

- name: Cache examples node_modules
uses: actions/cache@v2
with:
path: |
examples/**/node_modules
templates/**/node_modules
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock', '!**/node_modules/**') }}-modules-examples
key: ${{ runner.os }}-modules-examples-${{ hashFiles('**/yarn.lock', '!**/node_modules/**') }}

- name: Cache build
uses: actions/cache@v2
Expand All @@ -217,7 +230,7 @@ jobs:
internal/**/*.tsbuildinfoF
!internal/**/node_modules/**
.packages/**
key: ${{ runner.os }}-${{ github.run_id }}-build
key: ${{ runner.os }}-build-${{ github.run_id }}

- name: Install
run: |
Expand Down Expand Up @@ -249,29 +262,29 @@ jobs:
uses: actions/cache@v2
with:
path: 'node_modules'
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock', '!**/node_modules/**') }}-modules-root
key: ${{ runner.os }}-modules-root-${{ hashFiles('**/yarn.lock', '!**/node_modules/**') }}

- name: Cache packages node_modules
uses: actions/cache@v2
with:
path: |
packages/**/node_modules
internal/**/node_modules
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock', '!**/node_modules/**') }}-modules-packages
key: ${{ runner.os }}-modules-packages-${{ hashFiles('**/yarn.lock', '!**/node_modules/**') }}

- name: Cache examples node_modules
uses: actions/cache@v2
with:
path: |
examples/**/node_modules
templates/**/node_modules
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock', '!**/node_modules/**') }}-modules-examples
key: ${{ runner.os }}-modules-examples-${{ hashFiles('**/yarn.lock', '!**/node_modules/**') }}

- name: Cache functional tests node_modules
uses: actions/cache@v2
with:
path: 'functional-tests/**/node_modules'
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock', '!**/node_modules/**') }}-modules-functional-tests
key: ${{ runner.os }}-modules-functional-tests-${{ hashFiles('**/yarn.lock', '!**/node_modules/**') }}

- name: Cache build
uses: actions/cache@v2
Expand All @@ -288,7 +301,7 @@ jobs:
internal/**/*.tsbuildinfo
!internal/**/node_modules/**
.packages/**
key: ${{ runner.os }}-${{ github.run_id }}-build
key: ${{ runner.os }}-build-${{ github.run_id }}

- name: Install
run: |
Expand Down Expand Up @@ -327,14 +340,6 @@ jobs:
token: ${{ secrets.RESOLVE_BOT_PAT }}
scopes: '@resolve-js'

- name: Integration Test PostgreSQL Serverless
env:
AWS_ACCESS_KEY_ID: ${{ secrets.TEST_CLOUD_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.TEST_CLOUD_AWS_SECRET_ACCESS_KEY }}
AWS_RDS_CLUSTER_ARN: ${{ steps.install_cloud.outputs.system_cluster_arn }}
AWS_RDS_ADMIN_SECRET_ARN: ${{ steps.install_cloud.outputs.postgres_admin_secret_arn }}
run: yarn test:integration-postgres-serverless

- name: Prepare test application
run: |
test_app_dir=$(mktemp -d -t test-app-XXXXXXXXX)
Expand Down Expand Up @@ -374,6 +379,8 @@ jobs:
AWS_SECRET_ACCESS_KEY: ${{ secrets.TEST_CLOUD_AWS_SECRET_ACCESS_KEY }}
AWS_REGION: eu-central-1
RESOLVE_TESTS_TARGET_DEPLOYMENT_ID: ${{ steps.deploy.outputs.id }}
RESOLVE_TESTS_TARGET_VERSION: ${{ steps.publish.outputs.version }}
RESOLVE_TESTS_TARGET_STAGE: framework-test
run: |
cd functional-tests
yarn run-test api --url=${{ steps.deploy.outputs.url }}
Expand All @@ -382,3 +389,11 @@ jobs:
run: |
cd functional-tests
yarn run-test testcafe --url=${{ steps.deploy.outputs.url }} --testcafe-browser=chrome --ci-mode --testcafe-timeout=10000
- name: Integration Test PostgreSQL Serverless
env:
AWS_ACCESS_KEY_ID: ${{ secrets.TEST_CLOUD_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.TEST_CLOUD_AWS_SECRET_ACCESS_KEY }}
AWS_RDS_CLUSTER_ARN: ${{ steps.install_cloud.outputs.system_cluster_arn }}
AWS_RDS_ADMIN_SECRET_ARN: ${{ steps.install_cloud.outputs.postgres_admin_secret_arn }}
run: yarn test:integration-postgres-serverless
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ packages/**/dist
examples/**/dist
examples/**/dist-replica
examples/**/lib
templates/**/dist
examples/shopping-list-advanced/native/resolve/
packages/core/zeromq/optional
**/*.d.ts
packages/core/react-hooks/src/index.ts
website/**
functional-tests/app/**/dist
2 changes: 1 addition & 1 deletion examples/ts/hacker-news/client/components/Comment.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState, useCallback } from 'react'
import React, { useState } from 'react'
import sanitizer from 'sanitizer'
import styled from 'styled-components'

Expand Down
Loading

0 comments on commit 1e6e932

Please sign in to comment.