Skip to content

Commit

Permalink
Simplify integration test setup
Browse files Browse the repository at this point in the history
Signed-off-by: Erik Godding Boye <[email protected]>
  • Loading branch information
erikgb committed Dec 12, 2024
1 parent c47d80f commit 3d7bb9e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 14 deletions.
9 changes: 1 addition & 8 deletions make/test-integration.mk
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.

trust_manager_crds := $(bin_dir)/scratch/trust.cert-manager.io_bundles.yaml
$(trust_manager_crds): $(helm_chart_archive) | $(NEEDS_HELM) $(NEEDS_YQ)
$(HELM) template test "$(helm_chart_archive)" | \
$(YQ) e '. | select(.kind == "CustomResourceDefinition")' \
> $@

.PHONY: test-integration
## Integration tests
## @category Testing
test-integration: | $(trust_manager_crds) $(NEEDS_GOTESTSUM) $(NEEDS_ETCD) $(NEEDS_KUBE-APISERVER) $(NEEDS_KUBECTL) $(ARTIFACTS)
TRUST_MANAGER_CRDS=$(CURDIR)/$(trust_manager_crds) \
test-integration: | $(NEEDS_GOTESTSUM) $(NEEDS_ETCD) $(NEEDS_KUBE-APISERVER) $(NEEDS_KUBECTL) $(ARTIFACTS)
KUBEBUILDER_ASSETS=$(CURDIR)/$(bin_dir)/tools \
$(GOTESTSUM) \
--junitfile=$(ARTIFACTS)/junit-go-e2e.xml \
Expand Down
10 changes: 4 additions & 6 deletions test/integration/bundle/integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ limitations under the License.
package test

import (
"os"
"path"

"k8s.io/utils/ptr"
"sigs.k8s.io/controller-runtime/pkg/envtest"
Expand All @@ -37,15 +37,13 @@ var (
var _ = BeforeSuite(func() {
logf.SetLogger(zap.New(zap.WriteTo(GinkgoWriter), zap.UseDevMode(true)))

crdsYamlFile := os.Getenv("TRUST_MANAGER_CRDS")
Expect(crdsYamlFile).NotTo(BeEmpty(), "TRUST_MANAGER_CRDS must be set to the path of the CRDs to install")

env = &envtest.Environment{
UseExistingCluster: ptr.To(false),
CRDDirectoryPaths: []string{
crdsYamlFile,
path.Join("..", "..", "..", "deploy", "crds"),
},
Scheme: trustapi.GlobalScheme,
ErrorIfCRDPathMissing: true,
Scheme: trustapi.GlobalScheme,
}

_, err := env.Start()
Expand Down

0 comments on commit 3d7bb9e

Please sign in to comment.