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 e2e tests using gRPC and REST #418

Merged
merged 1 commit into from
Apr 16, 2023
Merged

Conversation

sayan-biswas
Copy link
Contributor

@sayan-biswas sayan-biswas commented Mar 28, 2023

Changes

Add e2e test for ListRecords, ListResults, GetRecord, GetResult, DeleteRecord, DeleteResult, Authorization, Authentication and Impersonation using both gRPC and REST.

Submitter Checklist

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

  • Has Docs included if any changes are user facing
  • Has Tests included if any functionality added or changed
  • Tested your changes locally (if this is a code change)
  • Follows the commit message standard
  • Meets the Tekton contributor standards (including functionality, content, code)
  • Has a kind label. You can add a comment on this PR that contains /kind <type>. Valid types are bug, cleanup, design, documentation, feature, flake, misc, question, tep
  • Release notes block below has been updated with any user-facing changes (API changes, bug fixes, changes requiring upgrade notices or deprecation warnings)
  • Release notes contain the string "action required" if the change requires additional action from users switching to the new release

Release Notes

NONE

@tekton-robot
Copy link

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@tekton-robot tekton-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. release-note Denotes a PR that will be considered when it comes time to generate release notes. labels Mar 28, 2023
@tekton-robot tekton-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Mar 28, 2023
@tekton-robot tekton-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Mar 29, 2023
@tekton-robot tekton-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Apr 3, 2023
@sayan-biswas sayan-biswas changed the title e2e tests for REST Add e2e tests using gRPC and REST Apr 3, 2023
@tekton-robot tekton-robot added release-note-none Denotes a PR that doesnt merit a release note. and removed release-note Denotes a PR that will be considered when it comes time to generate release notes. labels Apr 3, 2023
@sayan-biswas
Copy link
Contributor Author

/kind misc

@tekton-robot tekton-robot added the kind/misc Categorizes issue or PR as a miscellaneuous one. label Apr 3, 2023
@sayan-biswas
Copy link
Contributor Author

/test all

@sayan-biswas
Copy link
Contributor Author

/test pull-tekton-results-build-tests

@sayan-biswas sayan-biswas marked this pull request as ready for review April 3, 2023 21:09
@tekton-robot tekton-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Apr 3, 2023
@sayan-biswas
Copy link
Contributor Author

/assign @adambkaplan

if err != nil {
return false, nil
t.Fatalf("Error getting TaskRun: %v", err)
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't we add return false, err here. Also line https://github.com/tektoncd/results/pull/418/files#diff-d5d12b6ea07b0a78c9ad1987e1486c565ecf16839f77a93e91b09475cf6c0e99R131 to be executed we should throw err I think.

Copy link
Contributor

Choose a reason for hiding this comment

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

This is now running inside a test function that has no return. t.Fatalf is the right thing to do.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the return statement of the callback function to PollImmediate. I guess calling t.Fatal() here would mark the test as failed before even waiting for the timeout.

if err != nil {
t.Logf("Get: %v", err)
return false, nil
t.Fatalf("Error getting PipelineRun: %v", err)
Copy link
Contributor

Choose a reason for hiding this comment

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

Same add return false, err

Copy link
Contributor

Choose a reason for hiding this comment

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

Ditto from above - we can't return any value here, and t.Fatalf stops the test.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the return statement of the callback function to PollImmediate. I guess calling t.Fatal() here would mark the test as failed before even waiting for the timeout.

test/e2e/e2e_test.go Show resolved Hide resolved
test/e2e/e2e_test.go Show resolved Hide resolved
config/base/default-clusterroles.yaml Outdated Show resolved Hide resolved
test/e2e/client/grpc.go Show resolved Hide resolved
test/e2e/kustomize/api-server.yaml Show resolved Hide resolved
test/e2e/e2e.sh Outdated
@@ -40,7 +40,7 @@ main() {

# Build static binaries; otherwise go test complains.
export CGO_ENABLED=0
go test -v -count=1 --tags=e2e ${REPO}/test/e2e/...
go test -v -count=1 --tags=e2e ${REPO}/test/e2e/e2e_test.go
Copy link
Contributor

Choose a reason for hiding this comment

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

Any particular reason why we should drive the test from the one file? This could lead to issues in the future if we define suites in different e2e test files.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have changed the behaviour to include all package in e2e directory.

Initially this was done because the test was failing as the client directory under e2e doesn't have any _test files. Now I have just excluded the client directory from go test, while still building the files in the client directory.

if err != nil {
return false, nil
t.Fatalf("Error getting TaskRun: %v", err)
Copy link
Contributor

Choose a reason for hiding this comment

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

This is now running inside a test function that has no return. t.Fatalf is the right thing to do.

if err != nil {
t.Logf("Get: %v", err)
return false, nil
t.Fatalf("Error getting PipelineRun: %v", err)
Copy link
Contributor

Choose a reason for hiding this comment

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

Ditto from above - we can't return any value here, and t.Fatalf stops the test.

@adambkaplan
Copy link
Contributor

/approve

Marking conditional approval so other contributors can add lgtm. The impersonation RBAC needs to be moved to our test overlay/kustomization, and I have a question about the tls hostname override. Otherwise looks good.

@tekton-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: adambkaplan

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 Apr 11, 2023
Add e2e test for ListRecords, ListResults, GetRecord, GetResult, DeleteRecord, DeleteResult, Authorization, Authentication and Impersonation using both gRPC and REST.
@adambkaplan
Copy link
Contributor

@tektoncd/results-collaborators this PR is ready for an LGTM review.

@adambkaplan
Copy link
Contributor

cc @tektoncd/results-maintainers

@sayan-biswas
Copy link
Contributor Author

@khrm @enarha This should be in the release, as features from this release and previous release are cover in these e2e tests.

@alan-ghelardi
Copy link
Contributor

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Apr 16, 2023
@tekton-robot tekton-robot merged commit b21a9a3 into tektoncd:main Apr 16, 2023
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-none Denotes a PR that doesnt merit a release note. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants