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

feat(segments): deploy support for segments API #1660

Open
wants to merge 20 commits into
base: main
Choose a base branch
from
Open

Conversation

tomazpu
Copy link
Contributor

@tomazpu tomazpu commented Jan 2, 2025

What this PR does / Why we need it:

This PR adds support for the segments API in monaco.

Special notes for your reviewer:

Follow-up is planned to move the logic of adding uid and owner to the lib.

Does this PR introduce a user-facing change?

@tomazpu tomazpu added run-e2e-test Manually trigger the E2E tests for reviewed PRs release-notes This feature/fix should be mentioned in release notes labels Jan 2, 2025
@tomazpu tomazpu self-assigned this Jan 2, 2025
@tomazpu tomazpu requested a review from a team as a code owner January 2, 2025 13:28
Copy link

github-actions bot commented Jan 2, 2025

E2E Test Results

    4 files   -   1    272 suites   - 132   33s ⏱️ - 1h 12m 2s
1 419 tests  - 643  1 418 ✅  - 642  0 💤  - 2   1 ❌ + 1 
1 505 runs   - 833  1 446 ✅  - 890  0 💤  - 2  59 ❌ +59 

For more details on these failures, see this check.

Results for commit 4c12790. ± Comparison against base commit 74698e1.

This pull request removes 644 and adds 1 tests. Note that renamed tests count towards both.
github.com/dynatrace/dynatrace-configuration-as-code/v2/cmd/monaco/account ‑ TestLoadResources
github.com/dynatrace/dynatrace-configuration-as-code/v2/cmd/monaco/account ‑ TestLoadResources_Duplicates
github.com/dynatrace/dynatrace-configuration-as-code/v2/cmd/monaco/account ‑ TestLoadResources_Duplicates/Load_Resources_-_duplicate_group
github.com/dynatrace/dynatrace-configuration-as-code/v2/cmd/monaco/account ‑ TestLoadResources_Duplicates/Load_Resources_-_duplicate_policy
github.com/dynatrace/dynatrace-configuration-as-code/v2/cmd/monaco/account ‑ TestLoadResources_Duplicates/Load_Resources_-_duplicate_user
github.com/dynatrace/dynatrace-configuration-as-code/v2/cmd/monaco/deploy ‑ Test_DoDeploy
github.com/dynatrace/dynatrace-configuration-as-code/v2/cmd/monaco/deploy ‑ Test_DoDeploy/Wrong_environment_group
github.com/dynatrace/dynatrace-configuration-as-code/v2/cmd/monaco/deploy ‑ Test_DoDeploy/Wrong_environment_name
github.com/dynatrace/dynatrace-configuration-as-code/v2/cmd/monaco/deploy ‑ Test_DoDeploy/Wrong_project_name
github.com/dynatrace/dynatrace-configuration-as-code/v2/cmd/monaco/deploy ‑ Test_DoDeploy/correct_parameters
…
TestMain

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented Jan 2, 2025

Unit Test Results

1 985 tests  +13   1 984 ✅ +13   54s ⏱️ ±0s
  136 suites + 1       1 💤 ± 0 
    1 files   ± 0       0 ❌ ± 0 

Results for commit 2d7baa2. ± Comparison against base commit 5beebaf.

This pull request removes 4 and adds 17 tests. Note that renamed tests count towards both.
github.com/dynatrace/dynatrace-configuration-as-code/v2/pkg/delete ‑ TestDeleteAll_Segments/FF_is_turned_off
github.com/dynatrace/dynatrace-configuration-as-code/v2/pkg/delete ‑ TestDeleteAll_Segments/simple_case
github.com/dynatrace/dynatrace-configuration-as-code/v2/pkg/delete ‑ TestDelete_Segments/simple_case
github.com/dynatrace/dynatrace-configuration-as-code/v2/pkg/delete ‑ TestDelete_Segments/simple_case_with_FF_turned_off
github.com/dynatrace/dynatrace-configuration-as-code/v2/pkg/delete ‑ TestDeleteAll_Segments/With_Disabled_Segment_FF
github.com/dynatrace/dynatrace-configuration-as-code/v2/pkg/delete ‑ TestDeleteAll_Segments/With_Enabled_Segment_FF
github.com/dynatrace/dynatrace-configuration-as-code/v2/pkg/delete ‑ TestDelete_Segments/With_Disabled_Segment_FF
github.com/dynatrace/dynatrace-configuration-as-code/v2/pkg/delete ‑ TestDelete_Segments/With_Enabled_Segment_FF
github.com/dynatrace/dynatrace-configuration-as-code/v2/pkg/deploy ‑ TestDeployConfigFF
github.com/dynatrace/dynatrace-configuration-as-code/v2/pkg/deploy ‑ TestDeployConfigFF/segments_FF_test_|_FF_Disabled
github.com/dynatrace/dynatrace-configuration-as-code/v2/pkg/deploy ‑ TestDeployConfigFF/segments_FF_test_|_FF_Enabled
github.com/dynatrace/dynatrace-configuration-as-code/v2/pkg/deploy ‑ TestDeployDryRun
github.com/dynatrace/dynatrace-configuration-as-code/v2/pkg/deploy ‑ TestDeployDryRun/dry-run
github.com/dynatrace/dynatrace-configuration-as-code/v2/pkg/deploy/internal/segment ‑ TestDeploy
…

♻️ This comment has been updated with latest results.

@tomazpu tomazpu marked this pull request as draft January 2, 2025 13:30
@tomazpu tomazpu force-pushed the feat/GFF/deploy branch 5 times, most recently from 05a94e6 to a3f5d09 Compare January 7, 2025 14:58
@tomazpu tomazpu marked this pull request as ready for review January 10, 2025 12:48
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.

Please double check your go-import-sort settings :)

pkg/deploy/internal/segment/segment.go Outdated Show resolved Hide resolved
pkg/deploy/internal/segment/segment.go Outdated Show resolved Hide resolved
pkg/deploy/internal/segment/segment.go Outdated Show resolved Hide resolved
pkg/deploy/internal/segment/segment.go Outdated Show resolved Hide resolved
pkg/deploy/internal/segment/segment_test.go Outdated Show resolved Hide resolved
pkg/deploy/deploy_test.go Outdated Show resolved Hide resolved
Laubi
Laubi previously approved these changes Jan 22, 2025
err := delete.Configs(context.TODO(), client.ClientSet{SegmentClient: &c}, given)
assert.NoError(t, err)
assert.True(t, c.called, "delete should have been called")
//DummyClient returns unimplemented error on every execution of any method
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we need to update this too:

Suggested change
//DummyClient returns unimplemented error on every execution of any method
// fakeClient returns unimplemented error on every execution of any method


err := delete.All(context.TODO(), client.ClientSet{SegmentClient: &c}, api.APIs{})
assert.NoError(t, err)
assert.True(t, c.called, "delete should have been called")
//Dummy client returns unimplemented error on every execution of any method
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
//Dummy client returns unimplemented error on every execution of any method
// fakeClient returns unimplemented error on every execution of any method


id, err := deployWithOriginObjectId(ctx, client, c, requestPayload)
if err != nil {
return entities.ResolvedEntity{}, fmt.Errorf("failed to deploy segment with externalId: %s : %w", externalId, err)
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this error message correct? Or should it reference originObjectId?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-notes This feature/fix should be mentioned in release notes run-e2e-test Manually trigger the E2E tests for reviewed PRs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants