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

Improve coverage of E2E tests #253

Merged
merged 3 commits into from
Oct 18, 2022

Conversation

alan-ghelardi
Copy link
Contributor

@alan-ghelardi alan-ghelardi commented Oct 13, 2022

Resolves #142.

What

  • Write E2E test cases for the changes introduced on
    Enhance the support for reading Results and Records across multiple collections #249. In addition, basic listing
    operations were covered.
  • Fix a bug in the authorization flow for the ListRecords operation. The parent
    passed to the Check method was incorrect and if one created a Role to restrict
    the access to a single namespace, the API server would always return an
    unauthenticated error. The fix is covered in a newlycreated E2E test case.
  • Pin Kubernetes v1.22 in the Kind config. By doing so, users may run newer
    versions of Kind and the tests will run on a cluster that uses a known
    Kubernetes version. Note that Knative no longer supports the Kubernetes version
    used by default in the Kind v0.10 (which is mentioned in the E2E documentation).

Additional information

There are two already existing E2E test cases failing consistently. I'm going to
open a new pull request to fix them to make changes more granular.

@tekton-robot tekton-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Oct 13, 2022
@tekton-robot
Copy link

Hi @alan-ghelardi. Thanks for your PR.

I'm waiting for a tektoncd member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@vdemeester
Copy link
Member

/ok-to-test

@tekton-robot tekton-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Oct 13, 2022
Copy link
Contributor

@adambkaplan adambkaplan left a comment

Choose a reason for hiding this comment

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

Thank you so much for this PR! This will definitely help get the ball rolling on having sustainable e2e tests. And ++1 for catching a bug in the process!

I have a few suggestions about the rbac.yaml that is deployed, and a question about the kind configuration yaml. The other suggestions regarding configuring the cert pair locations are optional - IMO those should not block merge and can be captured as a follow-up item.

test/e2e/kustomize/rbac.yaml Show resolved Hide resolved
test/e2e/kustomize/rbac.yaml Show resolved Hide resolved
test/e2e/kind-cluster.yaml Outdated Show resolved Hide resolved
set -e
kubectl create secret tls -n tekton-pipelines tekton-results-tls --cert="/tmp/tekton-results-cert.pem" --key="/tmp/tekton-results-key.pem" || true

echo "Installing Tekton Results..."
kubectl kustomize "${ROOT}/test/e2e/kustomize" | ko apply -f -

echo "Fetching access tokens..."
tokens_dir=/tmp/tekton-results/tokens
Copy link
Contributor

Choose a reason for hiding this comment

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

Ideally this can be a configuration option for the script. This can be addressed in a follow-up PR.

Comment on lines +35 to +36
-keyout "/tmp/tekton-results-key.pem" \
-out "/tmp/tekton-results-cert.pem" \
Copy link
Contributor

Choose a reason for hiding this comment

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

Future TODO - make the location of the keypair configurable.

Comment on lines +51 to +52
-keyout "/tmp/tekton-results-key.pem" \
-out "/tmp/tekton-results-cert.pem" \
Copy link
Contributor

Choose a reason for hiding this comment

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

Ditto - as a follow up, we should make this configurable.

)

const (
certFile = "/tmp/tekton-results-cert.pem"
Copy link
Contributor

Choose a reason for hiding this comment

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

If this path is made configurable, we would likely want to convert these constants to vars that live near a test main function.

Comment on lines +38 to +39
allNamespacesReadAccess = "/tmp/tekton-results/tokens/all-namespaces-read-access"
singleNamespaceReadAccess = "/tmp/tekton-results/tokens/single-namespace-read-access"
Copy link
Contributor

Choose a reason for hiding this comment

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

Likewise, when this is made configurable, we should move these constants near a test main.

@alan-ghelardi
Copy link
Contributor Author

/retest

@alan-ghelardi
Copy link
Contributor Author

@adambkaplan thank you for the review. I've accepted your suggestions and will make the tokens path configurable in a future pr.

Copy link
Contributor

@adambkaplan adambkaplan 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: 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 Oct 13, 2022
@alan-ghelardi
Copy link
Contributor Author

/assign dibyom

@dibyom
Copy link
Member

dibyom commented Oct 18, 2022

/lgtm

(Opened an issue to capture the TODOs around making the this a bit more configurable)

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Oct 18, 2022
@tekton-robot tekton-robot merged commit f4189f3 into tektoncd:main Oct 18, 2022
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.

/kind cleanup
We need this label for release as discussed in the last WG call.

@tekton-robot tekton-robot added the kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. label Feb 27, 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/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm Indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. 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.

Permission denied on Record operations for namespaced auth.
6 participants