@@ -814,6 +814,46 @@ func TestGetControlComplianceScore(t *testing.T) {
814814 )
815815 })
816816
817+ t .Run ("skipped control" , func (t * testing.T ) {
818+ t .Parallel ()
819+
820+ resources := mockResources (t )
821+ s := ScoreUtil {isDebugMode : true , resources : resources }
822+ controlReport := reportsummary.ControlSummary {
823+ Name : "skipped-control" ,
824+ ControlID : "skipped1" ,
825+ StatusInfo : apis.StatusInfo {
826+ InnerInfo : "enable-host-scan flag not used. For more information: https://hub.armosec.io/docs/host-sensor" ,
827+ InnerStatus : "skipped" ,
828+ },
829+ ResourceIDs : helpers.AllLists {},
830+ }
831+
832+ require .Equal (t , float32 (0 ), s .GetControlComplianceScore (& controlReport , "" ),
833+ "skipped control report should return a score equals to 0" ,
834+ )
835+ })
836+
837+ t .Run ("passed (irrelevant) control" , func (t * testing.T ) {
838+ t .Parallel ()
839+
840+ resources := mockResources (t )
841+ s := ScoreUtil {isDebugMode : true , resources : resources }
842+ controlReport := reportsummary.ControlSummary {
843+ Name : "irrelevant-control" ,
844+ ControlID : "irrelevant1" ,
845+ StatusInfo : apis.StatusInfo {
846+ SubStatus : "irrelevant" ,
847+ InnerStatus : "passed" ,
848+ },
849+ ResourceIDs : helpers.AllLists {},
850+ }
851+
852+ require .Equal (t , float32 (100 ), s .GetControlComplianceScore (& controlReport , "" ),
853+ "passed (irrelevant) control report should return a score equals to 100" ,
854+ )
855+ })
856+
817857 t .Run ("with control report" , func (t * testing.T ) {
818858 t .Parallel ()
819859
0 commit comments