Dynatrace / dynatrace-configuration-as-code

This tool automates deployment of Dynatrace Configuration to one or multiple Dynatrace environments.
https://docs.dynatrace.com/docs/manage/configuration-as-code/monaco
Apache License 2.0
164 stars 94 forks source link

Fix: Better name parameter validation #1530

Closed warber closed 3 months ago

warber commented 3 months ago

What this PR does / Why we need it:

This, PR contains a quick fix for validating name parameters of classic configs. First, we try to resolve the name parameters and compare their values. If resolving the paramters didn't work (because of missing resolved entities) we check if both parameters are reference parameters and assume that they will resolve to the same name if they look exactly the same. The same check is also done if both paramters are of type "compoundParameter".

Note that this check misses the situation where compound parameters point to local reference parameters that resolves to different values tho. There is a test case which should cover this case. Currently it is skipped. https://github.com/Dynatrace/dynatrace-configuration-as-code/pull/1530/files#diff-12f7b59badc043a408921cbc6e7416edc7623283f022bb7971b7f9ae5d18305bR218

Special notes for your reviewer:

Does this PR introduce a user-facing change?

github-actions[bot] commented 3 months ago

Unit Test Results

1 892 tests  +9   1 891 :white_check_mark: +8   27s :stopwatch: -1s   133 suites ±0       1 :zzz: +1      1 files   ±0       0 :x: ±0 

Results for commit f1fd459f. ± Comparison against base commit cf921cf4.

:recycle: This comment has been updated with latest results.

github-actions[bot] commented 3 months ago

E2E Test Results

    4 files   -  1    268 suites   - 133   23m 52s :stopwatch: - 40m 48s 2 002 tests + 5  2 001 :white_check_mark: +  5  1 :zzz: ±0  0 :x: ±0  2 104 runs   - 97  2 103 :white_check_mark:  -  97  1 :zzz: ±0  0 :x: ±0 

Results for commit cfd8ef77. ± Comparison against base commit d6deb222.

This pull request removes 2 and adds 7 tests. Note that renamed tests count towards both. ``` github.com/dynatrace/dynatrace-configuration-as-code/v2/cmd/monaco/integrationtest/v2 ‑ TestPaginationClassic github.com/dynatrace/dynatrace-configuration-as-code/v2/cmd/monaco/integrationtest/v2 ‑ TestPaginationPlatform ``` ``` github.com/dynatrace/dynatrace-configuration-as-code/v2/pkg/config/parameter/compound ‑ TestCompoundParameter_Equal github.com/dynatrace/dynatrace-configuration-as-code/v2/pkg/deploy/internal/classic ‑ TestValidate_ValidateCompundParameterName github.com/dynatrace/dynatrace-configuration-as-code/v2/pkg/deploy/internal/classic ‑ TestValidate_ValidateCompundParameterName/compound_resolves_to_different_values_-_no_error github.com/dynatrace/dynatrace-configuration-as-code/v2/pkg/deploy/internal/classic ‑ TestValidate_ValidateCompundParameterName/compound_resolves_to_same_name_-_error github.com/dynatrace/dynatrace-configuration-as-code/v2/pkg/deploy/internal/classic ‑ TestValidate_ValidateCompundParameterName/compound_resolves_to_same_name_-_error#01 github.com/dynatrace/dynatrace-configuration-as-code/v2/pkg/deploy/internal/classic ‑ TestValidate_ValidateCompundParameterName/reference_to_same_config_-_error github.com/dynatrace/dynatrace-configuration-as-code/v2/pkg/deploy/internal/classic ‑ TestValidate_ValidateCompundParameterName/reference_to_same_config_with_different_property_-_no_error ```
sonarcloud[bot] commented 3 months ago

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud