Skip to content

Commit 753adb5

Browse files
docs: adding contributing page (#884)
Adding contributing section to the docs
1 parent f754cf1 commit 753adb5

File tree

1 file changed

+111
-0
lines changed

1 file changed

+111
-0
lines changed

docs/contributing.md

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
# Contributing Guidelines
2+
3+
4+
# Prerequisites:
5+
6+
- Poetry 1.5.1. [Installation guide](https://python-poetry.org/docs/#installing-with-the-official-installer)
7+
8+
# Installation
9+
10+
You can install "pytest-splunk-addon" via [pip] from [PyPI]:
11+
12+
```
13+
$ pip install pytest-splunk-addon
14+
```
15+
16+
To install currently checked out version of pytest-splunk-addon use:
17+
```
18+
$ poetry install
19+
```
20+
21+
22+
### Unit tests
23+
24+
```bash
25+
poetry run pytest -v tests/unit
26+
```
27+
28+
### e2e tests
29+
30+
- For e2e tests we are using a functionality of pytest which creates a temp dir and copies all the required file to that dir and then runs the pytest cmd from the tests.
31+
- e2e tests can be found under /tests/e2e
32+
33+
Prerequisites:
34+
35+
- Docker version: 25.0.3
36+
- Docker Compose version: v2.24.6-desktop.1
37+
38+
Steps to run e2e tests locally:
39+
40+
```
41+
git clone --recurse-submodules -j8 [email protected]:splunk/pytest-splunk-addon.git
42+
cd pytest-splunk-addon
43+
poetry install
44+
poetry run pytest -v --splunk-version=${splunk-version} -m docker -m ${test-marker} tests/e2e
45+
```
46+
47+
For more details please refer: [documentation](https://splunk.github.io/pytest-splunk-addon).
48+
49+
### Troubleshooting:
50+
51+
1. If you face an error like this:
52+
53+
> argparse.ArgumentError: argument -K/--keepalive: conflicting option strings: -K, --keepalive
54+
55+
- This is likely to happen if you have older version of PSA requirements installed, to solve this try to uninstall lovely-pytest-docker and pull the latest main branch and then do `poetry install`
56+
57+
2. If while running the tests you face an exception like this:
58+
59+
> Exception: Command ['docker', 'compose', '-f', '<path>/docker-compose.yml', '-p', '<projectname>', 'down', '-v'] returned 125: """unknown shorthand flag: 'f' in -f
60+
61+
- This happens due to misconfigurations in docker, try to follow below steps:
62+
- sudo mkdir -p /usr/local/lib/docker
63+
- sudo ln -s /Applications/Docker.app/Contents/Resources/cli-plugins /usr/local/lib/docker/cli-plugins
64+
65+
3. If you face error like this:
66+
67+
> ERROR: no match for platform in manifest: not found
68+
69+
- Try adding platform: `linux/amd64` to docker-compose.yml file
70+
71+
72+
## Linting and Type-checking
73+
74+
`Pytest-splunk-addon` uses the [`pre-commit`](https://pre-commit.com) framework for linting and type-checking.
75+
Consult with `pre-commit` documentation about what is the best way to install the software.
76+
77+
To run it locally:
78+
79+
```bash
80+
pre-commit run --all-files
81+
```
82+
83+
## Documentation changes
84+
85+
Documentation changes are also welcome!
86+
87+
To verify changes locally:
88+
89+
```bash
90+
poetry run mkdocs serve -a localhost:8001
91+
```
92+
93+
## Issues and bugs
94+
95+
You can create an [issue](https://github.com/splunk/pytest-splunk-addon/issues) on GitHub.
96+
Please provide relevant details mentioned below:
97+
- PSA-version, OS/Environment
98+
- Description of issue/bug
99+
- How to reproduce
100+
- Actual-Behaviour vs Expected-Behaviour
101+
102+
## Pull requests
103+
104+
We love to see pull requests!
105+
106+
- We are using [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/), so make sure to follow the same in PR titles.
107+
- In PR description make sure to highlight what changes are done and why they were needed.
108+
- Also add unit/e2e tests whichever is applicable as per code changes done.
109+
- Create a PR to develop and once reviewed by code-owners make sure to use squash-merge option.
110+
111+
Note: The `semgrep` and `fossa` steps might fail if you are an external contributor. This is expected for now.

0 commit comments

Comments
 (0)