Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement missing unit tests #5068

Open
yurishkuro opened this issue Jan 2, 2024 · 15 comments · Fixed by #5119
Open

Implement missing unit tests #5068

yurishkuro opened this issue Jan 2, 2024 · 15 comments · Fixed by #5119
Labels
good first issue Good for beginners help wanted Features that maintainers are willing to accept but do not have cycles to implement

Comments

@yurishkuro
Copy link
Member

yurishkuro commented Jan 2, 2024

Our CI enforces that all packages with .go files must have at least one _test.go file, to ensure the package is included in the code coverage, OR that it has a .nocover file when testing it is very difficult (e.g. requires external DB connection).

However, we somewhat abused the .nocover capability and have a bunch of packages that could have tests with high coverage. This ticket is about incrementally fixing those, which is a good first issue since the changes can be reasonably small if scoped to one package.

To see which packages need these tests, run make nocover.

Regarding ./examples/, where lots of .nocover files are found today, I think we can replace them with empty_test.go as we do in some other dirs, because examples will still be excluded from the overall coverage percentage, so there's no need to be excluding them via .nocover mechanism (it just creates noise).

Update Jun 17 2024

We are actually down to a single package remaining

$ make nocover
Verifying that all packages have test files to count in coverage
Package excluded from coverage: ./pkg/es/config/
  reason: requires connection to Elasticsearch

The reason stated in that package is not very valid - it only checks for the version of the server which can be easily mocked with a simple HTTP server as we already do in other ES-related tests. The majority of methods in the package do not require connection at all and can be 100% covered by tests.

@yurishkuro yurishkuro added help wanted Features that maintainers are willing to accept but do not have cycles to implement good first issue Good for beginners labels Jan 2, 2024
@chirag-ghosh
Copy link
Contributor

I would like to work on this

@yurishkuro
Copy link
Member Author

@chirag-ghosh thanks. I suggest you pick one of the packages and maybe post here that you're working on it, in case someone else also wants to pick another package. Don't combine multiple packages in one PR.

@chirag-ghosh
Copy link
Contributor

Sure. Since I'm new to the project, I'll first setup it in my local and the comment the package I'm working on ASAP.

@chirag-ghosh
Copy link
Contributor

@akagami-harsh
Copy link
Member

working on cmd/jeager/internal

@Pushkarm029
Copy link
Member

Pushkarm029 commented Jan 3, 2024

working on ./pkg/version/ & adding empty tests for ./examples/

yurishkuro added a commit to Pushkarm029/jaeger that referenced this issue Jan 3, 2024
yurishkuro added a commit that referenced this issue Jan 3, 2024
## Which problem is this PR solving?
- Part of #5068 

## Description of the changes
- added some missing unit tests in /pkg/version

## How was this change tested?
- go test

## Checklist
- [x] I have read
https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md
- [x] I have signed all commits
- [x] I have added unit tests for the new functionality
- [x] I have run lint and test steps successfully
  - for `jaeger`: `make lint test`
  - for `jaeger-ui`: `yarn lint` and `yarn test`

---------

Signed-off-by: Pushkar Mishra <[email protected]>
Co-authored-by: Yuri Shkuro <[email protected]>
yurishkuro pushed a commit that referenced this issue Jan 4, 2024
## Which problem is this PR solving?
- Part of #5068 

## Description of the changes
- Added Empty Tests for `./examples` to reduce noise in `make nocover`.

## How was this change tested?
- go test

## Checklist
- [x] I have read
https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md
- [x] I have signed all commits
- [x] I have added unit tests for the new functionality
- [x] I have run lint and test steps successfully
  - for `jaeger`: `make lint test`
  - for `jaeger-ui`: `yarn lint` and `yarn test`

---------

Signed-off-by: Pushkar Mishra <[email protected]>
yurishkuro added a commit that referenced this issue Jan 10, 2024
## Which problem is this PR solving?
- Part of #5068 

## Description of the changes
- Add tests to storageexporter package

## How was this change tested?
- CI

## Checklist
- [x] I have read
https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md
- [x] I have signed all commits
- [x] I have added unit tests for the new functionality
- [x] I have run lint and test steps successfully
  - for `jaeger`: `make lint test`
  - for `jaeger-ui`: `yarn lint` and `yarn test`

---------

Signed-off-by: Chirag Ghosh <[email protected]>
Signed-off-by: Yuri Shkuro <[email protected]>
Co-authored-by: Yuri Shkuro <[email protected]>
@chirag-ghosh
Copy link
Contributor

Working on jaegerstorage

@tarhphilomina
Copy link
Contributor

working on Jaeger/plugin/

yurishkuro pushed a commit that referenced this issue Jan 18, 2024
## Which problem is this PR solving?
Part of  #5068 

## Description of the changes
- Added test to adaptive sampling plugin options

## How was this change tested?
- make test

## Checklist
- [x] I have read
https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md
- [x] I have signed all commits
- [x] I have added unit tests for the new functionality
- [x] I have run lint and test steps successfully
  - for `jaeger`: `make lint test`
  - for `jaeger-ui`: `yarn lint` and `yarn test`

---------

Signed-off-by: tarhphilomina <[email protected]>
yurishkuro added a commit that referenced this issue Jan 18, 2024
## Which problem is this PR solving?
- #5068 

## Description of the changes
-  Add unit tests for jaegerstorage

## How was this change tested?
- 

## Checklist
- [x] I have read
https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md
- [x] I have signed all commits
- [x] I have added unit tests for the new functionality
- [x] I have run lint and test steps successfully
  - for `jaeger`: `make lint test`
  - for `jaeger-ui`: `yarn lint` and `yarn test`

---------

Signed-off-by: Chirag Ghosh <[email protected]>
Co-authored-by: Yuri Shkuro <[email protected]>
yurishkuro added a commit that referenced this issue Jan 19, 2024
## Which problem is this PR solving?
- part of #5068 

## Description of the changes
- added missing unit test in cmd/jeager/internal and also added a
goroutine check for that package

## How was this change tested?
- go test

## Checklist
- [x] I have read
https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md
- [x] I have signed all commits
- [x] I have added unit tests for the new functionality
- [x] I have run lint and test steps successfully
  - for `jaeger`: `make lint test`

---------

Signed-off-by: Harshvir Potpose <[email protected]>
Signed-off-by: Harshvir Potpose <[email protected]>
Signed-off-by: Yuri Shkuro <[email protected]>
Co-authored-by: Yuri Shkuro <[email protected]>
Co-authored-by: Yuri Shkuro <[email protected]>
@VaibhavMalik4187
Copy link
Contributor

I'd like to work on internal/tracegen

VaibhavMalik4187 added a commit to VaibhavMalik4187/jaeger that referenced this issue Jan 19, 2024
- part of jaegertracing#5068

- This commit adds tests for the `Run` function defined in the
  `internal/tracegen` package.

- make test

- [x] I have read
https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md
- [x] I have signed all commits
- [x] I have added unit tests for the new functionality
- [x] I have run lint and test steps successfully
  - for `jaeger`: `make lint test`

---------

Signed-off-by: VaibhavMalik4187 <[email protected]>
VaibhavMalik4187 added a commit to VaibhavMalik4187/jaeger that referenced this issue Jan 19, 2024
- Partially Fixes jaegertracing#5068

- This commit adds tests for the `Run` function defined in the
  `internal/tracegen` package.

- make test

- [x] I have read
https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md
- [x] I have signed all commits
- [x] I have added unit tests for the new functionality
- [x] I have run lint and test steps successfully
  - for `jaeger`: `make lint test`

---------

Signed-off-by: VaibhavMalik4187 <[email protected]>
VaibhavMalik4187 added a commit to VaibhavMalik4187/jaeger that referenced this issue Jan 19, 2024
- Partially fixes jaegertracing#5068

- This commit adds tests for the `Run` function defined in the `internal/tracegen` package.

- make test

- [x] I have read https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md
- [x] I have signed all commits
- [x] I have added unit tests for the new functionality
- [x] I have run lint and test steps successfully
  - for `jaeger`: `make lint test`
  - for `jaeger-ui`: `yarn lint` and `yarn test`

Signed-off-by: VaibhavMalik4187 <[email protected]>
@VaibhavMalik4187
Copy link
Contributor

VaibhavMalik4187 commented Jan 19, 2024

I'm working on the cmd/jaeger/internal/extension/jaegerquery/ package.

VaibhavMalik4187 added a commit to VaibhavMalik4187/jaeger that referenced this issue Jan 20, 2024
- Partially fixes jaegertracing#5068

- This commit adds tests for the `Run` function defined in the `internal/tracegen` package.

- make test

- [x] I have read https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md
- [x] I have signed all commits
- [x] I have added unit tests for the new functionality
- [x] I have run lint and test steps successfully
  - for `jaeger`: `make lint test`
  - for `jaeger-ui`: `yarn lint` and `yarn test`

Signed-off-by: VaibhavMalik4187 <[email protected]>
VaibhavMalik4187 added a commit to VaibhavMalik4187/jaeger that referenced this issue Jan 20, 2024
- Partially fixes jaegertracing#5068

- This commit adds tests for the `Run` function defined in the `internal/tracegen` package.

- make test

- [x] I have read https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md
- [x] I have signed all commits
- [x] I have added unit tests for the new functionality
- [x] I have run lint and test steps successfully
  - for `jaeger`: `make lint test`
  - for `jaeger-ui`: `yarn lint` and `yarn test`

Signed-off-by: VaibhavMalik4187 <[email protected]>
VaibhavMalik4187 added a commit to VaibhavMalik4187/jaeger that referenced this issue Jan 20, 2024
- Partially fixes jaegertracing#5068

- This commit adds tests for the `Run` function defined in the `internal/tracegen` package.

- make test

- [x] I have read https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md
- [x] I have signed all commits
- [x] I have added unit tests for the new functionality
- [x] I have run lint and test steps successfully
  - for `jaeger`: `make lint test`
  - for `jaeger-ui`: `yarn lint` and `yarn test`

Signed-off-by: VaibhavMalik4187 <[email protected]>
VaibhavMalik4187 added a commit to VaibhavMalik4187/jaeger that referenced this issue Jan 21, 2024
- Partially fixes jaegertracing#5068

- This commit adds tests for the `Run` function defined in the `internal/tracegen` package.

- make test

- [x] I have read https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md
- [x] I have signed all commits
- [x] I have added unit tests for the new functionality
- [x] I have run lint and test steps successfully
  - for `jaeger`: `make lint test`
  - for `jaeger-ui`: `yarn lint` and `yarn test`

Signed-off-by: VaibhavMalik4187 <[email protected]>
VaibhavMalik4187 added a commit to VaibhavMalik4187/jaeger that referenced this issue Jan 21, 2024
Partially Addresses: jaegertracing#5068

- This commit adds tests for the
  `cmd/jaeger/internal/extension/jaegerquery` package. It brings the
  code coverage of the package to 84%

- make test

- [x] I have read https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md
- [x] I have signed all commits
- [x] I have added unit tests for the new functionality
- [x] I have run lint and test steps successfully
  - for `jaeger`: `make lint test`
  - for `jaeger-ui`: `yarn lint` and `yarn test`

Signed-off-by: VaibhavMalik4187 <[email protected]>
VaibhavMalik4187 added a commit to VaibhavMalik4187/jaeger that referenced this issue Jan 21, 2024
- Partially fixes jaegertracing#5068

- This commit adds tests tests in the `internal/tracegen` package,
  bringing the package coverage to 97%.

- make test

- [x] I have read https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md
- [x] I have signed all commits
- [x] I have added unit tests for the new functionality
- [x] I have run lint and test steps successfully
  - for `jaeger`: `make lint test`
  - for `jaeger-ui`: `yarn lint` and `yarn test`

Signed-off-by: VaibhavMalik4187 <[email protected]>
yurishkuro pushed a commit that referenced this issue Jan 21, 2024
## Which problem is this PR solving?
- Partially fixes #5068 

## Description of the changes
- This commit adds tests for the `internal/tracegen` package.

## How was this change tested?
- make test

## Checklist
- [x] I have read
https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md
- [x] I have signed all commits
- [x] I have added unit tests for the new functionality
- [x] I have run lint and test steps successfully
  - for `jaeger`: `make lint test`
  - for `jaeger-ui`: `yarn lint` and `yarn test`

Signed-off-by: VaibhavMalik4187 <[email protected]>
VaibhavMalik4187 added a commit to VaibhavMalik4187/jaeger that referenced this issue Jan 21, 2024
Partially Addresses: jaegertracing#5068

- This commit adds tests for the
  `cmd/jaeger/internal/extension/jaegerquery` package. It brings the
  code coverage of the package to 84%

- make test

- [x] I have read https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md
- [x] I have signed all commits
- [x] I have added unit tests for the new functionality
- [x] I have run lint and test steps successfully
  - for `jaeger`: `make lint test`
  - for `jaeger-ui`: `yarn lint` and `yarn test`

Signed-off-by: VaibhavMalik4187 <[email protected]>
@yurishkuro yurishkuro reopened this Jan 21, 2024
VaibhavMalik4187 added a commit to VaibhavMalik4187/jaeger that referenced this issue Jan 23, 2024
Partially Addresses: jaegertracing#5068

- This commit adds tests for the
  `cmd/jaeger/internal/extension/jaegerquery` package. It brings the
  code coverage of the package to 84%

- make test

- [x] I have read https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md
- [x] I have signed all commits
- [x] I have added unit tests for the new functionality
- [x] I have run lint and test steps successfully
  - for `jaeger`: `make lint test`
  - for `jaeger-ui`: `yarn lint` and `yarn test`

Signed-off-by: VaibhavMalik4187 <[email protected]>
VaibhavMalik4187 added a commit to VaibhavMalik4187/jaeger that referenced this issue Jan 23, 2024
Partially Addresses: jaegertracing#5068

- This commit adds tests for the
  `cmd/jaeger/internal/extension/jaegerquery` package. It brings the
  code coverage of the package to 84%

- make test

- [x] I have read https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md
- [x] I have signed all commits
- [x] I have added unit tests for the new functionality
- [x] I have run lint and test steps successfully
  - for `jaeger`: `make lint test`
  - for `jaeger-ui`: `yarn lint` and `yarn test`

Signed-off-by: VaibhavMalik4187 <[email protected]>
VaibhavMalik4187 added a commit to VaibhavMalik4187/jaeger that referenced this issue Jan 23, 2024
Partially Addresses: jaegertracing#5068

- This commit adds tests for the
  `cmd/jaeger/internal/extension/jaegerquery` package. It brings the
  code coverage of the package to 84%

- make test

- [x] I have read https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md
- [x] I have signed all commits
- [x] I have added unit tests for the new functionality
- [x] I have run lint and test steps successfully
  - for `jaeger`: `make lint test`
  - for `jaeger-ui`: `yarn lint` and `yarn test`

Signed-off-by: VaibhavMalik4187 <[email protected]>
@prakrit55
Copy link
Contributor

I will cover ./cmd/anonymizer/app/query/ @yurishkuro

@Wise-Wizard
Copy link
Contributor

Hi @yurishkuro, Can I work on writing the test of cmd/jaeger/internal/extension/jaegerquery/?

yurishkuro pushed a commit that referenced this issue Jan 30, 2024
**Which problem is this PR solving?**

This PR addresses a part of the issue
[#5068](#5068) by adding
tests for the `pkg/cassandra/gocql/testutils` package.

**Description of the changes**

The commit introduces tests for the `pkg/cassandra/gocql/testutils`
package to ensure the correctness of the User Defined Type (UDT)
functionality. These tests cover the `MarshalUDT` and `UnmarshalUDT`
methods of the `CustomUDT` type.

**How was this change tested?**

The changes were tested by running the following command:

```bash
make test
```

**Checklist**

- [x] I have read
[CONTRIBUTING_GUIDELINES.md](https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md)
- [x] I have signed all commits
- [x] I have added unit tests for the new functionality
- [x] I have run lint and test steps successfully
  - `for jaeger: make lint test`
  - `for jaeger-ui: yarn lint` and `yarn test`

---------

Signed-off-by: Wise-Wizard <[email protected]>
@Wise-Wizard
Copy link
Contributor

Hi @VaibhavMalik4187, do you plan on completing the PR regarding tests for JaegerQuery or I can go ahead and complete the remaining requirements?

@h4shk4t
Copy link
Contributor

h4shk4t commented Feb 3, 2024

I'd like to work on cmd/anonymizer/app/writer/

@zedGGs
Copy link

zedGGs commented Feb 5, 2024

Heey @yurishkuro, I can add tests too, what do u suggest is priority at the moment ?

yurishkuro added a commit that referenced this issue Feb 9, 2024
## Which problem is this PR solving?
- Part of [#5068](#5068)

## Description of the changes
- Added unit tests for `cmd/anonymizer/app/writer/`

## How was this change tested?
- `go test -cover -v ./cmd/anonymizer/app/writer`
- `make lint test`

## Checklist
- [x] I have read
https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md
- [x] I have signed all commits
- [x] I have added unit tests for the new functionality
- [x] I have run lint and test steps successfully
  - for `jaeger`: `make lint test`
  - for `jaeger-ui`: `yarn lint` and `yarn test`

---------

Signed-off-by: Ashutosh Srivastava <[email protected]>
Co-authored-by: Yuri Shkuro <[email protected]>
yurishkuro added a commit that referenced this issue May 8, 2024
## Which problem is this PR solving?
- Part of #5068

## Description of the changes
- This commit adds tests for the
`cmd/jaeger/internal/extension/jaegerquery` package.

## How was this change tested?
- make test

## Checklist
- [x] I have read
https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md
- [x] I have signed all commits
- [x] I have added unit tests for the new functionality
- [x] I have run lint and test steps successfully
  - for `jaeger`: `make lint test`
  - for `jaeger-ui`: `yarn lint` and `yarn test`

---------

Signed-off-by: VaibhavMalik4187 <[email protected]>
Signed-off-by: Yuri Shkuro <[email protected]>
Signed-off-by: Yuri Shkuro <[email protected]>
Co-authored-by: Yuri Shkuro <[email protected]>
Co-authored-by: Yuri Shkuro <[email protected]>
yurishkuro added a commit that referenced this issue Jun 17, 2024
<!--
!! Please DELETE this comment before posting.
We appreciate your contribution to the Jaeger project! 👋🎉
-->

## Which problem is this PR solving?
- Part of #5068 

## Description of the changes
- This commit adds tests for the cmd/anonymizer/app/query package.

## How was this change tested?
- `go test ./cmd/anonymizer/app/query -v -cover` (85.7%)

## Checklist
- [x] I have read
https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md
- [x] I have signed all commits
- [x] I have added unit tests for the new functionality
- [x] I have run lint and test steps successfully
  - for `jaeger`: `make lint test`
  - for `jaeger-ui`: `yarn lint` and `yarn test`

---------

Signed-off-by: Pratham <[email protected]>
Co-authored-by: Yuri Shkuro <[email protected]>
yurishkuro added a commit that referenced this issue Jun 18, 2024
## Which problem is this PR solving?
- Part of #5068
- Looks like test were added but `.nocover` files not removed.

## Description of the changes
- Remove unnecessary .nocover files.

## How was this change tested?
- Check if this affects coverage in CI.

---------

Signed-off-by: Yuri Shkuro <[email protected]>
@hellspawn679 hellspawn679 mentioned this issue Jun 27, 2024
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for beginners help wanted Features that maintainers are willing to accept but do not have cycles to implement
Projects
None yet
10 participants