-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor of testing to improve developer experience
Includes addition of kubetest and conformance testing Signed-off-by: Naadir Jeewa <[email protected]>
- Loading branch information
Naadir Jeewa
committed
Sep 16, 2020
1 parent
90f6e46
commit 4087520
Showing
67 changed files
with
3,015 additions
and
458 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -63,3 +63,5 @@ clusterctl-settings.json | |
|
||
# test results | ||
_artifacts | ||
|
||
*.sentinel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# Copyright 2020 The Kubernetes Authors. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
include $(ROOT_DIR_RELATIVE)/versions.mk | ||
|
||
# Ensure Make is run with bash shell as some syntax below is bash-specific | ||
SHELL:=bash | ||
.ONESHELL: | ||
.SHELLFLAGS := -eu -o pipefail -c | ||
.DELETE_ON_ERROR: | ||
MAKEFLAGS += --warn-undefined-variables | ||
MAKEFLAGS += --no-builtin-rules | ||
|
||
TOOLS_DIR := $(ROOT_DIR_RELATIVE)/hack/tools | ||
TOOLS_DIR_DEPS := $(TOOLS_DIR)/go.sum $(TOOLS_DIR)/go.mod $(TOOLS_DIR)/Makefile | ||
TOOLS_BIN_DIR := $(TOOLS_DIR)/bin | ||
|
||
PATH := $(abspath $(TOOLS_BIN_DIR)):$(PATH) | ||
export PATH | ||
|
||
UID := $(shell id -u) | ||
GID := $(shell id -g) | ||
|
||
rwildcard=$(foreach d,$(wildcard $(1:=/*)),$(call rwildcard,$d,$2) $(filter $(subst *,%,$2),$d)) | ||
|
||
# Hosts running SELinux need :z added to volume mounts | ||
SELINUX_ENABLED := $(shell cat /sys/fs/selinux/enforce 2> /dev/null || echo 0) | ||
|
||
ifeq ($(SELINUX_ENABLED),1) | ||
DOCKER_VOL_OPTS?=:z | ||
endif | ||
|
||
# This option is for running docker manifest command | ||
export DOCKER_CLI_EXPERIMENTAL := enabled | ||
|
||
# Use GOPROXY environment variable if set | ||
GOPROXY := $(shell go env GOPROXY) | ||
ifeq ($(GOPROXY),) | ||
GOPROXY := https://proxy.golang.org | ||
endif | ||
export GOPROXY | ||
|
||
|
||
$(TOOLS_BIN_DIR)/%: $(TOOLS_DIR_DEPS) | ||
make -C $(TOOLS_DIR) $(@:hack/tools/%=%) | ||
|
||
## -------------------------------------- | ||
## Help | ||
## -------------------------------------- | ||
|
||
.DEFAULT_GOAL:=help | ||
|
||
help: ## Display this help | ||
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z0-9_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
# Copyright 2020 The Kubernetes Authors. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
ROOT_DIR_RELATIVE := ../.. | ||
include $(ROOT_DIR_RELATIVE)/common.mk | ||
|
||
UNAME := $(shell uname -s) | ||
|
||
# Directories. | ||
BIN_DIR := bin | ||
SHARE_DIR := share | ||
|
||
OS := $(shell go env GOOS) | ||
RUST_TARGET := unknown-$(OS)-gnu | ||
MDBOOK_EXTRACT_COMMAND := tar xfvz $(SHARE_DIR)/mdbook.tar.gz -C bin | ||
MDBOOK_ARCHIVE_EXT := .tar.gz | ||
|
||
ifeq ($(OS), windows) | ||
RUST_TARGET := pc-windows-msvc | ||
MDBOOK_ARCHIVE_EXT := .zip | ||
MDBOOK_EXTRACT_COMMAND := unzip -d /tmp | ||
endif | ||
|
||
ifeq ($(OS), darwin) | ||
RUST_TARGET := apple-darwin | ||
endif | ||
|
||
## -------------------------------------- | ||
## Tooling Binaries | ||
## -------------------------------------- | ||
|
||
.PHONY: modules | ||
modules: ## Runs go mod to ensure modules are up to date. | ||
go mod tidy | ||
|
||
$(BIN_DIR): | ||
mkdir -p $@ | ||
|
||
$(SHARE_DIR): | ||
mkdir -p $@ | ||
|
||
CONTROLLER_GEN := $(BIN_DIR)/controller-gen | ||
$(CONTROLLER_GEN): $(BIN_DIR) go.mod go.sum # Build controller-gen from tools folder. | ||
go build -tags=tools -o $@ sigs.k8s.io/controller-tools/cmd/controller-gen | ||
|
||
CONVERSION_GEN := $(BIN_DIR)/conversion-gen | ||
$(CONVERSION_GEN): $(BIN_DIR) go.mod go.sum | ||
go build -tags=tools -o $@ k8s.io/code-generator/cmd/conversion-gen | ||
|
||
DEFAULTER_GEN := $(BIN_DIR)/defaulter-gen | ||
$(DEFAULTER_GEN): $(BIN_DIR) go.mod go.sum | ||
go build -tags=tools -o $@ k8s.io/code-generator/cmd/defaulter-gen | ||
|
||
ENVSUBST := $(BIN_DIR)/envsubst | ||
$(ENVSUBST): $(BIN_DIR) go.mod go.sum # Build envsubst from tools folder. | ||
go build -tags=tools -o $@ github.com/a8m/envsubst/cmd/envsubst | ||
|
||
GINKGO := $(BIN_DIR)/ginkgo | ||
$(GINKGO): $(BIN_DIR) go.mod go.sum | ||
go build -tags=tools -o $@ github.com/onsi/ginkgo/ginkgo | ||
|
||
GOLANGCI_LINT := $(BIN_DIR)/golangci-lint | ||
$(GOLANGCI_LINT): $(BIN_DIR) go.mod go.sum # Build golangci-lint from tools folder. | ||
go build -tags=tools -o $@ github.com/golangci/golangci-lint/cmd/golangci-lint | ||
|
||
KIND := $(BIN_DIR)/kind | ||
$(KIND): $(BIN_DIR) go.mod go.sum | ||
go build -tags tools -o $@ sigs.k8s.io/kind | ||
|
||
KUSTOMIZE := $(BIN_DIR)/kustomize | ||
$(KUSTOMIZE): $(BIN_DIR) go.mod go.sum # Build kustomize from tools folder. | ||
go build -tags=tools -o $@ sigs.k8s.io/kustomize/kustomize/v3 | ||
|
||
MDBOOK_EMBED := $(BIN_DIR)/mdbook-embed | ||
$(MDBOOK_EMBED): $(BIN_DIR) go.mod go.sum | ||
go build -tags=tools -o $(BIN_DIR)/mdbook-embed ./mdbook/embed | ||
|
||
MDBOOK_RELEASELINK := $(BIN_DIR)/mdbook-releaselink | ||
$(MDBOOK_RELEASELINK): $(BIN_DIR) go.mod go.sum | ||
go build -tags=tools -o $(BIN_DIR)/mdbook-releaselink ./mdbook/releaselink | ||
|
||
MDBOOK_TABULATE := $(BIN_DIR)/mdbook-tabulate | ||
$(MDBOOK_TABULATE): $(BIN_DIR) go.mod go.sum | ||
go build -tags=tools -o $(BIN_DIR)/mdbook-tabulate ./mdbook/tabulate | ||
|
||
MOCKGEN := $(BIN_DIR)/mockgen | ||
$(MOCKGEN): $(BIN_DIR) go.mod go.sum # Build mockgen from tools folder. | ||
go build -tags=tools -o $@ github.com/golang/mock/mockgen | ||
|
||
RELEASE_NOTES := $(BIN_DIR)/release-notes | ||
$(RELEASE_NOTES): $(BIN_DIR) go.mod go.sum | ||
go build -tags tools -o $@ ./release | ||
|
||
LINK_CHECKER := $(BIN_DIR)/link-checker | ||
$(LINK_CHECKER): $(BIN_DIR) go.mod go.sum | ||
go build -tags tools -o $@ github.com/raviqqe/liche | ||
|
||
GOBINDATA := $(BIN_DIR)/go-bindata | ||
$(GOBINDATA): $(BIN_DIR) go.mod go.sum | ||
go build -tags tools -o $@ github.com/go-bindata/go-bindata/go-bindata | ||
|
||
GOAPIDIFF := $(BIN_DIR)/go-apidiff | ||
$(GOAPIDIFF): $(BIN_DIR) go.mod go.sum | ||
go build -tags tools -o $@ github.com/joelanford/go-apidiff |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Binaries. | ||
KUSTOMIZE := $(TOOLS_BIN_DIR)/kustomize | ||
CONTROLLER_GEN:= $(TOOLS_BIN_DIR)/controller-gen | ||
GOLANGCI_LINT := $(TOOLS_BIN_DIR)/golangci-lint | ||
CONVERSION_GEN := $(TOOLS_BIN_DIR)/conversion-gen | ||
DEFAULTER_GEN := $(TOOLS_BIN_DIR)/defaulter-gen | ||
GINKGO := $(TOOLS_BIN_DIR)/ginkgo | ||
ENVSUBST := $(TOOLS_BIN_DIR)/envsubst | ||
GOBINDATA := $(TOOLS_BIN_DIR)/go-bindata | ||
RELEASE_NOTES := $(TOOLS_BIN_DIR)/release-notes | ||
GO_APIDIFF := $(TOOLS_BIN_DIR)/go-apidiff | ||
LINK_CHECKER := $(TOOLS_BIN_DIR)/link-checker |
Oops, something went wrong.