Skip to content

Commit

Permalink
Break circular dependency between provider/tests (#3385)
Browse files Browse the repository at this point in the history
The `./tests` modules currently depends on the `./provider` module for
some OpenAPI helpers, but `./provider` also depends on `./tests` for
Gomega matchers.

Since `./tests` isn't versioned like a proper module this puts us in a
situation where Renovate will continuously try to update it
#3384

We can teach Renovate to ignore this bump, or we can break the
dependency by moving some code around. I've opted for the latter, moving
`tests/gomega` to `provider/pkg/gomega`. (This makes it easier to
consume from other projects if we want to.)

Of course it's worth mentioning this is a self-inflicted problem due to
our module structure. Related
pulumi/ci-mgmt#1238.
  • Loading branch information
blampe authored Dec 20, 2024
1 parent 82406b3 commit f5355f6
Show file tree
Hide file tree
Showing 13 changed files with 16 additions and 18 deletions.
8 changes: 3 additions & 5 deletions provider/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@ go 1.23.0

toolchain go1.23.3

replace (
github.com/pulumi/pulumi-kubernetes/sdk/v4 => ../sdk
github.com/pulumi/pulumi-kubernetes/tests/v4 => ../tests
)
replace github.com/pulumi/pulumi-kubernetes/sdk/v4 => ../sdk

require (
github.com/evanphx/json-patch v5.7.0+incompatible
Expand All @@ -22,7 +19,6 @@ require (
github.com/pkg/errors v0.9.1
github.com/pulumi/cloud-ready-checks v1.2.0
github.com/pulumi/pulumi-kubernetes/sdk/v4 v4.19.0
github.com/pulumi/pulumi-kubernetes/tests/v4 v4.0.0-20241219025154-c17b3653a081
github.com/pulumi/pulumi/pkg/v3 v3.143.0
github.com/pulumi/pulumi/sdk/v3 v3.143.0
github.com/stretchr/testify v1.10.0
Expand Down Expand Up @@ -101,6 +97,7 @@ require (
github.com/exponent-io/jsonpath v0.0.0-20210407135951-1de76d718b3f // indirect
github.com/fatih/color v1.16.0 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/fsnotify/fsnotify v1.8.0 // indirect
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
github.com/go-errors/errors v1.4.2 // indirect
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
Expand Down Expand Up @@ -217,6 +214,7 @@ require (
github.com/zclconf/go-cty v1.13.2 // indirect
go.etcd.io/etcd/api/v3 v3.5.17 // indirect
go.etcd.io/etcd/client/v3 v3.5.17 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.57.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.57.0 // indirect
go.opentelemetry.io/otel v1.32.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.32.0 // indirect
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion provider/pkg/provider/helm/v4/chart_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ import (
. "github.com/onsi/gomega" //nolint:golint // dot-imports
. "github.com/onsi/gomega/gstruct" //nolint:golint // dot-imports
"github.com/pulumi/pulumi-kubernetes/provider/v4/pkg/clients/fake"
. "github.com/pulumi/pulumi-kubernetes/provider/v4/pkg/gomega"
kubehelm "github.com/pulumi/pulumi-kubernetes/provider/v4/pkg/helm"
providerresource "github.com/pulumi/pulumi-kubernetes/provider/v4/pkg/provider/resource"
. "github.com/pulumi/pulumi-kubernetes/tests/v4/gomega"
"github.com/pulumi/pulumi/sdk/v3/go/common/resource"
"github.com/pulumi/pulumi/sdk/v3/go/common/resource/plugin"
pulumiprovider "github.com/pulumi/pulumi/sdk/v3/go/pulumi/provider"
Expand Down
2 changes: 1 addition & 1 deletion provider/pkg/provider/kustomize/v2/directory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import (
. "github.com/onsi/gomega" //nolint:golint // dot-imports
. "github.com/onsi/gomega/gstruct" //nolint:golint // dot-imports
"github.com/pulumi/pulumi-kubernetes/provider/v4/pkg/clients/fake"
. "github.com/pulumi/pulumi-kubernetes/provider/v4/pkg/gomega"
providerresource "github.com/pulumi/pulumi-kubernetes/provider/v4/pkg/provider/resource"
. "github.com/pulumi/pulumi-kubernetes/tests/v4/gomega"
"github.com/pulumi/pulumi/sdk/v3/go/common/resource"
"github.com/pulumi/pulumi/sdk/v3/go/common/resource/plugin"
pulumiprovider "github.com/pulumi/pulumi/sdk/v3/go/pulumi/provider"
Expand Down
2 changes: 1 addition & 1 deletion provider/pkg/provider/yaml/v2/configfile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import (
. "github.com/onsi/gomega"
. "github.com/onsi/gomega/gstruct"
"github.com/pulumi/pulumi-kubernetes/provider/v4/pkg/clients/fake"
. "github.com/pulumi/pulumi-kubernetes/provider/v4/pkg/gomega"
providerresource "github.com/pulumi/pulumi-kubernetes/provider/v4/pkg/provider/resource"
. "github.com/pulumi/pulumi-kubernetes/tests/v4/gomega"
"github.com/pulumi/pulumi/sdk/v3/go/common/resource"
"github.com/pulumi/pulumi/sdk/v3/go/common/resource/plugin"
pulumiprovider "github.com/pulumi/pulumi/sdk/v3/go/pulumi/provider"
Expand Down
2 changes: 1 addition & 1 deletion provider/pkg/provider/yaml/v2/configgroup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import (
. "github.com/onsi/gomega"
. "github.com/onsi/gomega/gstruct"
"github.com/pulumi/pulumi-kubernetes/provider/v4/pkg/clients/fake"
. "github.com/pulumi/pulumi-kubernetes/provider/v4/pkg/gomega"
providerresource "github.com/pulumi/pulumi-kubernetes/provider/v4/pkg/provider/resource"
. "github.com/pulumi/pulumi-kubernetes/tests/v4/gomega"
"github.com/pulumi/pulumi/sdk/v3/go/common/resource"
"github.com/pulumi/pulumi/sdk/v3/go/common/resource/plugin"
pulumiprovider "github.com/pulumi/pulumi/sdk/v3/go/pulumi/provider"
Expand Down
2 changes: 1 addition & 1 deletion provider/pkg/provider/yaml/v2/yaml_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
gomegatypes "github.com/onsi/gomega/types"
"github.com/pulumi/pulumi-kubernetes/provider/v4/pkg/clients"
"github.com/pulumi/pulumi-kubernetes/provider/v4/pkg/clients/fake"
. "github.com/pulumi/pulumi-kubernetes/tests/v4/gomega"
. "github.com/pulumi/pulumi-kubernetes/provider/v4/pkg/gomega"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi/internals"
"github.com/stretchr/testify/assert"
Expand Down
2 changes: 1 addition & 1 deletion tests/sdk/dotnet/dotnet_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ import (
. "github.com/onsi/gomega"
"github.com/onsi/gomega/format"
. "github.com/onsi/gomega/gstruct"
. "github.com/pulumi/pulumi-kubernetes/provider/v4/pkg/gomega"
"github.com/pulumi/pulumi-kubernetes/provider/v4/pkg/openapi"
"github.com/pulumi/pulumi-kubernetes/tests/v4"
. "github.com/pulumi/pulumi-kubernetes/tests/v4/gomega"
pulumirpctesting "github.com/pulumi/pulumi-kubernetes/tests/v4/pulumirpc"
"github.com/pulumi/pulumi/pkg/v3/engine"
"github.com/pulumi/pulumi/pkg/v3/testing/integration"
Expand Down
2 changes: 1 addition & 1 deletion tests/sdk/go/go_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ import (
. "github.com/onsi/gomega"
"github.com/onsi/gomega/format"
. "github.com/onsi/gomega/gstruct"
. "github.com/pulumi/pulumi-kubernetes/provider/v4/pkg/gomega"
"github.com/pulumi/pulumi-kubernetes/provider/v4/pkg/openapi"
"github.com/pulumi/pulumi-kubernetes/tests/v4"
. "github.com/pulumi/pulumi-kubernetes/tests/v4/gomega"
pulumirpctesting "github.com/pulumi/pulumi-kubernetes/tests/v4/pulumirpc"
"github.com/pulumi/pulumi/pkg/v3/engine"
"github.com/pulumi/pulumi/pkg/v3/testing/integration"
Expand Down
2 changes: 1 addition & 1 deletion tests/sdk/nodejs/helm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
. "github.com/onsi/gomega/gstruct"
"github.com/pulumi/providertest/grpclog"
"github.com/pulumi/providertest/pulumitest"
. "github.com/pulumi/pulumi-kubernetes/tests/v4/gomega"
. "github.com/pulumi/pulumi-kubernetes/provider/v4/pkg/gomega"
"github.com/pulumi/pulumi/sdk/v3/go/auto"
"github.com/pulumi/pulumi/sdk/v3/go/auto/optpreview"
"github.com/pulumi/pulumi/sdk/v3/go/common/resource"
Expand Down
2 changes: 1 addition & 1 deletion tests/sdk/nodejs/nodejs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ import (
. "github.com/onsi/gomega"
"github.com/onsi/gomega/format"
. "github.com/onsi/gomega/gstruct"
. "github.com/pulumi/pulumi-kubernetes/provider/v4/pkg/gomega"
"github.com/pulumi/pulumi-kubernetes/provider/v4/pkg/openapi"
"github.com/pulumi/pulumi-kubernetes/tests/v4"
. "github.com/pulumi/pulumi-kubernetes/tests/v4/gomega"
pulumirpctesting "github.com/pulumi/pulumi-kubernetes/tests/v4/pulumirpc"
"github.com/pulumi/pulumi/pkg/v3/engine"
"github.com/pulumi/pulumi/pkg/v3/resource/deploy/providers"
Expand Down
8 changes: 4 additions & 4 deletions tests/sdk/python/python_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ import (
. "github.com/onsi/gomega"
"github.com/onsi/gomega/format"
. "github.com/onsi/gomega/gstruct"
. "github.com/pulumi/pulumi-kubernetes/provider/v4/pkg/gomega"
"github.com/pulumi/pulumi-kubernetes/provider/v4/pkg/openapi"
"github.com/pulumi/pulumi-kubernetes/tests/v4"
. "github.com/pulumi/pulumi-kubernetes/tests/v4/gomega"
pulumirpctesting "github.com/pulumi/pulumi-kubernetes/tests/v4/pulumirpc"
"github.com/pulumi/pulumi/pkg/v3/engine"
"github.com/pulumi/pulumi/pkg/v3/resource/deploy/providers"
Expand Down Expand Up @@ -970,9 +970,9 @@ func TestOptionPropagation(t *testing.T) {
// quirk: Python SDK applies resource_prefix ("chart-options") to the component itself.
MatchFields(IgnoreExtras, Fields{
"Request": MatchFields(IgnoreExtras, Fields{
"Aliases": ConsistOf(
Alias("chart-options-old"),
Alias("chart-options-chart-options-aliased"),
"Aliases": ConsistOf(
Alias("chart-options-old"),
Alias("chart-options-chart-options-aliased"),
Alias(tokens.Type("kubernetes:helm.sh/v2:Chart"))),
"Protect": BeTrue(),
"Dependencies": ConsistOf(string(sleep.URN)),
Expand Down

0 comments on commit f5355f6

Please sign in to comment.