Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests:feat:integ: adc for direct #3386

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions pkg/test/controller/reconciler/testreconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ import (
"fmt"
"log"
"net/http"
"os"
"regexp"
"strconv"
"testing"
"time"

Expand All @@ -43,6 +45,7 @@ import (
"github.com/GoogleCloudPlatform/k8s-config-connector/pkg/kccfeatureflags"
"github.com/GoogleCloudPlatform/k8s-config-connector/pkg/servicemapping/servicemappingloader"
testcontroller "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/test/controller"
testgcp "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/test/gcp"
testk8s "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/test/k8s"
testservicemappingloader "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/test/servicemappingloader"

Expand Down Expand Up @@ -112,9 +115,22 @@ func NewTestReconciler(t *testing.T, mgr manager.Manager, provider *tfschema.Pro
dclConverter := conversion.New(dclSchemaLoader, serviceMetaLoader)

// Initialize direct controllers
if err := registry.Init(context.TODO(), &config.ControllerConfig{
kccConfig := &config.ControllerConfig{
HTTPClient: httpClient,
}); err != nil {
}
p := testgcp.GetDefaultProject(t)
// technically this would be sufficient for TF and DCL controllers
// to set the BillingProject as the resource project that is being used.
kccConfig.UserProjectOverride = true

// but for our direct resources we look at the BillingProject so let's set it.
if os.Getenv("BILLING_ACCOUNT_ID") != "" {
kccConfig.BillingProject = os.Getenv("BILLING_ACCOUNT_ID")
} else {
kccConfig.BillingProject = strconv.FormatInt(p.ProjectNumber, 10)
}

if err := registry.Init(context.TODO(), kccConfig); err != nil {
t.Fatalf("error initializing direct registry: %v", err)
}

Expand Down
Loading