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 more unit-tests to basemanifest renderer #6225

Merged
merged 4 commits into from
Sep 11, 2023
Merged

Conversation

youngbupark
Copy link

@youngbupark youngbupark commented Sep 6, 2023

Description

While preparing a demo, I found the bug which doesn't merge PodSpecTemplate's object metadata. This fixes this bug and add more unit-test for base manifest.

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).

Auto-generated summary

🤖 Generated by Copilot at 87d56a3

Summary

🛠️,🧪,🗑️,

This pull request refactors and tests the container package of the radius project. It removes unused code, adds utility functions for merging manifests, and adds test cases and fixtures for the rendering of container resources. It also modifies the makeDeployment function to use the new utility functions.

The container package got a makeover
With some functions to merge and take over
The ObjectMeta and LabelSelector
Of the base and the render
And some tests to check the output is proper

Walkthrough

  • Remove unused import and function from manifest.go (link, link)
  • Add utility functions for merging ObjectMeta and LabelSelector fields in util.go (link)
  • Use utility functions to merge base manifest with generated manifest in render.go (link)
  • Add import of json and testutil packages in render_test.go (link, link)
  • Add test function for rendering container resource with base manifest in render_test.go (link)
  • Add test functions for utility functions in util_test.go (link)
  • Add testdata files for base manifest input and output in JSON format (link, link, link, link)

@youngbupark youngbupark requested a review from rynowak September 6, 2023 12:29
@youngbupark youngbupark requested a review from a team as a code owner September 6, 2023 12:29
@github-actions
Copy link

github-actions bot commented Sep 6, 2023

Radius functional test overview

🔍 Go to test action run

Name Value
Repository radius-project/radius
Commit ref refs/pull/6225/merge
Unique ID b15cb80cb6
Image tag pr-b15cb80cb6
Click here to see the list of tools in the current test run
  • gotestsum 1.10.0
  • KinD: v0.20.0
  • Dapr: 1.11.0
  • Azure KeyVault CSI driver: 1.4.2
  • Azure Workload identity webhook: 1.1.0
  • Bicep recipe location radiusdev.azurecr.io/test/functional/shared/recipes/<name>:pr-b15cb80cb6
  • 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-b15cb80cb6
  • ucp test image location: ghcr.io/radius-project/dev/ucpd:pr-b15cb80cb6
  • deployment-engine test image location: radius.azurecr.io/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 datastoresrp functional tests...
⌛ Starting samples functional tests...
⌛ Starting ucp functional tests...
⌛ Starting daprrp functional tests...
⌛ Starting shared functional tests...
⌛ Starting msgrp functional tests...
✅ datastoresrp functional tests succeeded
✅ samples functional tests succeeded
✅ ucp functional tests succeeded
✅ msgrp functional tests succeeded
✅ daprrp functional tests succeeded
✅ shared functional tests succeeded

@github-actions
Copy link

github-actions bot commented Sep 6, 2023

Test Results

2 971 tests  +9   2 962 ✔️ +9   2m 8s ⏱️ -28s
   251 suites ±0          9 💤 ±0 
       1 files   ±0          0 ±0 

Results for commit b9b9e29. ± Comparison against base commit eaee260.

This pull request removes 2 and adds 11 tests. Note that renamed tests count towards both.
github.com/radius-project/radius/pkg/armrpc/frontend/controller ‑ TestValidateEtag_IfMatch/5ca647fb-2dc5-4757-8495-93021e955df2
github.com/radius-project/radius/pkg/armrpc/frontend/controller ‑ TestValidateEtag_IfMatch/5ca647fb-2dc5-4757-8495-93021e955df2#01
github.com/radius-project/radius/pkg/armrpc/frontend/controller ‑ TestValidateEtag_IfMatch/e601db4f-4745-4781-a0ea-1199a895547a
github.com/radius-project/radius/pkg/armrpc/frontend/controller ‑ TestValidateEtag_IfMatch/e601db4f-4745-4781-a0ea-1199a895547a#01
github.com/radius-project/radius/pkg/corerp/renderers/container ‑ TestMergeLabelSelector
github.com/radius-project/radius/pkg/corerp/renderers/container ‑ TestMergeLabelSelector/base_includes_matchLabels
github.com/radius-project/radius/pkg/corerp/renderers/container ‑ TestMergeLabelSelector/base_is_nil
github.com/radius-project/radius/pkg/corerp/renderers/container ‑ TestMergeObjectMeta
github.com/radius-project/radius/pkg/corerp/renderers/container ‑ TestMergeObjectMeta/base_is_empty
github.com/radius-project/radius/pkg/corerp/renderers/container ‑ TestMergeObjectMeta/override_name_and_namespace
github.com/radius-project/radius/pkg/corerp/renderers/container ‑ Test_Render_BaseManifest
github.com/radius-project/radius/pkg/corerp/renderers/container ‑ Test_Render_BaseManifest/inject_new_sidecar
…

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Sep 10, 2023

Radius functional test overview

🔍 Go to test action run

Name Value
Repository radius-project/radius
Commit ref refs/pull/6225/merge
Unique ID 71090a5248
Image tag pr-71090a5248
Click here to see the list of tools in the current test run
  • gotestsum 1.10.0
  • KinD: v0.20.0
  • Dapr: 1.11.0
  • Azure KeyVault CSI driver: 1.4.2
  • Azure Workload identity webhook: 1.1.0
  • Bicep recipe location radiusdev.azurecr.io/test/functional/shared/recipes/<name>:pr-71090a5248
  • 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-71090a5248
  • ucp test image location: ghcr.io/radius-project/dev/ucpd:pr-71090a5248
  • deployment-engine test image location: radius.azurecr.io/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 daprrp functional tests...
⌛ Starting samples functional tests...
⌛ Starting msgrp functional tests...
⌛ Starting shared functional tests...
⌛ Starting datastoresrp functional tests...
✅ ucp functional tests succeeded
✅ msgrp functional tests succeeded
✅ samples functional tests succeeded
✅ datastoresrp functional tests succeeded
✅ daprrp functional tests succeeded
✅ shared functional tests succeeded

@github-actions
Copy link

66.4

For the detailed report, please go to Checks tab, click Build and Test, and then download unit_test_coverage artifact at the bottom of build page.

  • Your PR branch coverage: 66.4 %
  • main branch coverage: 66.1 %
  • diff coverage: .3 %

The coverage result does not include the functional test coverage.

@youngbupark
Copy link
Author

youngbupark commented Sep 11, 2023

@rynowak Please review this PR and merge it if you approve it.

@github-actions
Copy link

github-actions bot commented Sep 11, 2023

Radius functional test overview

🔍 Go to test action run

Name Value
Repository radius-project/radius
Commit ref refs/pull/6225/merge
Unique ID 91875762ae
Image tag pr-91875762ae
Click here to see the list of tools in the current test run
  • gotestsum 1.10.0
  • KinD: v0.20.0
  • Dapr: 1.11.0
  • Azure KeyVault CSI driver: 1.4.2
  • Azure Workload identity webhook: 1.1.0
  • Bicep recipe location radiusdev.azurecr.io/test/functional/shared/recipes/<name>:pr-91875762ae
  • 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-91875762ae
  • ucp test image location: ghcr.io/radius-project/dev/ucpd:pr-91875762ae
  • deployment-engine test image location: radius.azurecr.io/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 datastoresrp functional tests...
⌛ Starting msgrp functional tests...
⌛ Starting ucp functional tests...
⌛ Starting daprrp functional tests...
⌛ Starting shared functional tests...
✅ datastoresrp functional tests succeeded
✅ msgrp functional tests succeeded
✅ ucp functional tests succeeded
✅ samples functional tests succeeded
✅ daprrp functional tests succeeded
✅ shared functional tests succeeded

@github-actions
Copy link

github-actions bot commented Sep 11, 2023

Radius functional test overview

🔍 Go to test action run

Name Value
Repository radius-project/radius
Commit ref refs/pull/6225/merge
Unique ID 6926e73d12
Image tag pr-6926e73d12
Click here to see the list of tools in the current test run
  • gotestsum 1.10.0
  • KinD: v0.20.0
  • Dapr: 1.11.0
  • Azure KeyVault CSI driver: 1.4.2
  • Azure Workload identity webhook: 1.1.0
  • Bicep recipe location radiusdev.azurecr.io/test/functional/shared/recipes/<name>:pr-6926e73d12
  • 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-6926e73d12
  • ucp test image location: ghcr.io/radius-project/dev/ucpd:pr-6926e73d12
  • deployment-engine test image location: radius.azurecr.io/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 datastoresrp functional tests...
⌛ Starting ucp functional tests...
⌛ Starting samples functional tests...
⌛ Starting daprrp functional tests...
⌛ Starting shared functional tests...
✅ datastoresrp functional tests succeeded
✅ ucp functional tests succeeded
✅ msgrp functional tests succeeded
✅ samples functional tests succeeded
✅ daprrp functional tests succeeded
✅ shared functional tests succeeded

@github-actions
Copy link

66.3

For the detailed report, please go to Checks tab, click Build and Test, and then download unit_test_coverage artifact at the bottom of build page.

  • Your PR branch coverage: 66.3 %
  • main branch coverage: 66.1 %
  • diff coverage: .2 %

The coverage result does not include the functional test coverage.

@rynowak rynowak merged commit c0cd383 into main Sep 11, 2023
27 checks passed
@rynowak rynowak deleted the youngp/add-basemanifest-ut branch September 11, 2023 15:57
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.

2 participants