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

Add unit tests for scripts/compute-tags.sh #5780

Merged
merged 5 commits into from
Jul 27, 2024

Conversation

yurishkuro
Copy link
Member

@yurishkuro yurishkuro commented Jul 26, 2024

Which problem is this PR solving?

Description of the changes

  • Add unit tests and call them from scripts linting workflow
  • Minor refactoring of scripts/compute-tags.sh to make it easier to read

How was this change tested?

$ GREP=ggrep SHUNIT2=/Users/ysh/dev/shunit2 bash scripts/compute-tags.test.sh
testRequireImageName
testRequireBranch
testRequireGithubSha
testRandomBranch
   Actual: --tag docker.io/foo/bar --tag quay.io/foo/bar --tag docker.io/foo/bar:latest --tag quay.io/foo/bar:latest --tag docker.io/foo/bar-snapshot:sha --tag quay.io/foo/bar-snapshot:sha --tag docker.io/foo/bar-snapshot:latest --tag quay.io/foo/bar-snapshot:latest
   checking foo/bar
   checking foo/bar:latest
   checking foo/bar-snapshot:sha
   checking foo/bar-snapshot:latest
testMainBranch
   Actual: --tag docker.io/foo/bar --tag quay.io/foo/bar --tag docker.io/foo/bar:latest --tag quay.io/foo/bar:latest --tag docker.io/foo/bar-snapshot:sha --tag quay.io/foo/bar-snapshot:sha --tag docker.io/foo/bar-snapshot:latest --tag quay.io/foo/bar-snapshot:latest
   checking foo/bar
   checking foo/bar:latest
   checking foo/bar-snapshot:sha
   checking foo/bar-snapshot:latest
testSemVerBranch
   Actual: --tag docker.io/foo/bar --tag quay.io/foo/bar --tag docker.io/foo/bar:1.2.3 --tag quay.io/foo/bar:1.2.3 --tag docker.io/foo/bar:1.2 --tag quay.io/foo/bar:1.2 --tag docker.io/foo/bar:1 --tag quay.io/foo/bar:1 --tag docker.io/foo/bar-snapshot:sha --tag quay.io/foo/bar-snapshot:sha --tag docker.io/foo/bar-snapshot:latest --tag quay.io/foo/bar-snapshot:latest
   checking foo/bar
   checking foo/bar:1
   checking foo/bar:1.2
   checking foo/bar:1.2.3
   checking foo/bar-snapshot:sha
   checking foo/bar-snapshot:latest

Ran 6 tests.

OK

@yurishkuro yurishkuro requested a review from a team as a code owner July 26, 2024 23:08
@yurishkuro yurishkuro added the changelog:test Change that's adding missing tests or correcting existing tests label Jul 26, 2024
@dosubot dosubot bot added the docker Pull requests that update Docker code label Jul 26, 2024
Signed-off-by: Yuri Shkuro <[email protected]>
Signed-off-by: Yuri Shkuro <[email protected]>
Signed-off-by: Yuri Shkuro <[email protected]>
Copy link

codecov bot commented Jul 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.65%. Comparing base (5bf667e) to head (7bae809).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5780      +/-   ##
==========================================
- Coverage   96.67%   96.65%   -0.03%     
==========================================
  Files         342      342              
  Lines       16519    16519              
==========================================
- Hits        15970    15966       -4     
- Misses        360      363       +3     
- Partials      189      190       +1     
Flag Coverage Δ
badger_v1 8.05% <ø> (ø)
badger_v2 1.81% <ø> (ø)
cassandra-3.x-v1 16.61% <ø> (ø)
cassandra-3.x-v2 1.74% <ø> (ø)
cassandra-4.x-v1 16.61% <ø> (ø)
cassandra-4.x-v2 1.74% <ø> (ø)
elasticsearch-6.x-v1 18.77% <ø> (-0.02%) ⬇️
elasticsearch-7.x-v1 18.84% <ø> (+0.01%) ⬆️
elasticsearch-8.x-v1 19.03% <ø> (ø)
elasticsearch-8.x-v2 1.81% <ø> (ø)
grpc_v1 9.52% <ø> (ø)
grpc_v2 7.14% <ø> (ø)
kafka 9.74% <ø> (ø)
memory_v2 1.81% <ø> (ø)
opensearch-1.x-v1 18.88% <ø> (ø)
opensearch-2.x-v1 18.89% <ø> (ø)
opensearch-2.x-v2 1.80% <ø> (ø)
unittests 95.07% <ø> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Signed-off-by: Yuri Shkuro <[email protected]>
@yurishkuro yurishkuro merged commit cab1aee into jaegertracing:main Jul 27, 2024
44 checks passed
@yurishkuro yurishkuro deleted the compute-tags.test.sh branch July 27, 2024 15:54
yurishkuro added a commit that referenced this pull request Jul 28, 2024
## Which problem is this PR solving?
- Resolves #5721
- Stacked after #5780

## Description of the changes
- Do not add `latest` tag when on the `main` branch
- Do add `latest` when on a semver tag

## How was this change tested?
- unit tests

Signed-off-by: Yuri Shkuro <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog:test Change that's adding missing tests or correcting existing tests docker Pull requests that update Docker code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants