mirror of
https://github.com/kubernetes-sigs/node-feature-discovery.git
synced 2024-12-14 11:57:51 +00:00
3d5866a06d
Implement an end-to-end test with all feature sources enabled. The new test runs nfd-worker as a daemonset on all (schedulable) nodes of the test cluster which makes it possible to cover a wide range features, assuming the test cluster is heterogenous containing nodes with varying system configurations. The features available depends on the node(s) the e2e testa are run on. Thus, some runtime parameterization of the tests is needed. The patch adds a new command line test flag 'nfd.e2e-config' that is used to specify the per-node feature labels and annotations that is expected to be present in the cluster. An example configuration file is provided with the patch. The pod spec of nfd-worker deployment is changed to better correspond the default deployment and thus enable wider feature discovery. This means using hostnetwork and adding mounts for /sys /boot and /etc/os-release. The patch changes node object management so that all nfd-related labels are removed after each test (not just the ones the test is expected to add). Also, all nfd-related annotations are now removed.
54 lines
1.6 KiB
Makefile
54 lines
1.6 KiB
Makefile
.PHONY: all test yamls
|
|
.FORCE:
|
|
|
|
GO_CMD := go
|
|
|
|
IMAGE_BUILD_CMD := docker build
|
|
IMAGE_BUILD_EXTRA_OPTS :=
|
|
IMAGE_PUSH_CMD := docker push
|
|
|
|
VERSION := $(shell git describe --tags --dirty --always)
|
|
|
|
IMAGE_REGISTRY := quay.io/kubernetes_incubator
|
|
IMAGE_NAME := node-feature-discovery
|
|
IMAGE_TAG_NAME := $(VERSION)
|
|
IMAGE_REPO := $(IMAGE_REGISTRY)/$(IMAGE_NAME)
|
|
IMAGE_TAG := $(IMAGE_REPO):$(IMAGE_TAG_NAME)
|
|
K8S_NAMESPACE := kube-system
|
|
KUBECONFIG :=
|
|
E2E_TEST_CONFIG :=
|
|
|
|
yaml_templates := $(wildcard *.yaml.template)
|
|
yaml_instances := $(patsubst %.yaml.template,%.yaml,$(yaml_templates))
|
|
|
|
all: image
|
|
|
|
image: yamls
|
|
$(IMAGE_BUILD_CMD) --build-arg NFD_VERSION=$(VERSION) \
|
|
-t $(IMAGE_TAG) \
|
|
$(IMAGE_BUILD_EXTRA_OPTS) ./
|
|
|
|
yamls: $(yaml_instances)
|
|
|
|
%.yaml: %.yaml.template .FORCE
|
|
@echo "$@: namespace: ${K8S_NAMESPACE}"
|
|
@echo "$@: image: ${IMAGE_TAG}"
|
|
@sed -E \
|
|
-e s',^(\s*)name: node-feature-discovery # NFD namespace,\1name: ${K8S_NAMESPACE},' \
|
|
-e s',^(\s*)image:.+$$,\1image: ${IMAGE_TAG},' \
|
|
-e s',^(\s*)namespace:.+$$,\1namespace: ${K8S_NAMESPACE},' \
|
|
$< > $@
|
|
|
|
mock:
|
|
mockery --name=FeatureSource --dir=source --inpkg --note="Re-generate by running 'make mock'"
|
|
mockery --name=APIHelpers --dir=pkg/apihelper --inpkg --note="Re-generate by running 'make mock'"
|
|
mockery --name=LabelerClient --dir=pkg/labeler --inpkg --note="Re-generate by running 'make mock'"
|
|
|
|
test:
|
|
$(GO_CMD) test ./cmd/... ./pkg/...
|
|
|
|
e2e-test:
|
|
$(GO_CMD) test -v ./test/e2e/ -args -nfd.repo=$(IMAGE_REPO) -nfd.tag=$(IMAGE_TAG_NAME) -kubeconfig=$(KUBECONFIG) -nfd.e2e-config=$(E2E_TEST_CONFIG)
|
|
|
|
push:
|
|
$(IMAGE_PUSH_CMD) $(IMAGE_TAG)
|