Skip to content

Commit

Permalink
Fix octopus fixture paths on windows (#19434)
Browse files Browse the repository at this point in the history
* fix octopus paths on windows

* fix long paths

* test

* fix
  • Loading branch information
sarah-witt authored Jan 17, 2025
1 parent ff15780 commit 6782bb7
Show file tree
Hide file tree
Showing 24 changed files with 12 additions and 5 deletions.
9 changes: 8 additions & 1 deletion octopus_deploy/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,17 @@ def method(method, url, file='response', headers=None, params=None):
param_string = ""
for key, val in params.items():
if type(val) is list:
val_string = ','.join(f'{str(val_item)}' for val_item in val)
if len(val) < 5:
val_string = ','.join(f'{str(val_item)}' for val_item in val)
else:
# don't use full list as the path is too long
val_string = '[]'
else:
val_string = str(val)
param_string += ("/" if param_string else "") + f'{key}={val_string}'
param_string = param_string.replace(':', '_')
param_string = param_string.replace('+00_00', '')
param_string = param_string.replace('2024-09-23 ', '')
request_path = '{}/{}'.format(url, param_string)
print(request_path)
response = responses_map.get(method, {}).get(request_path, {}).get(filename)
Expand Down
8 changes: 4 additions & 4 deletions octopus_deploy/tests/docker/Caddyfile
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
expression {query.project}.contains("Projects-1") && {query}.contains("fromCompletedDate") && {query}.contains("toCompletedDate")
}
route @get_completed_tasks_project_1 {
rewrite * "/GET/api/Spaces-1/tasks/name=Deploy/project=Projects-1/fromCompletedDate=2024-09-23 14:45:00.123000+00:00/toCompletedDate=2024-09-23 14:45:00.123000+00:00/skip=0/take=30/response.json"
rewrite * "/GET/api/Spaces-1/tasks/name=Deploy/project=Projects-1/fromCompletedDate=14_45_00.123000/toCompletedDate=14_45_00.123000/skip=0/take=30/response.json"
file_server
}
@get_completed_tasks_project_2 {
Expand All @@ -95,7 +95,7 @@
expression {query.project}.contains("Projects-2") && {query}.contains("fromCompletedDate") && {query}.contains("toCompletedDate")
}
route @get_completed_tasks_project_2 {
rewrite * "/GET/api/Spaces-1/tasks/name=Deploy/project=Projects-2/fromCompletedDate=2024-09-23 14:45:00.123000+00:00/toCompletedDate=2024-09-23 14:45:00.123000+00:00/skip=0/take=30/response.json"
rewrite * "/GET/api/Spaces-1/tasks/name=Deploy/project=Projects-2/fromCompletedDate=14_45_00.123000/toCompletedDate=14_45_00.123000/skip=0/take=30/response.json"
file_server
}
@get_completed_tasks_project_3 {
Expand All @@ -104,7 +104,7 @@
expression {query.project}.contains("Projects-3") && {query}.contains("fromCompletedDate") && {query}.contains("toCompletedDate")
}
route @get_completed_tasks_project_3 {
rewrite * "/GET/api/Spaces-1/tasks/name=Deploy/project=Projects-3/fromCompletedDate=2024-09-23 14:45:00.123000+00:00/toCompletedDate=2024-09-23 14:45:00.123000+00:00/skip=0/take=30/response.json"
rewrite * "/GET/api/Spaces-1/tasks/name=Deploy/project=Projects-3/fromCompletedDate=14_45_00.123000/toCompletedDate=14_45_00.123000/skip=0/take=30/response.json"
file_server
}
@get_completed_tasks_project_4 {
Expand All @@ -113,7 +113,7 @@
expression {query.project}.contains("Projects-4") && {query}.contains("fromCompletedDate") && {query}.contains("toCompletedDate")
}
route @get_completed_tasks_project_4 {
rewrite * "/GET/api/Spaces-1/tasks/name=Deploy/project=Projects-4/fromCompletedDate=2024-09-23 14:45:00.123000+00:00/toCompletedDate=2024-09-23 14:45:00.123000+00:00/skip=0/take=30/response.json"
rewrite * "/GET/api/Spaces-1/tasks/name=Deploy/project=Projects-4/fromCompletedDate=14_45_00.123000/toCompletedDate=14_45_00.123000/skip=0/take=30/response.json"
file_server
}
@get_octopusservernodes {
Expand Down

0 comments on commit 6782bb7

Please sign in to comment.