Skip to content

Commit

Permalink
fix unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
simar7 committed Aug 9, 2024
1 parent 116f122 commit 7a27ae0
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 22 deletions.
6 changes: 3 additions & 3 deletions pkg/compliance/spec/compliance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ func TestComplianceSpec_CheckIDs(t *testing.T) {
func TestComplianceSpec_LoadFromDiskBundle(t *testing.T) {

t.Run("load user specified spec from disk", func(t *testing.T) {
cs, err := spec.GetComplianceSpec(filepath.Join("@testdata", "testspec.yaml"), cache.RealCache{})
cs, err := spec.GetComplianceSpec(filepath.Join("@testdata", "testcache", "content", "specs", "compliance", "testspec.yaml"), cache.RealCache{})
require.NoError(t, err)
assert.Equal(t, spec.ComplianceSpec{Spec: iacTypes.Spec{
ID: "test-spec-1.2",
Expand All @@ -290,7 +290,7 @@ func TestComplianceSpec_LoadFromDiskBundle(t *testing.T) {

t.Run("load user specified spec from disk fails", func(t *testing.T) {
_, err := spec.GetComplianceSpec("@doesnotexist", cache.RealCache{})
assert.Contains(t, err.Error(), "no such file or directory")
assert.Contains(t, err.Error(), "error retrieving compliance spec from specified path")
})

t.Run("bundle does not exist", func(t *testing.T) {
Expand Down Expand Up @@ -331,7 +331,7 @@ func TestComplianceSpec_LoadFromDiskBundle(t *testing.T) {
return "does not exist"
},
})
assert.Contains(t, err.Error(), "no such file or directory")
assert.Contains(t, err.Error(), "error retrieving compliance spec from bundle testspec")
})

// TODO: Add check to cover spec yaml unmarshal failure
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ spec:
title: Test Spec
description: This is a test spec
version: "1.2"
platfrom: test
type: foo
relatedResources:
- https://www.google.ca
controls:
Expand Down
17 changes: 0 additions & 17 deletions pkg/compliance/spec/testdata/testspec.yaml

This file was deleted.

0 comments on commit 7a27ae0

Please sign in to comment.