A few things first:
I would suggest not using the -lnodes format of requesting a job. This is a very old selection format that has not been used in about 10 years. Use the new select/place format. It is much more robust. The conversion of -lnodes=1:ppn=8 is -lselect=1:ncpus=8 -lplace=scatter.
Following that, the flag=h on the resource means that the resource only belongs in the select statement. This is incompatible with a server_dyn_res. A server_dyn_res should have no flags. It’s for job wide resources. If you want select/node level resources, look into using a mom periodic hook to send these resources to the server for the scheduler to use.
One more thing, The option to request resources is -l (little ell), not cap L.
So with all that taken into account, I think you did the right thing in the wrong order. You need to request -lmy_test_var=500. This didn’t work for you in the beginning because you didn’t have my_test_var in the sched_config resources line. You did add my_test_var to the resources line later on, but didn’t try this request again.
I hope this helps,
Bhroam