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 and implement shared integration test host #8112

Merged
merged 1 commit into from
Dec 19, 2024

Conversation

rynowak
Copy link
Contributor

@rynowak rynowak commented Dec 9, 2024

Description

This change updates implements a shared (reusable) integration test host for the Radius control-plane services. The new integration test host enables us to do in-memory testing of UCP and dynamic-rp using a "full stack" approach.

This change is a significant refactor because the "glue" code in UCP had many points of divergence with the rest of our codebase. The following major changes are the bulk of the work:

  • Defining new types for configuration + options in UCP
  • Updating the UCP configuration file to match the format of other components

Type of change

  • This pull request is a minor refactor, code cleanup, test improvement, or other maintenance task and doesn't change the functionality of Radius (issue link optional).

Note: this is a pretty significant refactor, not a minor one 😆

Part of: #6688

Contributor checklist

Please verify that the PR meets the following requirements, where applicable:

  • An overview of proposed schema changes is included in a linked GitHub issue.
  • A design document PR is created in the design-notes repository, if new APIs are being introduced.
  • If applicable, design document has been reviewed and approved by Radius maintainers/approvers.
  • A PR for the samples repository is created, if existing samples are affected by the changes in this PR.
  • A PR for the documentation repository is created, if the changes in this PR affect the documentation or any user facing updates are made.
  • A PR for the recipes repository is created, if existing recipes are affected by the changes in this PR.

@rynowak rynowak requested review from a team as code owners December 9, 2024 22:57
@rynowak
Copy link
Contributor Author

rynowak commented Dec 9, 2024

Since this is a really big change, here's a suggested path for reviewers:

  1. Read through the UCP startup code

This has been significantly simplified. There were a few goals for this, which support integration-testing broadly.

  • Make the configuration-file the source of truth. Remove env-vars and other ways of doing things. Make the configuration-file consistent with our other components.
  • Make sure all of the state is constructed only once. This is the UCP options. This is also sometimes called a composition root.
  1. Read through the hello, world test for dynamic-rp

This uses the new integration-test hosting infrastructure. You'll notice that this code heavily uses the changes from step 1.

  1. Now look at the rest of the code. The previous bullet-points motivate the vast majority of the changes.

@rynowak rynowak force-pushed the udt-integration-testing branch from 3e7fd28 to 3a24e2e Compare December 10, 2024 00:04
@rynowak rynowak force-pushed the udt-integration-testing branch from 3a24e2e to a1b2e17 Compare December 10, 2024 00:26
@rynowak rynowak force-pushed the udt-integration-testing branch from a1b2e17 to b026be8 Compare December 10, 2024 19:37
@rynowak rynowak temporarily deployed to functional-tests December 11, 2024 20:08 — with GitHub Actions Inactive
@radius-functional-tests
Copy link

radius-functional-tests bot commented Dec 11, 2024

Radius functional test overview

🔍 Go to test action run

Name Value
Repository rynowak/radius
Commit ref b026be8
Unique ID func4c3a4a67ac
Image tag pr-func4c3a4a67ac
Click here to see the list of tools in the current test run
  • gotestsum 1.12.0
  • KinD: v0.20.0
  • Dapr:
  • Azure KeyVault CSI driver: 1.4.2
  • Azure Workload identity webhook: 1.3.0
  • Bicep recipe location ghcr.io/radius-project/dev/test/testrecipes/test-bicep-recipes/<name>:pr-func4c3a4a67ac
  • Terraform recipe location http://tf-module-server.radius-test-tf-module-server.svc.cluster.local/<name>.zip (in cluster)
  • applications-rp test image location: ghcr.io/radius-project/dev/applications-rp:pr-func4c3a4a67ac
  • dynamic-rp test image location: ghcr.io/radius-project/dev/dynamic-rp:pr-func4c3a4a67ac
  • controller test image location: ghcr.io/radius-project/dev/controller:pr-func4c3a4a67ac
  • ucp test image location: ghcr.io/radius-project/dev/ucpd:pr-func4c3a4a67ac
  • deployment-engine test image location: ghcr.io/radius-project/deployment-engine:latest

Test Status

⌛ Building Radius and pushing container images for functional tests...
✅ Container images build succeeded
⌛ Publishing Bicep Recipes for functional tests...
✅ Recipe publishing succeeded
⌛ Starting corerp-cloud functional tests...
⌛ Starting ucp-cloud functional tests...
✅ ucp-cloud functional tests succeeded
✅ corerp-cloud functional tests succeeded

pkg/armrpc/asyncoperation/worker/service.go Outdated Show resolved Hide resolved
pkg/dynamicrp/testhost/host.go Show resolved Hide resolved
pkg/recipes/controllerconfig/config.go Show resolved Hide resolved
pkg/ucp/backend/service.go Show resolved Hide resolved
typeSegments := id.TypeSegments()
if len(typeSegments) >= 2 && (strings.EqualFold(typeSegments[len(typeSegments)-1].Type, "operationstatuses") ||
strings.EqualFold(typeSegments[len(typeSegments)-1].Type, "operationresults")) {
strings.EqualFold(typeSegments[len(typeSegments)-1].Type, "operationresults") ||
strings.EqualFold(typeSegments[len(typeSegments)-1].Type, "operations")) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we handle calls to /operations endpoint?

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 don't understand the question, can you be more specific? I think the comments explain this pretty well already.

pkg/ucp/queue/inmemory/client.go Outdated Show resolved Hide resolved
pkg/ucp/testhost/host.go Show resolved Hide resolved
test/integrationtest/testhost/clients.go Outdated Show resolved Hide resolved
@radius-functional-tests
Copy link

radius-functional-tests bot commented Dec 11, 2024

Radius functional test overview

🔍 Go to test action run

Name Value
Repository rynowak/radius
Commit ref 8caadfd
Unique ID func6807a4696e
Image tag pr-func6807a4696e
Click here to see the list of tools in the current test run
  • gotestsum 1.12.0
  • KinD: v0.20.0
  • Dapr:
  • Azure KeyVault CSI driver: 1.4.2
  • Azure Workload identity webhook: 1.3.0
  • Bicep recipe location ghcr.io/radius-project/dev/test/testrecipes/test-bicep-recipes/<name>:pr-func6807a4696e
  • Terraform recipe location http://tf-module-server.radius-test-tf-module-server.svc.cluster.local/<name>.zip (in cluster)
  • applications-rp test image location: ghcr.io/radius-project/dev/applications-rp:pr-func6807a4696e
  • dynamic-rp test image location: ghcr.io/radius-project/dev/dynamic-rp:pr-func6807a4696e
  • controller test image location: ghcr.io/radius-project/dev/controller:pr-func6807a4696e
  • ucp test image location: ghcr.io/radius-project/dev/ucpd:pr-func6807a4696e
  • deployment-engine test image location: ghcr.io/radius-project/deployment-engine:latest

Test Status

⌛ Building Radius and pushing container images for functional tests...
✅ Container images build succeeded
⌛ Publishing Bicep Recipes for functional tests...
✅ Recipe publishing succeeded
⌛ Starting corerp-cloud functional tests...
⌛ Starting ucp-cloud functional tests...
✅ ucp-cloud functional tests succeeded
✅ corerp-cloud functional tests succeeded

@rynowak rynowak added the do-not-merge Don't merge this PR until open discussion items or isssues are complete label Dec 13, 2024
@rynowak
Copy link
Contributor Author

rynowak commented Dec 13, 2024

Note: we're pausing this work to clean up the database interface separately. I'll update this PR when it's ready for reviews.

@rynowak
Copy link
Contributor Author

rynowak commented Dec 18, 2024

FYI folks, this is going to get it a beeeeg rebase now 👍. Stay tuned ⌚⌚⌚⌚⌚⌚

Thanks for help reviewing the database and other layering changes.

/cc @ytimocin @kachawla @lakshmimsft

@rynowak rynowak force-pushed the udt-integration-testing branch from 8caadfd to a15b36c Compare December 18, 2024 22:23
Copy link

codecov bot commented Dec 18, 2024

Codecov Report

Attention: Patch coverage is 70.29096% with 194 lines in your changes missing coverage. Please review.

Project coverage is 59.88%. Comparing base (d87e854) to head (4f160db).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
pkg/server/asyncworker.go 0.00% 41 Missing ⚠️
pkg/ucp/testhost/host.go 74.28% 27 Missing ⚠️
pkg/ucp/options.go 47.61% 17 Missing and 5 partials ⚠️
pkg/ucp/frontend/api/server.go 0.00% 17 Missing ⚠️
pkg/components/testhost/clients.go 94.11% 8 Missing and 2 partials ⚠️
pkg/dynamicrp/backend/service.go 58.33% 6 Missing and 4 partials ⚠️
pkg/dynamicrp/options.go 0.00% 9 Missing and 1 partial ⚠️
pkg/ucp/config.go 0.00% 10 Missing ⚠️
pkg/components/testhost/host.go 84.48% 6 Missing and 3 partials ⚠️
pkg/armrpc/asyncoperation/worker/service.go 0.00% 8 Missing ⚠️
... and 7 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8112      +/-   ##
==========================================
+ Coverage   59.51%   59.88%   +0.36%     
==========================================
  Files         580      584       +4     
  Lines       39008    38939      -69     
==========================================
+ Hits        23216    23319     +103     
+ Misses      14079    13878     -201     
- Partials     1713     1742      +29     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@rynowak rynowak removed the do-not-merge Don't merge this PR until open discussion items or isssues are complete label Dec 18, 2024
@rynowak
Copy link
Contributor Author

rynowak commented Dec 18, 2024

I'm looking into the functional test failures. Likely I got something wrong in the configuration change.

@rynowak rynowak force-pushed the udt-integration-testing branch from a15b36c to 30e655e Compare December 18, 2024 23:01
@lakshmimsft
Copy link
Contributor

/LGTM

@rynowak rynowak temporarily deployed to functional-tests December 19, 2024 04:35 — with GitHub Actions Inactive
@radius-functional-tests
Copy link

radius-functional-tests bot commented Dec 19, 2024

Radius functional test overview

🔍 Go to test action run

Name Value
Repository rynowak/radius
Commit ref 30e655e
Unique ID func132b411980
Image tag pr-func132b411980
Click here to see the list of tools in the current test run
  • gotestsum 1.12.0
  • KinD: v0.20.0
  • Dapr:
  • Azure KeyVault CSI driver: 1.4.2
  • Azure Workload identity webhook: 1.3.0
  • Bicep recipe location ghcr.io/radius-project/dev/test/testrecipes/test-bicep-recipes/<name>:pr-func132b411980
  • Terraform recipe location http://tf-module-server.radius-test-tf-module-server.svc.cluster.local/<name>.zip (in cluster)
  • applications-rp test image location: ghcr.io/radius-project/dev/applications-rp:pr-func132b411980
  • dynamic-rp test image location: ghcr.io/radius-project/dev/dynamic-rp:pr-func132b411980
  • controller test image location: ghcr.io/radius-project/dev/controller:pr-func132b411980
  • ucp test image location: ghcr.io/radius-project/dev/ucpd:pr-func132b411980
  • deployment-engine test image location: ghcr.io/radius-project/deployment-engine:latest

Test Status

⌛ Building Radius and pushing container images for functional tests...
✅ Container images build succeeded
⌛ Publishing Bicep Recipes for functional tests...
✅ Recipe publishing succeeded
⌛ Starting ucp-cloud functional tests...
⌛ Starting corerp-cloud functional tests...
✅ ucp-cloud functional tests succeeded
✅ corerp-cloud functional tests succeeded

cmd/applications-rp/radius-self-hosted.yaml Show resolved Hide resolved
pkg/armrpc/asyncoperation/worker/service.go Show resolved Hide resolved
pkg/dynamicrp/backend/service.go Show resolved Hide resolved
pkg/dynamicrp/options.go Show resolved Hide resolved
pkg/server/asyncworker.go Show resolved Hide resolved
pkg/ucp/backend/service.go Show resolved Hide resolved
pkg/ucp/frontend/radius/routes.go Show resolved Hide resolved
This change updates implements a shared (reusable) integration test host for the Radius control-plane services. The new integration test host enables us to do in-memory testing of UCP and dynamic-rp using a "full stack" approach.

This change is a significant refactor because the "glue" code in UCP had many points of divergence with the rest of our codebase. The following major changes are the bulk of the work:

- Defining new types for configuration + options in UCP
- Updating the UCP configuration file to match the format of other components

Signed-off-by: Ryan Nowak <[email protected]>
@rynowak rynowak force-pushed the udt-integration-testing branch from 30e655e to 4f160db Compare December 19, 2024 17:19
@rynowak rynowak temporarily deployed to functional-tests December 19, 2024 17:33 — with GitHub Actions Inactive
@radius-functional-tests
Copy link

radius-functional-tests bot commented Dec 19, 2024

Radius functional test overview

🔍 Go to test action run

Name Value
Repository rynowak/radius
Commit ref 4f160db
Unique ID func4f053b73c8
Image tag pr-func4f053b73c8
Click here to see the list of tools in the current test run
  • gotestsum 1.12.0
  • KinD: v0.20.0
  • Dapr:
  • Azure KeyVault CSI driver: 1.4.2
  • Azure Workload identity webhook: 1.3.0
  • Bicep recipe location ghcr.io/radius-project/dev/test/testrecipes/test-bicep-recipes/<name>:pr-func4f053b73c8
  • Terraform recipe location http://tf-module-server.radius-test-tf-module-server.svc.cluster.local/<name>.zip (in cluster)
  • applications-rp test image location: ghcr.io/radius-project/dev/applications-rp:pr-func4f053b73c8
  • dynamic-rp test image location: ghcr.io/radius-project/dev/dynamic-rp:pr-func4f053b73c8
  • controller test image location: ghcr.io/radius-project/dev/controller:pr-func4f053b73c8
  • ucp test image location: ghcr.io/radius-project/dev/ucpd:pr-func4f053b73c8
  • deployment-engine test image location: ghcr.io/radius-project/deployment-engine:latest

Test Status

⌛ Building Radius and pushing container images for functional tests...
✅ Container images build succeeded
⌛ Publishing Bicep Recipes for functional tests...
✅ Recipe publishing succeeded
⌛ Starting corerp-cloud functional tests...
⌛ Starting ucp-cloud functional tests...
✅ ucp-cloud functional tests succeeded
✅ corerp-cloud functional tests succeeded

@rynowak rynowak merged commit 8632b60 into radius-project:main Dec 19, 2024
29 checks passed
@rynowak rynowak deleted the udt-integration-testing branch December 19, 2024 17:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants