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

Test Gateway OAuth token renewal #14845

Merged
merged 10 commits into from
Jul 20, 2022
Merged

Test Gateway OAuth token renewal #14845

merged 10 commits into from
Jul 20, 2022

Conversation

VOID404
Copy link
Contributor

@VOID404 VOID404 commented Jul 19, 2022

Description

  • Add OAuth token expiration to mock app
  • Add OAuth token expiration test case
  • Correct mock service name parameterization in some test cases

Related issue(s)
#14654

VOID404 added 2 commits July 19, 2022 07:40
Flow that deauthorizes oauth token
Gateway should fetch new token and retry request
OAuth token can expire
@kyma-bot kyma-bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 19, 2022
@kyma-bot
Copy link
Contributor

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

@kyma-bot kyma-bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jul 19, 2022
VOID404 added 2 commits July 19, 2022 12:11
It was missing in some tests
@VOID404 VOID404 marked this pull request as ready for review July 19, 2022 10:27
@kyma-bot kyma-bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 19, 2022
ttl := defaultTokenTTL

if ttlStr := r.URL.Query().Get(tokenLifetime); ttlStr != "" {
ttlOrErr, err := time.ParseDuration(ttlStr)
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe parsedTTL? I assume it's not a TTL or error :D

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's a TTL or not, I don't know what the idiomatic name should be, parsedTTL sounds good

Copy link
Contributor Author

Choose a reason for hiding this comment

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

exp might be more approperiate, considering expires in is the oauth standard, not time to live

apiVersion: applicationconnector.kyma-project.io/v1alpha1
kind: Application
metadata:
name: manual
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd rather name it complex-cases or something like this. manual suggests that you run it by hand or somehow locally, not automatically in the pipeline

- displayName: oauth-short
name: oauth-short
providerDisplayName: Kyma
description: Valid oauth configuration with 5s token
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe Should renew the OAuth token after the expiration time?

labels:
app: manual-tests
services:
- displayName: oauth-short
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe oauth-expired-token-renewal?

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 was thinking this might be generic for all tests requiring a token with short expire time, but sure, that makes sense too


func (gs *GatewaySuite) TestManual() {
gs.Run("OAuth token renewal", func() {
url := gatewayURL("manual", "oauth-short") + "/ok"
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we can move the + "/ok" part to the Application CR

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 am guessing different endpoints might be needed for different manual tests, but we can change it when we get there and leave it precise (with /ok endpoint) for now

@VOID404 VOID404 requested a review from franpog859 July 20, 2022 10:12
@kyma-bot kyma-bot added the lgtm Looks good to me! label Jul 20, 2022
@kyma-bot
Copy link
Contributor

@VOID404: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pre-main-kyma-integration-k3d-app-conn-validator 8229e14 link false /test pre-main-kyma-integration-k3d-app-conn-validator
pre-main-kyma-integration-k3d-runtime-agent 8229e14 link false /test pre-main-kyma-integration-k3d-runtime-agent

Full PR test history. Your PR dashboard.

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. I understand the commands that are listed here.

@kyma-bot kyma-bot merged commit ffd2670 into kyma-project:main Jul 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm Looks good to me! 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.

3 participants