File tree Expand file tree Collapse file tree 2 files changed +36
-0
lines changed Expand file tree Collapse file tree 2 files changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -211,6 +211,20 @@ def get_job_doc_url(
211
211
return doc_url
212
212
213
213
214
+ def get_pull_secret_names (job_definition : Dict [str , Any ]) -> Set [str ]:
215
+ """ "Given a Job definition this function returns the unique list of the
216
+ pull-secrets declared.
217
+ """
218
+ names : Set [str ] = set ()
219
+
220
+ # Check the environment block...
221
+ pull_secret : Optional [str ] = job_definition .get ("image" , {}).get ("pull-secret" )
222
+ if pull_secret :
223
+ names .add (pull_secret )
224
+
225
+ return names
226
+
227
+
214
228
def get_asset_names (job_definition : Dict [str , Any ]) -> Set [str ]:
215
229
""" "Given a Job definition this function returns the unique list of all the
216
230
asset names declared. Asset names can be used in image environment
Original file line number Diff line number Diff line change
1
+ # Tests for the decoder's get_job_doc_url() function.
2
+ from typing import Dict
3
+
4
+ import pytest
5
+
6
+ pytestmark = pytest .mark .unit
7
+
8
+ from decoder import decoder
9
+
10
+
11
+ def test_get_asset_names ():
12
+ # Arrange
13
+ job_definition : Dict = {
14
+ "image" : {"pull-secret" : "secret-a" },
15
+ }
16
+
17
+ # Act
18
+ secret_names = decoder .get_pull_secret_names (job_definition )
19
+
20
+ # Assert
21
+ assert len (secret_names ) == 1
22
+ assert "secret-a" in secret_names
You can’t perform that action at this time.
0 commit comments