Skip to content

Commit

Permalink
🧹 move providers loading into test init
Browse files Browse the repository at this point in the history
  • Loading branch information
chris-rock committed Oct 22, 2023
1 parent da6a206 commit 71782d5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
9 changes: 7 additions & 2 deletions test/k8s_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,21 @@
package test

import (
"go.mondoo.com/cnquery/v9/providers"
"testing"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.mondoo.com/cnquery/v9/providers"
"go.mondoo.com/cnquery/v9/providers-sdk/v1/inventory"
)

func TestKubernetesBundles(t *testing.T) {
func init() {
// There seems to be a small timing issue when provider installation is close to schema update.
// The provider is registered in the init() function to make sure it is loaded early
providers.EnsureProvider(providers.ProviderLookup{ID: "go.mondoo.com/cnquery/v9/providers/k8s"}, true, nil)
}

func TestKubernetesBundles(t *testing.T) {

type TestCase struct {
bundleFile string
Expand Down
5 changes: 4 additions & 1 deletion test/terraform_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@ import (
"go.mondoo.com/cnquery/v9/providers-sdk/v1/inventory"
)

func TestTerraformBundles(t *testing.T) {
func init() {
providers.EnsureProvider(providers.ProviderLookup{ID: "go.mondoo.com/cnquery/v9/providers/terraform"}, true, nil)
}

func TestTerraformBundles(t *testing.T) {
type TestCase struct {
bundleFile string
testDir string
Expand Down

0 comments on commit 71782d5

Please sign in to comment.