Skip to content

Commit

Permalink
test: setup for real-world performance testing (#458)
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesHenry committed Jul 25, 2019
1 parent 8141f01 commit 15191bb
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 0 deletions.
28 changes: 28 additions & 0 deletions tests/performance/README.md
@@ -0,0 +1,28 @@
# Temp README (intended for maintainers only at this time)

Run:

```sh
docker-compose -f tests/performance/docker-compose.yml up --build
```

It will build the docker container, create volumes for the local files, and will clone the real world project repo ready for experimentation.

The docker container is configured to run forever, so you just need to attach a shell to it,

e.g. by running

```sh
docker exec -it {{ RUNNING_CONTAINER_ID_HERE }} bash
```

Or by using the docker extension in VSCode and right clicking on the running container.

Every time you make an update to the local built packages (e.g. parser or eslint-plugin), you need to rerun
the utility script _within_ the running container.

For example, you will run something like the following (where `root@a91d93f9ffc3` refers to what's running in your container):

```sh
root@a91d93f9ffc3:/usr/vega-lite# ../linked/install-local-packages.sh
```
21 changes: 21 additions & 0 deletions tests/performance/docker-compose.yml
@@ -0,0 +1,21 @@
version: '3'

services:
lint-real-repo:
build: ./fixtures/lint-real-repo
container_name: "lint-real-repo"
volumes:
# Runtime link to the relevant built @typescript-eslint packages and test utils,
# but apply an empty volume for the package tests, we don't need those.
- ../../package.json/:/usr/root-package.json
- ./utils/:/usr/utils
- ../../packages/parser/:/usr/parser
- /usr/parser/tests
- ../../packages/typescript-estree/:/usr/typescript-estree
- /usr/typescript-estree/tests
- ../../packages/eslint-plugin/:/usr/eslint-plugin
- /usr/eslint-plugin/tests
- ../../packages/eslint-plugin-tslint/:/usr/eslint-plugin-tslint
- /usr/eslint-plugin-tslint/tests
# Runtime link to all the specific integration test files, so that most updates don't require a rebuild.
- ./fixtures/lint-real-repo:/usr/linked
15 changes: 15 additions & 0 deletions tests/performance/fixtures/lint-real-repo/Dockerfile
@@ -0,0 +1,15 @@
FROM node:carbon

WORKDIR /usr

# Clone the repo and checkout the relevant commit
RUN git clone https://github.com/typescript-eslint/vega-lite
WORKDIR /usr/vega-lite
RUN git checkout f1e4c1ebe50fdf3b9131ba5dde915e6efbe4bd87

# Run the equivalent of the project's travis build before linting starts
RUN yarn install --frozen-lockfile && yarn cache clean
RUN yarn build

# Keep the container alive forever
CMD [ "tail", "-f", "/dev/null"]
@@ -0,0 +1,10 @@
# This script should be run by attaching a shell to the running docker
# container, and then running `../linked/install-local-packages.sh` from
# that shell.
#
# Use the local volumes for our own packages
# NOTE: You need to rerun this script every time the local packages change
# in order to apply the changes to the node_modules of the repo under test
yarn add @typescript-eslint/typescript-estree@file:///usr/typescript-estree
yarn add @typescript-eslint/parser@file:///usr/parser
yarn add @typescript-eslint/eslint-plugin@file:///usr/eslint-plugin

0 comments on commit 15191bb

Please sign in to comment.