Skip to content

Commit

Permalink
Fix golangci-lint errors in test file due to Errorf() without format …
Browse files Browse the repository at this point in the history
…string

Signed-off-by: Matt Rutkowski <[email protected]>
  • Loading branch information
mrutkows committed Nov 7, 2024
1 parent 5d7139e commit 0bf3394
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions cmd/license_policy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ func TestLicensePolicyUsageConjunctionsANDCombinations(t *testing.T) {
EXPECTED_USAGE_POLICY = schema.POLICY_DENY
parsedExpression, err = schema.ParseExpression(testPolicyConfig, EXP)
if err != nil {
t.Errorf(err.Error())
t.Error(err.Error())
}
resolvedPolicy = parsedExpression.CompoundUsagePolicy
if resolvedPolicy != EXPECTED_USAGE_POLICY {
Expand All @@ -189,7 +189,7 @@ func TestLicensePolicyUsageConjunctionsANDCombinations(t *testing.T) {
EXPECTED_USAGE_POLICY = schema.POLICY_NEEDS_REVIEW
parsedExpression, err = schema.ParseExpression(testPolicyConfig, EXP)
if err != nil {
t.Errorf(err.Error())
t.Error(err.Error())
}
resolvedPolicy = parsedExpression.CompoundUsagePolicy
if resolvedPolicy != EXPECTED_USAGE_POLICY {
Expand All @@ -201,7 +201,7 @@ func TestLicensePolicyUsageConjunctionsANDCombinations(t *testing.T) {
EXPECTED_USAGE_POLICY = schema.POLICY_NEEDS_REVIEW
parsedExpression, err = schema.ParseExpression(testPolicyConfig, EXP)
if err != nil {
t.Errorf(err.Error())
t.Error(err.Error())
}
resolvedPolicy = parsedExpression.CompoundUsagePolicy
if resolvedPolicy != EXPECTED_USAGE_POLICY {
Expand All @@ -213,7 +213,7 @@ func TestLicensePolicyUsageConjunctionsANDCombinations(t *testing.T) {
EXPECTED_USAGE_POLICY = schema.POLICY_ALLOW
parsedExpression, err = schema.ParseExpression(testPolicyConfig, EXP)
if err != nil {
t.Errorf(err.Error())
t.Error(err.Error())
}
resolvedPolicy = parsedExpression.CompoundUsagePolicy
if resolvedPolicy != EXPECTED_USAGE_POLICY {
Expand All @@ -235,15 +235,15 @@ func TestLicensePolicyUsageConjunctionsORCombinations(t *testing.T) {
// Set the policy file to the reduced, 3-entry policy file used to test the 3 policy states
testPolicyConfig, err := LoadCustomPolicyFile(POLICY_FILE_GOOD_BAD_MAYBE)
if err != nil {
t.Errorf(err.Error())
t.Error(err.Error())
}

// 1. schema.POLICY_ALLOW OR schema.POLICY_DENY
EXP := "Good OR Bad"
EXPECTED_USAGE_POLICY := schema.POLICY_ALLOW
parsedExpression, err := schema.ParseExpression(testPolicyConfig, EXP)
if err != nil {
t.Errorf(err.Error())
t.Error(err.Error())
}
resolvedPolicy := parsedExpression.CompoundUsagePolicy
if resolvedPolicy != EXPECTED_USAGE_POLICY {
Expand All @@ -255,7 +255,7 @@ func TestLicensePolicyUsageConjunctionsORCombinations(t *testing.T) {
EXPECTED_USAGE_POLICY = schema.POLICY_ALLOW
parsedExpression, err = schema.ParseExpression(testPolicyConfig, EXP)
if err != nil {
t.Errorf(err.Error())
t.Error(err.Error())
}
resolvedPolicy = parsedExpression.CompoundUsagePolicy
if resolvedPolicy != EXPECTED_USAGE_POLICY {
Expand All @@ -267,7 +267,7 @@ func TestLicensePolicyUsageConjunctionsORCombinations(t *testing.T) {
EXPECTED_USAGE_POLICY = schema.POLICY_ALLOW
parsedExpression, err = schema.ParseExpression(testPolicyConfig, EXP)
if err != nil {
t.Errorf(err.Error())
t.Error(err.Error())
}
resolvedPolicy = parsedExpression.CompoundUsagePolicy
if resolvedPolicy != EXPECTED_USAGE_POLICY {
Expand All @@ -279,7 +279,7 @@ func TestLicensePolicyUsageConjunctionsORCombinations(t *testing.T) {
EXPECTED_USAGE_POLICY = schema.POLICY_NEEDS_REVIEW
parsedExpression, err = schema.ParseExpression(testPolicyConfig, EXP)
if err != nil {
t.Errorf(err.Error())
t.Error(err.Error())
}
resolvedPolicy = parsedExpression.CompoundUsagePolicy
if resolvedPolicy != EXPECTED_USAGE_POLICY {
Expand All @@ -291,7 +291,7 @@ func TestLicensePolicyUsageConjunctionsORCombinations(t *testing.T) {
EXPECTED_USAGE_POLICY = schema.POLICY_NEEDS_REVIEW
parsedExpression, err = schema.ParseExpression(testPolicyConfig, EXP)
if err != nil {
t.Errorf(err.Error())
t.Error(err.Error())
}
resolvedPolicy = parsedExpression.CompoundUsagePolicy
if resolvedPolicy != EXPECTED_USAGE_POLICY {
Expand All @@ -303,7 +303,7 @@ func TestLicensePolicyUsageConjunctionsORCombinations(t *testing.T) {
EXPECTED_USAGE_POLICY = schema.POLICY_DENY
parsedExpression, err = schema.ParseExpression(testPolicyConfig, EXP)
if err != nil {
t.Errorf(err.Error())
t.Error(err.Error())
}
resolvedPolicy = parsedExpression.CompoundUsagePolicy
if resolvedPolicy != EXPECTED_USAGE_POLICY {
Expand All @@ -323,7 +323,7 @@ func TestLicensePolicyFamilyUsagePolicyConflict(t *testing.T) {

// Note: the conflict is only encountered on the "hash"; load only loads what policies are defined in the config.
if err != nil {
t.Errorf(err.Error())
t.Error(err.Error())
}
}

Expand All @@ -334,7 +334,7 @@ func TestLicensePolicyCustomListGoodBadMaybe(t *testing.T) {
outputBuffer, err := innerTestLicensePolicyList(t, lti)

if err != nil {
t.Errorf(err.Error())
t.Error(err.Error())
return
}

Expand Down Expand Up @@ -695,7 +695,7 @@ func TestLicensePolicyMatchByExpFailureInvalidRightExp(t *testing.T) {
expressionTree, err := schema.ParseExpression(LicensePolicyConfig, EXP)

if err != nil {
t.Errorf(err.Error())
t.Error(err.Error())
}

getLogger().Tracef("Parsed expression:\n%v", expressionTree)
Expand All @@ -716,7 +716,7 @@ func TestLicensePolicyMatchByExpFailureInvalidLeftExp(t *testing.T) {
expressionTree, err := schema.ParseExpression(LicensePolicyConfig, EXP)

if err != nil {
t.Errorf(err.Error())
t.Error(err.Error())
}

getLogger().Tracef("Parsed expression:\n%v", expressionTree)
Expand All @@ -737,7 +737,7 @@ func TestLicensePolicyExpressionBSD3OrMIT(t *testing.T) {
expressionTree, err := schema.ParseExpression(LicensePolicyConfig, EXP)

if err != nil {
t.Errorf(err.Error())
t.Error(err.Error())
}

getLogger().Tracef("Parsed expression:\n%v", expressionTree)
Expand All @@ -759,7 +759,7 @@ func TestLicensePolicyExpressionMultipleConjunctions(t *testing.T) {
expressionTree, err := schema.ParseExpression(LicensePolicyConfig, EXP)

if err != nil {
t.Errorf(err.Error())
t.Error(err.Error())
}

getLogger().Tracef("Parsed expression:\n%v", expressionTree)
Expand All @@ -777,7 +777,7 @@ func TestLicensePolicyExpressionMultipleConjunctions(t *testing.T) {
expressionTree, err = schema.ParseExpression(LicensePolicyConfig, EXP)

if err != nil {
t.Errorf(err.Error())
t.Error(err.Error())
}

getLogger().Tracef("Parsed expression:\n%v", expressionTree)
Expand Down

0 comments on commit 0bf3394

Please sign in to comment.