Skip to content

Commit a1e21c9

Browse files
authored
octavia-cli: undue skip_reset flag revert and update integration tests (#20093)
* Revert "Revert "octavia-cli: Added flag to control whether to reset the streams or not (#18337)"" This reverts commit da0d9a7. * Update octavia cli integration tests
1 parent 4bef54d commit a1e21c9

File tree

6 files changed

+19
-1
lines changed

6 files changed

+19
-1
lines changed

.pre-commit-config.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ repos:
3838
).?$
3939
4040
- repo: https://github.com/csachs/pyproject-flake8
41-
rev: v0.0.1a2.post1
41+
rev: v6.0.0
4242
hooks:
4343
- id: pyproject-flake8
4444
args: ["--config", "pyproject.toml"]

octavia-cli/integration_tests/configurations/connections/poke_to_pg/configuration.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ destination_configuration_path: TO_UPDATE_FROM_TEST
77
# EDIT THE CONFIGURATION BELOW!
88
configuration:
99
status: active # REQUIRED | string | Allowed values: active, inactive, deprecated
10+
skip_reset: false # OPTIONAL | boolean | Flag to check if the connection should be reset after a connection update
1011
namespace_definition: source # OPTIONAL | string | Allowed values: source, destination, customformat
1112
namespace_format: "${SOURCE_NAMESPACE}" # OPTIONAL | string | Used when namespaceDefinition is 'customformat'. If blank then behaves like namespaceDefinition = 'destination'. If "${SOURCE_NAMESPACE}" then behaves like namespaceDefinition = 'source'.
1213
prefix: "" # REQUIRED | Prefix that will be prepended to the name of each stream when it is written to the destination

octavia-cli/integration_tests/test_generate/expected_rendered_yaml/connection/expected_with_normalization.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ destination_configuration_path: destination_configuration_path
77
# EDIT THE CONFIGURATION BELOW!
88
configuration:
99
status: active # REQUIRED | string | Allowed values: active, inactive, deprecated
10+
skip_reset: false # OPTIONAL | boolean | Flag to check if the connection should be reset after a connection update
1011
namespace_definition: source # OPTIONAL | string | Allowed values: source, destination, customformat
1112
namespace_format: "${SOURCE_NAMESPACE}" # OPTIONAL | string | Used when namespaceDefinition is 'customformat'. If blank then behaves like namespaceDefinition = 'destination'. If "${SOURCE_NAMESPACE}" then behaves like namespaceDefinition = 'source'.
1213
prefix: "" # REQUIRED | Prefix that will be prepended to the name of each stream when it is written to the destination

octavia-cli/integration_tests/test_generate/expected_rendered_yaml/connection/expected_without_normalization.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ destination_configuration_path: destination_configuration_path
77
# EDIT THE CONFIGURATION BELOW!
88
configuration:
99
status: active # REQUIRED | string | Allowed values: active, inactive, deprecated
10+
skip_reset: false # OPTIONAL | boolean | Flag to check if the connection should be reset after a connection update
1011
namespace_definition: source # OPTIONAL | string | Allowed values: source, destination, customformat
1112
namespace_format: "${SOURCE_NAMESPACE}" # OPTIONAL | string | Used when namespaceDefinition is 'customformat'. If blank then behaves like namespaceDefinition = 'destination'. If "${SOURCE_NAMESPACE}" then behaves like namespaceDefinition = 'source'.
1213
prefix: "" # REQUIRED | Prefix that will be prepended to the name of each stream when it is written to the destination

octavia-cli/octavia_cli/apply/resources.py

+14
Original file line numberDiff line numberDiff line change
@@ -569,6 +569,10 @@ class Connection(BaseResource):
569569

570570
resource_type = "connection"
571571

572+
local_root_level_keys_to_remove_during_create = ["skip_reset"] # Remove these keys when sending a create request
573+
574+
local_root_level_keys_to_filter_out_for_comparison = ["skip_reset"] # Remote do not have these keys
575+
572576
remote_root_level_keys_to_filter_out_for_comparison = [
573577
"name",
574578
"source",
@@ -667,6 +671,8 @@ def create_payload(self) -> WebBackendConnectionCreate:
667671
self.configuration["operations"] = self._deserialize_operations(
668672
self.raw_configuration["configuration"]["operations"], OperationCreate
669673
)
674+
for k in self.local_root_level_keys_to_remove_during_create:
675+
self.configuration.pop(k, None)
670676
return WebBackendConnectionCreate(
671677
name=self.resource_name, source_id=self.source_id, destination_id=self.destination_id, **self.configuration
672678
)
@@ -794,6 +800,14 @@ def _check_for_legacy_raw_configuration_keys(self, raw_configuration):
794800
"These keys changed to source_configuration_path and destination_configuration_path in version > 0.39.18, please update your connection configuration to give path to source and destination configuration files or regenerate the connection",
795801
)
796802

803+
def _get_local_comparable_configuration(self) -> dict:
804+
comparable = {
805+
k: v
806+
for k, v in self.raw_configuration["configuration"].items()
807+
if k not in self.local_root_level_keys_to_filter_out_for_comparison
808+
}
809+
return comparable
810+
797811
def _get_remote_comparable_configuration(self) -> dict:
798812

799813
comparable = {

octavia-cli/octavia_cli/generate/templates/connection.yaml.j2

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ destination_configuration_path: {{ destination_configuration_path }}
77
# EDIT THE CONFIGURATION BELOW!
88
configuration:
99
status: active # REQUIRED | string | Allowed values: active, inactive, deprecated
10+
skip_reset: false # OPTIONAL | boolean | Flag to check if the connection should be reset after a connection update
1011
namespace_definition: source # OPTIONAL | string | Allowed values: source, destination, customformat
1112
namespace_format: "${SOURCE_NAMESPACE}" # OPTIONAL | string | Used when namespaceDefinition is 'customformat'. If blank then behaves like namespaceDefinition = 'destination'. If "${SOURCE_NAMESPACE}" then behaves like namespaceDefinition = 'source'.
1213
prefix: "" # REQUIRED | Prefix that will be prepended to the name of each stream when it is written to the destination

0 commit comments

Comments
 (0)