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

Chore/simplify project by removing redundancy #1639

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jskelin
Copy link
Contributor

@jskelin jskelin commented Nov 26, 2024

What this PR does / Why we need it:

Special notes for your reviewer:

Does this PR introduce a user-facing change?

Copy link

github-actions bot commented Nov 26, 2024

Unit Test Results

1 900 tests  +2   1 899 ✅ +2   54s ⏱️ ±0s
  133 suites ±0       1 💤 ±0 
    1 files   ±0       0 ❌ ±0 

Results for commit 8dd6d57. ± Comparison against base commit e700e3e.

This pull request removes 3 and adds 5 tests. Note that renamed tests count towards both.
github.com/dynatrace/dynatrace-configuration-as-code/v2/pkg/project/v2 ‑ TestHasDependencyOn
github.com/dynatrace/dynatrace-configuration-as-code/v2/pkg/project/v2 ‑ TestHasDependencyOnShouldReturnFalseIfNoDependenciesForEnvironmentAreDefined
github.com/dynatrace/dynatrace-configuration-as-code/v2/pkg/project/v2 ‑ TestHasDependencyOnShouldReturnFalseIfNoDependencyDefined
github.com/dynatrace/dynatrace-configuration-as-code/v2/pkg/project/v2/sort/topologysort ‑ TestHasDependencyOn
github.com/dynatrace/dynatrace-configuration-as-code/v2/pkg/project/v2/sort/topologysort ‑ TestHasDependencyOn/negative_case
github.com/dynatrace/dynatrace-configuration-as-code/v2/pkg/project/v2/sort/topologysort ‑ TestHasDependencyOn/positive_case
github.com/dynatrace/dynatrace-configuration-as-code/v2/pkg/project/v2/sort/topologysort ‑ TestHasDependencyOnShouldReturnFalseIfNoDependenciesForEnvironmentAreDefined
github.com/dynatrace/dynatrace-configuration-as-code/v2/pkg/project/v2/sort/topologysort ‑ TestHasDependencyOnShouldReturnFalseIfNoDependencyDefined

♻️ This comment has been updated with latest results.

@jskelin jskelin added the run-e2e-test Manually trigger the E2E tests for reviewed PRs label Nov 26, 2024
Copy link

E2E Test Results

    4 files   -   1    268 suites   - 133   30m 7s ⏱️ - 37m 21s
2 013 tests ±  0  2 011 ✅ ±  0  2 💤 ±0  0 ❌ ±0 
2 128 runs   - 115  2 126 ✅  - 115  2 💤 ±0  0 ❌ ±0 

Results for commit f0819f2. ± Comparison against base commit 8f7c2d9.

This pull request removes 2 and adds 2 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/project/v2 ‑ TestHasDependencyOn/negative_case
github.com/dynatrace/dynatrace-configuration-as-code/v2/pkg/project/v2 ‑ TestHasDependencyOn/positive_case

Copy link
Contributor

@Laubi Laubi left a comment

Choose a reason for hiding this comment

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

This PR is a hard reject from me. Apart from the no-go refactoring of HasDependencyOn, the rest of the changes are, in my opinion, not better, but make it more complicated and less performent.

I do agree, that there are some things we can do better, but we need to talk about them and plan them properly. There are some reasons why we do have some redundency.

for _, dep := range dependencies {
if dep == project.Id {
return true
for c := range slices.Values(p.ConfigList()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This method just went from a O(n) to an O(n^4) (O(n^2) from ConfigList) + O(n^2) from this method).
Furthermore, in ConfigList we do collect the configs now on every call, just to find the dependencies. This is an intended redundency so that other parts of Monaco work in a timely manner. We took much time to optimize this method (and the whole topology sort) to what it is today to optimize it.

This refactoring here is not acceptable, and must not be done.

@jskelin jskelin force-pushed the chore/simplify_Project branch from f0819f2 to 072174d Compare December 3, 2024 21:48
@jskelin jskelin force-pushed the chore/simplify_Project branch from 072174d to 8dd6d57 Compare December 3, 2024 22:43
Copy link

sonarqubecloud bot commented Dec 3, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
run-e2e-test Manually trigger the E2E tests for reviewed PRs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants