@@ -404,7 +404,7 @@ func Test_operatorMetrics_Collect(t *testing.T) {
404404 },
405405 },
406406 {
407- name : "collects openshift-install info" ,
407+ name : "collects legacy openshift-install info" ,
408408 optr : & Operator {
409409 releaseVersion : "0.0.2" ,
410410 releaseImage : "test/image:1" ,
@@ -424,6 +424,54 @@ func Test_operatorMetrics_Collect(t *testing.T) {
424424 expectMetric (t , metrics [1 ], 1 , map [string ]string {"type" : "openshift-install" , "version" : "v0.0.2" , "invoker" : "jane" })
425425 },
426426 },
427+ {
428+ name : "collects openshift-install info" ,
429+ optr : & Operator {
430+ releaseVersion : "0.0.2" ,
431+ releaseImage : "test/image:1" ,
432+ releaseCreated : time .Unix (3 , 0 ),
433+ cmConfigLister : & cmConfigLister {
434+ Items : []* corev1.ConfigMap {
435+ {
436+ ObjectMeta : metav1.ObjectMeta {Name : "openshift-install" },
437+ Data : map [string ]string {"version" : "v0.0.2" , "invoker" : "jane" },
438+ },
439+ {
440+ ObjectMeta : metav1.ObjectMeta {Name : "openshift-install-manifests" },
441+ Data : map [string ]string {"version" : "v0.0.1" , "invoker" : "bill" },
442+ },
443+ },
444+ },
445+ },
446+ wants : func (t * testing.T , metrics []prometheus.Metric ) {
447+ if len (metrics ) != 2 {
448+ t .Fatalf ("Unexpected metrics %s" , spew .Sdump (metrics ))
449+ }
450+ expectMetric (t , metrics [0 ], 3 , map [string ]string {"type" : "current" , "version" : "0.0.2" , "image" : "test/image:1" })
451+ expectMetric (t , metrics [1 ], 1 , map [string ]string {"type" : "openshift-install" , "version" : "v0.0.2" , "invoker" : "jane" })
452+ },
453+ },
454+ {
455+ name : "collects openshift-install-manifests info" ,
456+ optr : & Operator {
457+ releaseVersion : "0.0.2" ,
458+ releaseImage : "test/image:1" ,
459+ releaseCreated : time .Unix (3 , 0 ),
460+ cmConfigLister : & cmConfigLister {
461+ Items : []* corev1.ConfigMap {{
462+ ObjectMeta : metav1.ObjectMeta {Name : "openshift-install-manifests" },
463+ Data : map [string ]string {"version" : "v0.0.1" , "invoker" : "bill" },
464+ }},
465+ },
466+ },
467+ wants : func (t * testing.T , metrics []prometheus.Metric ) {
468+ if len (metrics ) != 2 {
469+ t .Fatalf ("Unexpected metrics %s" , spew .Sdump (metrics ))
470+ }
471+ expectMetric (t , metrics [0 ], 3 , map [string ]string {"type" : "current" , "version" : "0.0.2" , "image" : "test/image:1" })
472+ expectMetric (t , metrics [1 ], 1 , map [string ]string {"type" : "other" , "version" : "v0.0.1" , "invoker" : "bill" })
473+ },
474+ },
427475 {
428476 name : "collects empty openshift-install info" ,
429477 optr : & Operator {
0 commit comments