Skip to content

Commit

Permalink
🧹 ensure providers to run lint are installed for examples
Browse files Browse the repository at this point in the history
  • Loading branch information
chris-rock committed Jan 21, 2024
1 parent 18de21e commit aa1a8f3
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions examples/lint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,36 @@ import (
"github.com/stretchr/testify/require"
"go.mondoo.com/cnquery/v10/explorer"
"go.mondoo.com/cnquery/v10/internal/bundle"
"go.mondoo.com/cnquery/v10/providers"
"os"
"testing"
)

func ensureProviders(ids []string) error {
for _, id := range ids {
_, err := providers.EnsureProvider(providers.ProviderLookup{ID: id}, true, nil)
if err != nil {
return err
}
}
return nil
}

func TestMain(m *testing.M) {
err := ensureProviders([]string{
"go.mondoo.com/cnquery/v9/providers/os",
"go.mondoo.com/cnquery/v9/providers/k8s",
})
if err != nil {
panic(err)
}

exitVal := m.Run()
os.Exit(exitVal)
}

func TestExampleLint(t *testing.T) {

queryPackBundle, err := explorer.BundleFromPaths(".")
require.NoError(t, err)

Expand Down

0 comments on commit aa1a8f3

Please sign in to comment.