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

Refactor interceptor main package #1467

Merged

Conversation

savitaashture
Copy link
Contributor

Changes

Fixes: #1441

Submitter Checklist

These are the criteria that every PR should meet, please check them off as you
review them:

  • Includes tests (if functionality changed/added)
  • Includes docs (if user facing)
  • Commit messages follow commit message best practices
  • Release notes block has been filled in or deleted (only if no user facing changes)

See the contribution guide for more details.

Release Notes

@tekton-robot tekton-robot added the release-note Denotes a PR that will be considered when it comes time to generate release notes. label Oct 19, 2022
@savitaashture savitaashture added the kind/misc Categorizes issue or PR as a miscellaneuous one. label Oct 19, 2022
@tekton-robot tekton-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Oct 19, 2022
@tekton-robot
Copy link

The following is the coverage report on the affected files.
Say /test pull-tekton-triggers-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/interceptors/server/server.go 77.7% 57.6% -20.0

@savitaashture
Copy link
Contributor Author

The following is the coverage report on the affected files. Say /test pull-tekton-triggers-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/interceptors/server/server.go 77.7% 57.6% -20.0

Coverage decreased because in code we are using

secret, err := secretInformer.Get(ctx).Lister().Secrets(system.Namespace()).Get(os.Getenv(interceptorTLSSecretKey))
                        if err != nil {
                                logger.Errorf("failed to fetch secret %v", err)
                                return nil, nil
                        }

and from test even if create secret object informer won't able to get the data
because of that some parts of code is not covered

Copy link
Contributor

@khrm khrm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/approve

@tekton-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: khrm

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 2, 2022
@dibyom
Copy link
Member

dibyom commented Nov 3, 2022

I think we can refactor the functions a bit and add some tests - we've had a few bugs around this behavior so its not ideal to have not tests for it.

For GetTLSData - we could use a fakesecretinformer + pass in namespace and secret name as arguments to the function
For UpdateCACertToClusterInterceptorCRD we can either extract the code under the go routine into its own function to test or use a fake clock

@savitaashture savitaashture force-pushed the triggers_refactor_interceptor_main branch from 92ba1e1 to bb272a0 Compare November 7, 2022 16:55
@savitaashture savitaashture added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Nov 7, 2022
@tekton-robot
Copy link

The following is the coverage report on the affected files.
Say /test pull-tekton-triggers-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/interceptors/server/server.go 77.7% 76.6% -1.1

@savitaashture savitaashture force-pushed the triggers_refactor_interceptor_main branch from bb272a0 to a6ed0cd Compare November 7, 2022 17:44
@tekton-robot
Copy link

The following is the coverage report on the affected files.
Say /test pull-tekton-triggers-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/interceptors/server/server.go 77.7% 77.3% -0.4

@savitaashture savitaashture force-pushed the triggers_refactor_interceptor_main branch from a6ed0cd to 7bd66b5 Compare November 8, 2022 07:12
@tekton-robot
Copy link

The following is the coverage report on the affected files.
Say /test pull-tekton-triggers-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/interceptors/server/server.go 77.7% 79.3% 1.6

@savitaashture savitaashture force-pushed the triggers_refactor_interceptor_main branch from 7bd66b5 to a9c50b1 Compare November 8, 2022 08:10
@tekton-robot
Copy link

The following is the coverage report on the affected files.
Say /test pull-tekton-triggers-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/interceptors/server/server.go 77.7% 79.3% 1.6

@savitaashture savitaashture removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Nov 8, 2022
@savitaashture
Copy link
Contributor Author

@dibyom PR is ready
PTAL
Thank you

@dibyom
Copy link
Member

dibyom commented Nov 8, 2022

/lgtm

Thank you!

@dibyom
Copy link
Member

dibyom commented Nov 8, 2022

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Nov 8, 2022
@tekton-robot tekton-robot merged commit 004d21b into tektoncd:main Nov 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. kind/misc Categorizes issue or PR as a miscellaneuous one. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactor interceptor main
4 participants