Skip to content

Commit

Permalink
Merge branch 'main' into grapql-issue
Browse files Browse the repository at this point in the history
  • Loading branch information
doctrino authored Dec 11, 2024
2 parents bb54267 + 926a3a6 commit 169f28b
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.cdf-tk.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Changes are grouped as follows:
### Fixed

- Deploying `GraphQL` is no longer sensitive to the newlines inside of directives.
- Functions are no longer always redeployed if `indexUrl` or `extraIndexUrls` are set in the `Function` resource.

## [0.3.21] - 2024-12-11

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,10 @@ def _are_equal(
local_dumped["metadata"][self._MetadataKey.secret_hash] = calculate_secure_hash(local_dumped["secrets"])
local_dumped["secrets"] = {k: "***" for k in local_dumped["secrets"]}

# Only in write (request) format of the function
local_dumped.pop("indexUrl", None)
local_dumped.pop("extraIndexUrls", None)

return self._return_are_equal(local_dumped, cdf_dumped, return_dumped)

def _is_activated(self, action: str) -> bool:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@
runtime: 'py311'
functionPath: './src/handler.py'
# Data set id for the zip file with the code that is uploaded.
dataSetExternalId: 'ds_timeseries_{{example_variable}}'
dataSetExternalId: 'ds_timeseries_{{example_variable}}'
indexUrl: https://pypi.org/simple
21 changes: 21 additions & 0 deletions tests/test_unit/test_cdf_tk/test_loaders/test_function_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,24 @@ def test_are_equals_secret_changing(self, cdf_tool_mock: CDFToolConfig, tmp_path
"secret1": "value1",
"secret2": "value2",
}, "Original object should not be modified"

def test_are_equals_index_url_set(self, cdf_tool_mock: CDFToolConfig, tmp_path: Path) -> None:
local_function = FunctionWrite(
name="my_function",
file_id=123,
external_id="my_function",
index_url="http://my-index-url",
)
cdf_function = Function(
name="my_function",
file_id=123,
external_id="my_function",
metadata={
FunctionLoader._MetadataKey.function_hash: calculate_directory_hash(tmp_path / "my_function"),
},
)
loader = FunctionLoader.create_loader(cdf_tool_mock, tmp_path)

are_equal = loader.are_equal(local_function, cdf_function, return_dumped=False)

assert are_equal is True
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ Function:
externalId: fn_first_function
fileId: -1
functionPath: ./src/handler.py
indexUrl: https://pypi.org/simple
metadata:
cdf-toolkit-function-hash: a63720560f48030aaf994e92b02b1de1932514aa79b3115ced9d65fba8440aff
cdf-toolkit-secret-hash: d218376a8813e2bb96b70b9f3df07157b0b58f18f3667c64e500032095f4f2cb0f1679ed7034189009131ce2e77cc363d840b478d94d8525cad7d9830a78e129
Expand Down

0 comments on commit 169f28b

Please sign in to comment.