Skip to content

Commit

Permalink
init add how to run tests
Browse files Browse the repository at this point in the history
  • Loading branch information
DanRoscigno committed Dec 15, 2022
1 parent dbda5bb commit 0ba3d53
Showing 1 changed file with 55 additions and 7 deletions.
62 changes: 55 additions & 7 deletions contrib-writing-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This is a work in progress, and probably will be for a while. Please open an is

Writing the docs is important, and we thank you for your help. In this doc, you will find:

- instructions for building the ClickHouse docs
- instructions for building the ClickHouse docs
- suggestions to save you time, for example, ways to use reusable content
- ways to avoid 404s
- examples of techniques used throughout the ClickHouse docs
Expand Down Expand Up @@ -91,7 +91,7 @@ should be replaced with
/docs/en/getting-started/install.md
```

If you look closely, the path on disk does not match the URL. The URLs can be changed by setting the `slug` in the markdown file frontmatter.
If you look closely, the path on disk does not match the URL. The URLs can be changed by setting the `slug` in the markdown file frontmatter.

## Save time with reusable content
Many of the pages in the docs have a section toward the top about gathering the connection details for your ClickHouse service. Sending people off to look at a page to learn about the connection details and then having them forget what they were doing is a poor user experience. If you can just include the right instructions in the current doc, please do so. In general there are two interfaces that people will use when integrating some 3rd party software, or even `clickhouse client` to ClickHouse:
Expand All @@ -106,8 +106,8 @@ import ConnectionDetails from '@site/docs/en/_snippets/_gather_your_details_http

and this will render it:
```jsx
## 1. Gather your connection details
<ConnectionDetails />
## 1. Gather your connection details
<ConnectionDetails />
```

Note: in the preceding code block, a level two header is used; change it to whatever makes sense in your doc.
Expand All @@ -125,7 +125,7 @@ Every time you mention a feature or product you may be tempted to link to it. D
they can be tempted to visit them, and quite often there is no need for them to go to the linked content. If you mention a technique and you need the reader to learn it right then, add a link. If they should read about it later then add a link down at the bottom of the doc in a **What's next** section.

### Include content in the current doc instead
If you find yourself wanting to send the reader to another doc to perform a task before they perform the main task that you are writing about, then maybe that prerequisite task should be included in the current doc instead so the reader is not clicking back and forth. It may be time to create a snippet pull the content from the other doc into a snippet file and include it in the current doc and the other doc that you pulled it from (see [above](#save-time-with-reusable-content)).
If you find yourself wanting to send the reader to another doc to perform a task before they perform the main task that you are writing about, then maybe that prerequisite task should be included in the current doc instead so the reader is not clicking back and forth. It may be time to create a snippet pull the content from the other doc into a snippet file and include it in the current doc and the other doc that you pulled it from (see [above](#save-time-with-reusable-content)).

## Avoid multiple pages for a single topic

Expand Down Expand Up @@ -157,7 +157,7 @@ Cloud specific content here

</TabItem>
<TabItem value="selfmanaged" label="Self-managed">

Self-managed specific content here

</TabItem>
Expand Down Expand Up @@ -220,7 +220,7 @@ Common content

### Generating release notes

Release notes are generated with Python. This requires a GitHub user token, which you can export in your environment or pass on the commandline.
Release notes are generated with Python. This requires a GitHub user token, which you can export in your environment or pass on the commandline.
```bash
cd ClickHouse/utils/changelog
export GHTOKEN="<your token>"
Expand All @@ -244,6 +244,54 @@ If you want to run the tests from the `ClickHouse/tests` directory you either ne

![build artifact check](https://raw.githubusercontent.com/ClickHouse/clickhouse-docs/main/images/find-build-artifact.png)

### Extracting build from RPMs

If you want to extract the binary files from RPMs to use with the test `runner`, you can use `cpio`

```bash
mkdir 22.12
mv cl*rpm 22.12/
export CHDIR=./22.12
rpm2cpio ./clickhouse-server-22.12.1.1738.x86_64.rpm | \
cpio -id --no-absolute-filenames
rpm2\
cpio ./clickhouse-client-22.12.1.1738.x86_64.rpm | \
cpio -id --no-absolute-filenames
rpm2cpio ./clickhouse-common-static-22.12.1.1738.x86_64.rpm | \
cpio -id --no-absolute-filenames
```

### Command to run tests:

These examples use env vars for the directory names:

- $DOCS is the parent directory of the ClickHouse repo
- $CHDIR is the parent directory of the extracted ClickHouse download files

For SQL tests:
```bash
PATH=$CHDIR/usr/bin/$PATH \
$DOCS/ClickHouse/tests/clickhouse-test \
01428_hash_set_nan_key
```

To see the queries that were run:
```bash
PATH=$CHDIR/usr/bin/$PATH \
clickhouse-client -q \
"select query from system.query_log ORDER BY event_time FORMAT Vertical"
```

For integration tests:
```bash
cd $DOCS/ClickHouse/tests/integration/
./runner -n 5 \
--src-dir $DOCS/ClickHouse/src \
--binary $CHDIR/usr/bin/clickhouse-server \
--cleanup-containers \
--command bash
```

## How to change code highlighting?

Code highlighting is based on the language chosen for your code blocks. Specify the language when you start the code block:
Expand Down

0 comments on commit 0ba3d53

Please sign in to comment.