Skip to content

Commit 53f7387

Browse files
authored
fix: improve hc test (#24)
* fix: Improve hardcode images test
1 parent 5289d7c commit 53f7387

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

operator/operator-robot-image/robot/tests/image_tests/image_tests.robot

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,31 @@ Library String
66
Library Collections
77
Library PlatformLibrary managed_by_operator=%{RABBIT_IS_MANAGED_BY_OPERATOR}
88

9+
*** Keywords ***
10+
Get Image Tag
11+
[Arguments] ${image}
12+
${parts}= Split String ${image} :
13+
${length}= Get Length ${parts}
14+
Run Keyword If ${length} > 1 Return From Keyword ${parts[2]}
15+
Run Keywords
16+
... Log To Console \n[ERROR] Image ${parts} has no tag: ${image}\nMonitored images list: ${MONITORED_IMAGES}
17+
... AND Fail Some images were not found, please check your .helpers template and description.yaml in the repository
918

1019
*** Test Cases ***
1120
Test Hardcoded Images
1221
[Tags] all rabbitmq_images
1322
${stripped_resources}= Strip String ${MONITORED_IMAGES} characters=, mode=right
1423
@{list_resources} = Split String ${stripped_resources} ,
1524
FOR ${resource} IN @{list_resources}
16-
${type} ${name} ${container_name} ${image}= Split String ${resource}
25+
${type} ${name} ${container_name} ${image}= Split String ${resource}
1726
${resource_image}= Get Resource Image ${type} ${name} %{NAMESPACE} ${container_name}
18-
Should Be Equal ${resource_image} ${image}
19-
END
27+
28+
${expected_tag}= Get Image Tag ${image}
29+
${actual_tag}= Get Image Tag ${resource_image}
30+
31+
Log To Console \n[COMPARE] ${resource}: Expected tag = ${expected_tag}, Actual tag = ${actual_tag}
32+
33+
Run Keyword And Continue On Failure Should Be Equal ${actual_tag} ${expected_tag}
34+
35+
END
36+

0 commit comments

Comments
 (0)