You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+34-80Lines changed: 34 additions & 80 deletions
Original file line number
Diff line number
Diff line change
@@ -45,19 +45,22 @@ To install dependencies listed in package.json:
45
45
3. Run `yarn` to install dependencies (including Hugo).
46
46
4. Install the Yarn package manager and run `yarn` to install project dependencies.
47
47
48
-
`package.json` contains dependencies for linting and running Git hooks.
49
-
docs-v2 uses [Lefthook](https://github.com/evilmartians/lefthook) to configure and manage pre-commit hooks for lintingand testing Markdown content.
48
+
`package.json` contains dependencies used in `/assets/js` JavaScript code and
49
+
dev dependencies used in pre-commit hooks for linting, syntax-checking, and testing.
50
50
51
-
Other dependencies used in the project:
51
+
Dev dependencies include:
52
52
53
-
-**[prettier](https://prettier.io/docs/en/)**: formats code, including Markdown, according to style rules for consistency
53
+
-[Lefthook](https://github.com/evilmartians/lefthook): configures and
54
+
manages pre-commit hooks for linting and testing Markdown content.
55
+
-[prettier](https://prettier.io/docs/en/): formats code, including Markdown, according to style rules for consistency
56
+
-[Cypress]: e2e testing for UI elements and URLs in content
54
57
55
58
### Install Docker
56
59
57
-
Install [Docker](https://docs.docker.com/get-docker/) for your system.
58
-
59
60
docs-v2 includes Docker configurations (`compose.yaml` and Dockerfiles) for running the Vale style linter and tests for code blocks (Shell, Bash, and Python) in Markdown files.
60
61
62
+
Install [Docker](https://docs.docker.com/get-docker/) for your system.
63
+
61
64
#### Build the test dependency image
62
65
63
66
After you have installed Docker, run the following command to build the test
@@ -94,7 +97,8 @@ Make your suggested changes being sure to follow the [style and formatting guide
94
97
95
98
docs-v2 uses Lefthook to manage Git hooks, such as pre-commit hooks that lint Markdown and test code blocks.
96
99
When you try to commit changes (`git commit`), Git runs
97
-
the commands configured in `lefthook.yml` which pass your **staged** files to Vale, Prettier, and Pytest (in a Docker container).
100
+
the commands configured in `lefthook.yml` which pass your **staged** files to Vale,
101
+
Prettier, Cypress (for UI tests and link-checking), and Pytest (for testing Python and shell code in code blocks).
98
102
99
103
### Skip pre-commit hooks
100
104
@@ -113,6 +117,9 @@ LEFTHOOK=0 git commit
113
117
114
118
### Set up test scripts and credentials
115
119
120
+
Tests for code blocks require your InfluxDB credentials and other typical
121
+
InfluxDB configuration.
122
+
116
123
To set up your docs-v2 instance to run tests locally, do the following:
117
124
118
125
1.**Set executable permissions on test scripts** in `./test/src`:
@@ -128,91 +135,38 @@ To set up your docs-v2 instance to run tests locally, do the following:
128
135
Cloud Dedicated instance for testing in most cases. To avoid conflicts when
129
136
running tests, create separate Cloud Dedicated and Clustered databases.
130
137
131
-
3.**Create .env.test**: Copy the `./test/env.test.example` file into each
138
+
1.**Create .env.test**: Copy the `./test/env.test.example` file into each
132
139
product directory to test and rename the file as `.env.test`--for example:
133
140
134
141
```sh
135
142
./content/influxdb/cloud-dedicated/.env.test
136
143
```
137
144
138
-
4. Inside each product's `.env.test` file, assign your InfluxDB credentials to
139
-
environment variables.
145
+
2. Inside each product's `.env.test` file, assign your InfluxDB credentials to
146
+
environment variables:
140
147
141
-
In addition to the usual `INFLUX_` environment variables, in your
142
-
`cloud-dedicated/.env.test` and `clustered/.env.test` files define the
148
+
- Include the usual `INFLUX_` environment variables
149
+
- In
150
+
`cloud-dedicated/.env.test` and `clustered/.env.test` files, also define the
143
151
following variables:
144
152
145
-
-`ACCOUNT_ID`, `CLUSTER_ID`: You can find these values in your `influxctl`
146
-
`config.toml` configuration file.
147
-
-`MANAGEMENT_TOKEN`: Use the `influxctl management create` command to generate
148
-
a long-lived management token to authenticate Management API requests
149
-
150
-
For the full list of variables you'll need to include, see the substitution
151
-
patterns in `./test/src/prepare-content.sh`.
152
-
153
-
**Warning**: The database you configure in `.env.test` and any written data may
154
-
be deleted during test runs.
153
+
-`ACCOUNT_ID`, `CLUSTER_ID`: You can find these values in your `influxctl`
154
+
`config.toml` configuration file.
155
+
-`MANAGEMENT_TOKEN`: Use the `influxctl management create` command to generate
156
+
a long-lived management token to authenticate Management API requests
155
157
156
-
**Warning**: To prevent accidentally adding credentials to the docs-v2 repo,
157
-
Git is configured to ignore `.env*` files. Don't add your `.env.test` files to Git.
158
-
Consider backing them up on your local machine in case of accidental deletion.
158
+
See the substitution
159
+
patterns in `./test/src/prepare-content.sh` for the full list of variables you may need to define in your `.env.test` files.
159
160
160
-
5. For influxctl commands to run in tests, move or copy your `config.toml` file
161
+
3. For influxctl commands to run in tests, move or copy your `config.toml` file
161
162
to the `./test` directory.
162
163
163
-
### Pre-commit linting and testing
164
-
165
-
When you try to commit your changes using `git commit` or your editor,
166
-
the project automatically runs pre-commit checks for spelling, punctuation,
167
-
and style on your staged files.
168
-
169
-
`.husky/pre-commit` script runs Git pre-commit hook commands, including
0 commit comments