Skip to content

Commit e0568dc

Browse files
committed
✨ test dependencies in lr files
Signed-off-by: Salim Afiune Maya <afiune@mondoo.com>
1 parent e1647fb commit e0568dc

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

providers-sdk/v1/lr/lr_test.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
package lr
55

66
import (
7+
"bytes"
78
"os"
89
"testing"
910

@@ -281,11 +282,15 @@ func TestParseLR(t *testing.T) {
281282
absPath := "../../../providers/" + lrPath
282283

283284
t.Run(lrPath, func(t *testing.T) {
285+
hasImports := false
284286
res, err := Resolve(absPath, func(path string) ([]byte, error) {
285287
raw, err := os.ReadFile(path)
286288
if err != nil {
287289
t.Fatal("failed to load " + path + ":" + err.Error())
288290
}
291+
if bytes.Contains(raw, []byte("import \"")) {
292+
hasImports = true
293+
}
289294
return raw, err
290295
})
291296
if err != nil {
@@ -305,6 +310,11 @@ func TestParseLR(t *testing.T) {
305310
t.Fatal("failed to generate schema for " + lrPath + ":" + err.Error())
306311
}
307312
assert.NotEmpty(t, schema)
313+
assert.NotEmpty(t, schema.Resources)
314+
315+
if hasImports {
316+
assert.NotEmpty(t, schema.Dependencies)
317+
}
308318
})
309319
}
310320
}

0 commit comments

Comments
 (0)