File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change 26
26
AppDryRunInfo ,
27
27
CfgVal ,
28
28
InvalidRunConfigException ,
29
+ macros ,
29
30
NULL_RESOURCE ,
30
31
Resource ,
31
32
Role ,
@@ -114,6 +115,28 @@ def test_submit_workspace(self) -> None:
114
115
scheduler_mock .submit (app , cfg , workspace = "some_workspace" )
115
116
self .assertEqual (app .roles [0 ].image , "some_workspace" )
116
117
118
+ def test_metadata_macro_substitute (self ) -> None :
119
+ role = Role (
120
+ name = "sleep" ,
121
+ image = "" ,
122
+ entrypoint = "foo.sh" ,
123
+ metadata = {
124
+ "bridge" : {
125
+ "tier" : "${app_id}" ,
126
+ },
127
+ "packages" : ["foo" , "package_${app_id}" ],
128
+ },
129
+ )
130
+ values = macros .Values (
131
+ img_root = "" ,
132
+ app_id = "test_app" ,
133
+ replica_id = str (1 ),
134
+ rank0_env = "TORCHX_RANK0_HOST" ,
135
+ )
136
+ replica_role = values .apply (role )
137
+ self .assertEqual (replica_role .metadata ["bridge" ]["tier" ], "test_app" )
138
+ self .assertEqual (replica_role .metadata ["packages" ], ["foo" , "package_test_app" ])
139
+
117
140
def test_invalid_dryrun_cfg (self ) -> None :
118
141
scheduler_mock = SchedulerTest .MockScheduler ("test_session" )
119
142
app_mock = MagicMock ()
You can’t perform that action at this time.
0 commit comments