@@ -389,3 +389,80 @@ def test_fom_validation_fails_with_none():
389389
390390 with pytest .raises (jsonschema .exceptions .ValidationError ):
391391 validate_data (bad_fom , schema )
392+
393+
394+ @pytest .mark .parametrize (
395+ "contexts,expected_node_type" ,
396+ [
397+ (
398+ [
399+ {
400+ "foms" : [
401+ {"name" : "machine-type" , "value" : "c2-standard-60" },
402+ {
403+ "name" : "Model name" ,
404+ "value" : "Intel(R) Xeon(R) Gold 6268CL CPU @ 2.80GHz" ,
405+ },
406+ ]
407+ }
408+ ],
409+ "c2-standard-60" ,
410+ ),
411+ (
412+ [
413+ {
414+ "foms" : [
415+ {
416+ "name" : "Model name" ,
417+ "value" : "Intel(R) Xeon(R) Gold 6268CL CPU @ 2.80GHz" ,
418+ },
419+ {"name" : "machine-type" , "value" : "c2-standard-60" },
420+ ]
421+ }
422+ ],
423+ "c2-standard-60" ,
424+ ),
425+ (
426+ [
427+ {"foms" : [{"name" : "machine-type" , "value" : "c2-standard-60" }]},
428+ {
429+ "foms" : [
430+ {
431+ "name" : "Model name" ,
432+ "value" : "Intel(R) Xeon(R) Gold 6268CL CPU @ 2.80GHz" ,
433+ }
434+ ]
435+ },
436+ ],
437+ "c2-standard-60" ,
438+ ),
439+ (
440+ [
441+ {
442+ "foms" : [
443+ {
444+ "name" : "Model name" ,
445+ "value" : "Intel(R) Xeon(R) Gold 6268CL CPU @ 2.80GHz" ,
446+ }
447+ ]
448+ }
449+ ],
450+ "Intel(R) Xeon(R) Gold 6268CL CPU @ 2.80GHz" ,
451+ ),
452+ (
453+ [{"foms" : [{"name" : "other_fom" , "value" : "123" }]}],
454+ ramble .uploader .default_node_type_val ,
455+ ),
456+ ],
457+ )
458+ def test_determine_node_type (contexts , expected_node_type ):
459+ """Test that determine_node_type prioritizes machine-type
460+ over Model name regardless of order.
461+ """
462+ import types
463+
464+ from ramble .uploader import default_node_type_val , determine_node_type
465+
466+ exp = types .SimpleNamespace (node_type = default_node_type_val )
467+ determine_node_type (exp , contexts )
468+ assert exp .node_type == expected_node_type
0 commit comments