diff --git a/management/server/policy.go b/management/server/policy.go index cc463b0bbd8..d3741539338 100644 --- a/management/server/policy.go +++ b/management/server/policy.go @@ -542,7 +542,7 @@ func (a *Account) validatePostureChecksOnPeer(sourcePostureChecksID []string, pe isValid, err := check.Check(*peer) if !isValid { if err != nil { - log.Debugf("an error occured check %s: on peer: %s :%s", check.Name(), peer.ID, err.Error()) + log.Debugf("an error occurred check %s: on peer: %s :%s", check.Name(), peer.ID, err.Error()) } return false } diff --git a/management/server/posture/version_test.go b/management/server/posture/version_test.go index c590fd2aeb3..de51c2283b1 100644 --- a/management/server/posture/version_test.go +++ b/management/server/posture/version_test.go @@ -14,6 +14,7 @@ func TestNBVersionCheck_Check(t *testing.T) { input peer.Peer check NBVersionCheck wantErr bool + isValid bool }{ { name: "Valid Peer NB version", @@ -26,6 +27,7 @@ func TestNBVersionCheck_Check(t *testing.T) { MinVersion: "1.0.0", }, wantErr: false, + isValid: true, }, { name: "Valid Peer NB version With No Patch Version 1", @@ -38,6 +40,7 @@ func TestNBVersionCheck_Check(t *testing.T) { MinVersion: "2.0", }, wantErr: false, + isValid: true, }, { name: "Valid Peer NB version With No Patch Version 2", @@ -50,6 +53,7 @@ func TestNBVersionCheck_Check(t *testing.T) { MinVersion: "2.0", }, wantErr: false, + isValid: true, }, { name: "Older Peer NB version", @@ -61,7 +65,8 @@ func TestNBVersionCheck_Check(t *testing.T) { check: NBVersionCheck{ MinVersion: "1.0.0", }, - wantErr: true, + wantErr: false, + isValid: false, }, { name: "Older Peer NB version With Patch Version", @@ -73,7 +78,8 @@ func TestNBVersionCheck_Check(t *testing.T) { check: NBVersionCheck{ MinVersion: "0.2", }, - wantErr: true, + wantErr: false, + isValid: false, }, { name: "Invalid Peer NB version", @@ -86,17 +92,19 @@ func TestNBVersionCheck_Check(t *testing.T) { MinVersion: "1.0.0", }, wantErr: true, + isValid: false, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - err := tt.check.Check(tt.input) + isValid, err := tt.check.Check(tt.input) if tt.wantErr { assert.Error(t, err) } else { assert.NoError(t, err) } + assert.Equal(t, tt.isValid, isValid) }) } }