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

Revisit Application Connector tests #13977

Closed
4 tasks done
Tracked by #15824
janmedrek opened this issue Apr 14, 2022 · 12 comments
Closed
4 tasks done
Tracked by #15824

Revisit Application Connector tests #13977

janmedrek opened this issue Apr 14, 2022 · 12 comments
Assignees
Labels
area/application-connector Issues or PRs related to application connectivity area/tests Issues or PRs related to tests Epic
Milestone

Comments

@janmedrek
Copy link
Contributor

janmedrek commented Apr 14, 2022

Description

We need to provide a clear suite of tests that will go through all the functionalities that Application Connector presents.
Right now we have multiple tests that run through the same scenario and test the same code.

The desired state would be to have:

  • a FIT scenario that goes through the whole flow available without Compass and testing available Application Gateway auth methods
    • called either from lambda via internal eventing (presents some coupling to the Serverless and Eventing area)
    • called from within a cluster with regular call
  • a FIT scenario that goes through Compass integration, tests the whole registration flow with Commerce Mock, sends an event through the mTLS gateway, and checks whether the external API of Commerce Mock can be called (make sure the cleanup is done properly in Compass)
  • A test checking the functionalities of Application Gateway (proxying, various auth methods available - we could introduce mocks here for checking different methods)
  • A test checking whether Applications are properly synchronized by the Compass Runtime Agent (we can use the static Compass tenant and just check if Compass Runtime Agent downloaded and applied the proper YAML)
  • A test checking Connectivity Validator functionality (consider using a static TLS certificate and just sending a request there)

ad 1) we have multiple Octopus tests in Go that should be removed as they are no longer used (#13338)
ad 2) we need to clean up old prow pipelines (#11870)

Reasons

A clear test structure and responsibility division will reduce maintenance effort and provide better quality for the area. It will be transparent which components fail and which require some attention.

Acceptance Criteria

  • Mentioned test cases implemented
  • Unnecessary tests removed
  • Testing should take minimal possible execution time
  • Tests implemented should be easily maintainable
@Disper
Copy link
Member

Disper commented Apr 14, 2022

This testing strategy draft documentation might be somehow relevant.

@janmedrek
Copy link
Contributor Author

I have updated the test cases - with the modularization on the horizon we want to make sure that tests for the Application Connector module are separated.

@VOID404
Copy link
Contributor

VOID404 commented Jun 7, 2022

Gateway Tests PR: #1450

@akgalwas
Copy link
Contributor

akgalwas commented Jun 7, 2022

The test project will be comprised of three test-suites:

  • Application Gateway
  • Connectivity Validator
  • Compass Runtime Agent

The following requirements were defined for the test project structure:

@akgalwas
Copy link
Contributor

akgalwas commented Jun 7, 2022

The general idea for testing Application Gateway is as follows:

  • There will be a simple Go application covering all supported authentication methods.
  • The test application will be deployed in the Kyma cluster and access Central Application Gateway via internal k8s service
  • Test will be comprised of the following:
    • Go application using go test
    • k8s manifests containing Applications CRDs, secrets and RBAC resources needed to execute test application in the k8s cluster
  • Test cases should be defined in Application CRD. There should be one service entry for each authentication method. We should strive to make code minimal.

Additional requirements:

  • In order to simplify design the test app should use the same secrets Application Gateway uses.
  • Test App should be configured with Config Map

Idea: test app could be a part of the test binary. It simplifies setup and allows to avoid the need for synchronising test and test app startup.

@akgalwas
Copy link
Contributor

akgalwas commented Jun 7, 2022

The general test-cases to cover in Application Gateway test-suite:

  • Authorisation related:
    • Positive authorisation for each method supported (BasicAuth, OAuth, etc.)
    • Authorisation failed for each method supported (BasicAuth, OAuth, etc.). Note: it needs to be discussed as from App Gateway perspective it is the same case as above.
    • OAuth specific: token renewal
  • Path related:
    • Application name and service name not provided in the path
    • Service name missing in the path
    • Path segments added to the target path. Example: there is an API under some URL (e.g. 'my-cool-api.com') registered in Application CRD. The user calls App Gateway URL and specifies a specific endpoint in the target API (e.g. central-application-gateway.kyma-integration:8080/<app>/<service>/some/endpoint). As a result the following URL is called: my-cool-api.com/some/endpoint
  • Kubernetes resources related:
    • Application name specified in the path doesn't exist
    • Service name specified in the path doesn't exist
    • Secret containing credentials doesn't exist
  • Proxying related:
    • Response code from target service returned
    • Response body from target service returned
    • Call to target API timeouts

@akgalwas
Copy link
Contributor

akgalwas commented Jun 7, 2022

Authorisation methods supported by Application Gateway:

  • no authorisation
  • Basic Auth
  • OAuth (grant client credentials flow)
  • OAuth protected with mTLS (please see Implement mtls oauth token fetch #14401)
  • mTLS (a.k.a CertGen)
  • CSRF with:
    • no authorisation
    • Basic Auth
    • OAuth (grant client credentials flow)
    • OAuth protected with mTLS
    • mTLS

In addition the following may be added by Application Gateway:

  • Additional headers
  • Additional query parameters

Note: mind that for CSRF the same authorisation method is used for target API and CSRF token endpoint.

@akgalwas
Copy link
Contributor

akgalwas commented Jun 7, 2022

Work plan:

@janmedrek
Copy link
Contributor Author

@VOID404, @mvshao please separate the following cases into linked GH issues:

  • Application Gateway tests + pipeline
  • Connectivity Validator tests + pipeline
  • Compass Runtime Agent tests + pipeline

You can also move the above comments from @akgalwas to those issues, and keep this one transparent as a collective epic for a new test suite for the whole area. 🙂

@franpog859
Copy link
Contributor

The Application Gateway tests are done, @janmedrek

@franpog859
Copy link
Contributor

I created a follow-up issue #15666 for this one #15037 as we wanted to first create an integration test that enables us to abandon the manual release testing and then enhance the tests with all of the additional CRA responsibilities checks

@franpog859 franpog859 modified the milestones: 2.8, Future Oct 13, 2022
@kyma-bot
Copy link
Contributor

This issue or PR has been automatically marked as stale due to the lack of recent activity.
Thank you for your contributions.

This bot triages issues and PRs according to the following rules:

  • After 60d of inactivity, lifecycle/stale is applied
  • After 7d of inactivity since lifecycle/stale was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle stale
  • Close this issue or PR with /close

If you think that I work incorrectly, kindly raise an issue with the problem.

/lifecycle stale

@kyma-bot kyma-bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Dec 12, 2022
@Disper Disper removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Dec 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/application-connector Issues or PRs related to application connectivity area/tests Issues or PRs related to tests Epic
Projects
None yet
Development

No branches or pull requests

7 participants