Skip to content

Commit 3ea8b71

Browse files
committed
Add CONTRIBUTING.md
1 parent 937e02a commit 3ea8b71

File tree

3 files changed

+62
-0
lines changed

3 files changed

+62
-0
lines changed

CONTRIBUTING.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
Contributing to seqcli
2+
================
3+
4+
Testing
5+
------
6+
7+
`seqcli` has two test projects: `SeqCli.EndToEnd` and `SeqCli.Tests`.
8+
9+
### SeqCli.EndToEnd
10+
11+
`/test/SeqCli.EndToEnd` is a console app that implements integration tests. It uses a custom testing framework and xunit for assertions.
12+
13+
Each test within the EndToEnd project (an implementation of the `ICliTestCase` interface) spans one child process for the Seq server and one child process for the seqcli command.
14+
15+
The Seq server can be run via the `seq` executable (windows only) or as a `datalust/seq:latest` docker container. Which to use is controlled via the `--docker-server` argument.
16+
17+
Some tests require a Seq license. These tests are run if a valid license is supplied via stdin and the `--license-certificate-stdin` argument is supplied.
18+
19+
#### Adding Tests
20+
21+
The typical pattern is to execute a seqcli command, then make an assertion on the output of the command. E.g.
22+
23+
```c#
24+
var exit = runner.Exec("apikey list", "-t Test --json --no-color");
25+
Assert.Equal(0, exit);
26+
27+
var output = runner.LastRunProcess!.Output;
28+
Assert.Contains("\"AssignedPermissions\": [\"Ingest\"]", output);
29+
```
30+
31+
#### Running Tests
32+
33+
```shell
34+
/SeqCli.EndToEnd$ dotnet run -- --docker-server
35+
```
36+
37+
The `--docker-server` is optional if you have a `seq` executable in your path.
38+
39+
To run the multi user tests as well, save a valid license into a file and:
40+
41+
```shell
42+
/SeqCli.EndToEnd$ cat license.txt | dotnet run -- --docker-server --license-certificate-stdin
43+
```
44+
45+
To run a specific set of tests pass regular expressions matching the tests to run:
46+
47+
```shell
48+
/SeqCli.EndToEnd$ dotnet run -- --docker-server *TestCase.cs Command*
49+
```
50+
51+
### SeqCli.Tests
52+
53+
`/test/SeqCli.Tests` is a regular xunit testing project. To run:
54+
55+
```shell
56+
/SeqCli.Tests$ dotnet test
57+
```

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ $token = (
5050
)
5151
```
5252

53+
## Contributing
54+
55+
See `CONTRIBUTING.md`.
56+
5357
## Commands
5458

5559
Usage:

seqcli.sln

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "sln", "sln", "{2EA56595-519
1717
Build.Docker.ps1 = Build.Docker.ps1
1818
docker-publish.ps1 = docker-publish.ps1
1919
Setup.ps1 = Setup.ps1
20+
CONTRIBUTING.md = CONTRIBUTING.md
2021
EndProjectSection
2122
EndProject
2223
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{3587B633-0C03-4235-8903-6226900328F1}"

0 commit comments

Comments
 (0)