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

Closed
yurishkuro opened this issue Jan 2, 2024 · 16 comments · Fixed by #5119 or #5806
Closed

Implement missing unit tests #5068

yurishkuro opened this issue Jan 2, 2024 · 16 comments · Fixed by #5119 or #5806
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 <pushkarmishra029@gmail.com>
Co-authored-by: Yuri Shkuro <yurishkuro@users.noreply.github.com>
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 <pushkarmishra029@gmail.com>
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 <cghosh828049@gmail.com>
Signed-off-by: Yuri Shkuro <github@ysh.us>
Co-authored-by: Yuri Shkuro <github@ysh.us>
@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 <156124227+tarhphilomina@users.noreply.github.com>
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 <cghosh828049@gmail.com>
Co-authored-by: Yuri Shkuro <yurishkuro@users.noreply.github.com>
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 <hpotpose62@gmail.com>
Signed-off-by: Harshvir Potpose <122517264+akagami-harsh@users.noreply.github.com>
Signed-off-by: Yuri Shkuro <github@ysh.us>
Co-authored-by: Yuri Shkuro <yurishkuro@users.noreply.github.com>
Co-authored-by: Yuri Shkuro <github@ysh.us>
@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 <vaibhavmalik2018@gmail.com>
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 <vaibhavmalik2018@gmail.com>
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 <vaibhavmalik2018@gmail.com>
@VaibhavMalik4187
Copy link
Contributor

VaibhavMalik4187 commented Jan 19, 2024

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

@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/

@miledxz
Copy link

miledxz 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 <ashutosh3002@gmail.com>
Co-authored-by: Yuri Shkuro <yurishkuro@users.noreply.github.com>
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 <vaibhavmalik2018@gmail.com>
Signed-off-by: Yuri Shkuro <github@ysh.us>
Signed-off-by: Yuri Shkuro <yurishkuro@users.noreply.github.com>
Co-authored-by: Yuri Shkuro <github@ysh.us>
Co-authored-by: Yuri Shkuro <yurishkuro@users.noreply.github.com>
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 <prathms007@gmail.com>
Co-authored-by: Yuri Shkuro <yurishkuro@users.noreply.github.com>
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 <github@ysh.us>
yurishkuro added a commit that referenced this issue Jul 3, 2024
## Which problem is this PR solving?
- #5068

## Description of the changes
- added test case for ` pkg/kafka/auth/config.go` and updated
`internal/tracegen/worker_test.go`

## How was this change tested?
- 

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

---------

Signed-off-by: mehul gautam <mehulsharma4786@gmail.com>
Signed-off-by: mehul gautam <mehulsharma4786@gamil.com>
Co-authored-by: mehul gautam <mehulsharma4786@gamil.com>
Co-authored-by: Yuri Shkuro <yurishkuro@users.noreply.github.com>
yurishkuro added a commit that referenced this issue Aug 8, 2024
## Which problem is this PR solving?
partially fixes: #5068 

## Description of the changes
- This commit adds tests for the `pkg/es/config` 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: nabil salah <nabil.salah203@gmail.com>
Co-authored-by: Yuri Shkuro <yurishkuro@users.noreply.github.com>
@yurishkuro yurishkuro reopened this Aug 8, 2024
yurishkuro pushed a commit that referenced this issue Aug 8, 2024
## Which problem is this PR solving?
Part of: #5068 

## Description of the changes
- This commit adds tests for the `pkg/es/config` 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: nabil salah <nabil.salah203@gmail.com>
@yurishkuro
Copy link
Member Author

This is DONE! 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉

Thanks to everyone who contributed: @akagami-harsh @Pushkarm029 @chirag-ghosh @tarhphilomina @VaibhavMalik4187 @Wise-Wizard @h4shk4t @shanukun @hellspawn679 @Nabil-Salah

JaredTan95 pushed a commit to JaredTan95/jaeger that referenced this issue Aug 13, 2024
## Which problem is this PR solving?
partially fixes: jaegertracing#5068

## Description of the changes
- This commit adds tests for the `pkg/es/config` 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: nabil salah <nabil.salah203@gmail.com>
Co-authored-by: Yuri Shkuro <yurishkuro@users.noreply.github.com>
Signed-off-by: Jared Tan <jian.tan@daocloud.io>
JaredTan95 pushed a commit to JaredTan95/jaeger that referenced this issue Aug 13, 2024
## Which problem is this PR solving?
Part of: jaegertracing#5068

## Description of the changes
- This commit adds tests for the `pkg/es/config` 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: nabil salah <nabil.salah203@gmail.com>
Signed-off-by: Jared Tan <jian.tan@daocloud.io>
JaredTan95 pushed a commit to JaredTan95/jaeger that referenced this issue Aug 14, 2024
## Which problem is this PR solving?
partially fixes: jaegertracing#5068

## Description of the changes
- This commit adds tests for the `pkg/es/config` 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: nabil salah <nabil.salah203@gmail.com>
Co-authored-by: Yuri Shkuro <yurishkuro@users.noreply.github.com>
Signed-off-by: Jared Tan <jian.tan@daocloud.io>
JaredTan95 pushed a commit to JaredTan95/jaeger that referenced this issue Aug 14, 2024
## Which problem is this PR solving?
Part of: jaegertracing#5068

## Description of the changes
- This commit adds tests for the `pkg/es/config` 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: nabil salah <nabil.salah203@gmail.com>
Signed-off-by: Jared Tan <jian.tan@daocloud.io>
JaredTan95 pushed a commit to JaredTan95/jaeger that referenced this issue Aug 14, 2024
## Which problem is this PR solving?
partially fixes: jaegertracing#5068

## Description of the changes
- This commit adds tests for the `pkg/es/config` 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: nabil salah <nabil.salah203@gmail.com>
Co-authored-by: Yuri Shkuro <yurishkuro@users.noreply.github.com>
JaredTan95 pushed a commit to JaredTan95/jaeger that referenced this issue Aug 28, 2024
## Which problem is this PR solving?
partially fixes: jaegertracing#5068

## Description of the changes
- This commit adds tests for the `pkg/es/config` 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: nabil salah <nabil.salah203@gmail.com>
Co-authored-by: Yuri Shkuro <yurishkuro@users.noreply.github.com>
Signed-off-by: Jared Tan <jian.tan@daocloud.io>
JaredTan95 pushed a commit to JaredTan95/jaeger that referenced this issue Aug 28, 2024
## Which problem is this PR solving?
Part of: jaegertracing#5068

## Description of the changes
- This commit adds tests for the `pkg/es/config` 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: nabil salah <nabil.salah203@gmail.com>
Signed-off-by: Jared Tan <jian.tan@daocloud.io>
JaredTan95 pushed a commit to JaredTan95/jaeger that referenced this issue Aug 28, 2024
## Which problem is this PR solving?
partially fixes: jaegertracing#5068

## Description of the changes
- This commit adds tests for the `pkg/es/config` 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: nabil salah <nabil.salah203@gmail.com>
Co-authored-by: Yuri Shkuro <yurishkuro@users.noreply.github.com>
Signed-off-by: Jared Tan <jian.tan@daocloud.io>
JaredTan95 pushed a commit to JaredTan95/jaeger that referenced this issue Aug 28, 2024
## Which problem is this PR solving?
partially fixes: jaegertracing#5068

## Description of the changes
- This commit adds tests for the `pkg/es/config` 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: nabil salah <nabil.salah203@gmail.com>
Co-authored-by: Yuri Shkuro <yurishkuro@users.noreply.github.com>
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