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 support for restricted_roles in synthetics and add additional readOnly fields #153

Merged
merged 1 commit into from
Jul 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 14 additions & 8 deletions datadog_sync/model/synthetics_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,22 @@ class SyntheticsTests(BaseResource):
"synthetics_tests": ["steps.params.subtestPublicId"],
"synthetics_private_locations": ["locations"],
"synthetics_global_variables": ["config.configVariables.id"],
"roles": ["options.restricted_roles"],
},
base_path="/api/v1/synthetics/tests",
excluded_attributes=["deleted_at", "org_id", "public_id", "monitor_id", "modified_at", "created_at", "creator"],
excluded_attributes_re=[
"updatedAt",
"notify_audit",
"locked",
"include_tags",
"new_host_delay",
"notify_no_data",
excluded_attributes=[
"deleted_at",
"org_id",
"public_id",
"monitor_id",
"modified_at",
"created_at",
"creator",
"created_by",
"modified_by",
"overall_state",
"overall_state_modified",
"stepCount",
],
)
# Additional SyntheticsTests specific attributes
Expand Down
1 change: 0 additions & 1 deletion datadog_sync/utils/base_resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ class ResourceConfig:
resource_connections: Optional[Dict[str, List[str]]] = None
non_nullable_attr: Optional[List[str]] = None
excluded_attributes: Optional[List[str]] = None
excluded_attributes_re: Optional[List[str]] = None
concurrent: bool = True
source_resources: dict = field(default_factory=dict)
destination_resources: dict = field(default_factory=dict)
Expand Down
1 change: 0 additions & 1 deletion datadog_sync/utils/resource_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ def check_diff(resource_config, resource, state):
state,
ignore_order=True,
exclude_paths=resource_config.excluded_attributes,
exclude_regex_paths=resource_config.excluded_attributes_re,
)


Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2023-05-03T13:03:39.945490-04:00
2023-07-13T11:45:13.357791-04:00
2,169 changes: 1,025 additions & 1,144 deletions tests/integration/cassettes/test_cli/TestCli.test_cleanup.yaml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1 +1 @@
2023-05-03T13:02:51.436026-04:00
2023-07-13T11:44:26.267672-04:00
2,980 changes: 1,701 additions & 1,279 deletions tests/integration/cassettes/test_cli/TestCli.test_import.yaml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1 +1 @@
2023-05-03T13:02:56.036879-04:00
2023-07-13T11:44:30.260569-04:00
3,835 changes: 1,860 additions & 1,975 deletions tests/integration/cassettes/test_cli/TestCli.test_sync.yaml

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

16 changes: 16 additions & 0 deletions tests/integration/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,22 @@ def test_cleanup(self, runner):
"--skip-failed-resource-connections=False",
],
)
if ret.exit_code != 0:
# Retry cleanup if there was an error on the previous run.
# We currently do not build a graph for cleanup hence we run into situations where
# we attemp to delete resources before its usage areas are cleanup.
# E.g. synthetics global variable is attempted to be deleted before the
# synthetics test using it.
ret = runner.invoke(
cli,
[
"sync",
"--validate=false",
f"--resources={self.resources}",
"--cleanup=force",
"--skip-failed-resource-connections=False",
],
)
assert not ret.output
assert 0 == ret.exit_code

Expand Down