mirror of
https://github.com/kubernetes-sigs/node-feature-discovery.git
synced 2024-12-14 11:57:51 +00:00
Merge pull request #1489 from ArangoGutierrez/ginkofocus
Makefile: add env var controls to make test targets configurable
This commit is contained in:
commit
794630f7df
7 changed files with 40 additions and 26 deletions
22
Makefile
22
Makefile
|
@ -56,6 +56,8 @@ HOSTMOUNT_PREFIX ?= /
|
|||
KUBECONFIG ?= ${HOME}/.kube/config
|
||||
E2E_TEST_CONFIG ?=
|
||||
E2E_PULL_IF_NOT_PRESENT ?= false
|
||||
E2E_TEST_FULL_IMAGE ?= false
|
||||
E2E_GINKGO_LABEL_FILTER ?=
|
||||
|
||||
BUILD_FLAGS = -tags osusergo,netgo \
|
||||
-ldflags "-s -w -extldflags=-static -X sigs.k8s.io/node-feature-discovery/pkg/version.version=$(VERSION) -X sigs.k8s.io/node-feature-discovery/pkg/utils/hostpath.pathPrefix=$(HOSTMOUNT_PREFIX)"
|
||||
|
@ -191,16 +193,20 @@ e2e-test:
|
|||
-kubeconfig=$(KUBECONFIG) \
|
||||
-nfd.e2e-config=$(E2E_TEST_CONFIG) \
|
||||
-nfd.pull-if-not-present=$(E2E_PULL_IF_NOT_PRESENT) \
|
||||
-ginkgo.focus="\[kubernetes-sigs\]" \
|
||||
-test.timeout=1h \
|
||||
$(if $(OPENSHIFT),-nfd.openshift,)
|
||||
$(GO_CMD) test -v ./test/e2e/ -args -nfd.repo=$(IMAGE_REPO) -nfd.tag=$(IMAGE_TAG_NAME)-full \
|
||||
-kubeconfig=$(KUBECONFIG) \
|
||||
-nfd.e2e-config=$(E2E_TEST_CONFIG) \
|
||||
-nfd.pull-if-not-present=$(E2E_PULL_IF_NOT_PRESENT) \
|
||||
-ginkgo.focus="\[kubernetes-sigs\]" \
|
||||
-ginkgo.focus="\[k8s-sigs\/node-feature-discovery\]" \
|
||||
-ginkgo.label-filter=$(E2E_GINKGO_LABEL_FILTER) \
|
||||
-test.timeout=1h \
|
||||
$(if $(OPENSHIFT),-nfd.openshift,)
|
||||
@if [ "$(E2E_TEST_FULL_IMAGE)" = "true" ]; then \
|
||||
$(GO_CMD) test -v ./test/e2e/ -args -nfd.repo=$(IMAGE_REPO) -nfd.tag=$(IMAGE_TAG_NAME)-full \
|
||||
-kubeconfig=$(KUBECONFIG) \
|
||||
-nfd.e2e-config=$(E2E_TEST_CONFIG) \
|
||||
-nfd.pull-if-not-present=$(E2E_PULL_IF_NOT_PRESENT) \
|
||||
-ginkgo.focus="\[k8s-sigs\/node-feature-discovery\]" \
|
||||
-ginkgo.label-filter=$(E2E_GINKGO_LABEL_FILTER) \
|
||||
-test.timeout=1h \
|
||||
$(if $(OPENSHIFT),-nfd.openshift,)
|
||||
fi
|
||||
|
||||
push:
|
||||
$(IMAGE_PUSH_CMD) $(IMAGE_TAG)
|
||||
|
|
|
@ -121,10 +121,6 @@ makefile overrides.
|
|||
| IMAGE_TAG_NAME | Container image tag name | <nfd version> |
|
||||
| IMAGE_EXTRA_TAG_NAMES | Additional container image tag(s) to create when building image | *empty* |
|
||||
| K8S_NAMESPACE | nfd-master and nfd-worker namespace | node-feature-discovery |
|
||||
| KUBECONFIG | Kubeconfig for running e2e-tests | *empty* |
|
||||
| E2E_TEST_CONFIG | Parameterization file of e2e-tests (see [example][e2e-config-sample]) | *empty* |
|
||||
| E2E_PULL_IF_NOT_PRESENT | True-ish value makes the image pull policy IfNotPresent (to be used only in e2e tests) | false |
|
||||
| OPENSHIFT | Non-empty value enables OpenShift specific support (only affects e2e tests) | *empty* |
|
||||
|
||||
For example, to use a custom registry:
|
||||
|
||||
|
@ -163,6 +159,18 @@ cluster you need to specify the kubeconfig to be used:
|
|||
make e2e-test KUBECONFIG=$HOME/.kube/config
|
||||
```
|
||||
|
||||
There are several environment variables that can be used to customize the
|
||||
e2e-tests:
|
||||
|
||||
| Variable | Description | Default value |
|
||||
| -------------------------- | ----------------------------------------------------------------- | ------------- |
|
||||
| KUBECONFIG | Kubeconfig for running e2e-tests | *empty* |
|
||||
| E2E_TEST_CONFIG | Parameterization file of e2e-tests (see [example][e2e-config-sample]) | *empty* |
|
||||
| E2E_PULL_IF_NOT_PRESENT | True-ish value makes the image pull policy IfNotPresent (to be used only in e2e tests) | false |
|
||||
| E2E_TEST_FULL_IMAGE | Run e2e-test also against the Full Image tag | false |
|
||||
| E2E_GINKGO_LABEL_FILTER | Ginkgo label filter to use for running e2e tests | *empty* |
|
||||
| OPENSHIFT | Non-empty value enables OpenShift specific support (only affects e2e tests) | *empty* |
|
||||
|
||||
## Running locally
|
||||
|
||||
> ****DEPRECATED**: Running NFD locally is deprecated and will be removed in a
|
||||
|
|
|
@ -11,6 +11,7 @@ chmod a+x /usr/local/bin/kubectl
|
|||
# Configure environment
|
||||
export KUBECONFIG=`pwd`/kubeconfig
|
||||
export E2E_TEST_CONFIG=`pwd`/e2e-test-config
|
||||
export E2E_TEST_FULL_IMAGE=true
|
||||
|
||||
echo "$KUBECONFIG_DATA" > "$KUBECONFIG"
|
||||
echo "$E2E_TEST_CONFIG_DATA" > "$E2E_TEST_CONFIG"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2021 The Kubernetes Authors.
|
||||
Copyright 2023 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.
|
||||
|
@ -18,7 +18,6 @@ package e2e
|
|||
|
||||
import "github.com/onsi/ginkgo/v2"
|
||||
|
||||
// SIGDescribe annotates the test with the SIG label.
|
||||
func SIGDescribe(text string, body func()) bool {
|
||||
return ginkgo.Describe("[kubernetes-sigs] "+text, body)
|
||||
func NFDDescribe(args ...interface{}) bool {
|
||||
return ginkgo.Describe("[k8s-sigs/node-feature-discovery]", append(args, ginkgo.Label("nfd-all"))...)
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ import (
|
|||
)
|
||||
|
||||
// Actual test suite
|
||||
var _ = SIGDescribe("NFD GC", func() {
|
||||
var _ = NFDDescribe(Label("nfd-gc"), func() {
|
||||
f := framework.NewDefaultFramework("nfd-gc")
|
||||
|
||||
Context("when deploying nfd-gc", Ordered, func() {
|
||||
|
@ -117,7 +117,7 @@ var _ = SIGDescribe("NFD GC", func() {
|
|||
// Test GC at startup
|
||||
//
|
||||
Context("with pre-existing NodeFeature and NodeResourceTopology objects", func() {
|
||||
It("it should delete stale objects at startup", func(ctx context.Context) {
|
||||
It("it should delete stale objects at startup", Label("gc-startup"), func(ctx context.Context) {
|
||||
nodes, err := f.ClientSet.CoreV1().Nodes().List(ctx, metav1.ListOptions{})
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
targetNodeNames := []string{nodes.Items[0].GetName()}
|
||||
|
@ -153,7 +153,7 @@ var _ = SIGDescribe("NFD GC", func() {
|
|||
// Test periodic GC
|
||||
//
|
||||
Context("with stale NodeFeature and NodeResourceTopology objects appearing", func() {
|
||||
It("it should remove stale objects", func(ctx context.Context) {
|
||||
It("it should remove stale objects", Label("gc-periodic"), func(ctx context.Context) {
|
||||
nodes, err := f.ClientSet.CoreV1().Nodes().List(ctx, metav1.ListOptions{})
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
targetNodeNames := []string{nodes.Items[0].GetName()}
|
||||
|
|
|
@ -183,7 +183,7 @@ func cleanupCRs(ctx context.Context, cli *nfdclient.Clientset, namespace string)
|
|||
}
|
||||
|
||||
// Actual test suite
|
||||
var _ = SIGDescribe("NFD master and worker", func() {
|
||||
var _ = NFDDescribe(Label("nfd-master"), func() {
|
||||
f := framework.NewDefaultFramework("node-feature-discovery")
|
||||
|
||||
nfdTestSuite := func(useNodeFeatureApi bool) {
|
||||
|
@ -278,7 +278,7 @@ var _ = SIGDescribe("NFD master and worker", func() {
|
|||
// Simple test with only the fake source enabled
|
||||
//
|
||||
Context("and a single worker pod with fake source enabled", func() {
|
||||
It("it should decorate the node with the fake feature labels", func(ctx context.Context) {
|
||||
It("it should decorate the node with the fake feature labels", Label("nfd-worker"), func(ctx context.Context) {
|
||||
nodes, err := getNonControlPlaneNodes(ctx, f.ClientSet)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
|
@ -327,7 +327,7 @@ var _ = SIGDescribe("NFD master and worker", func() {
|
|||
// More comprehensive test when --e2e-node-config is enabled
|
||||
//
|
||||
Context("and nfd-workers as a daemonset with default sources enabled", func() {
|
||||
It("the node labels and annotations listed in the e2e config should be present", func(ctx context.Context) {
|
||||
It("the node labels and annotations listed in the e2e config should be present", Label("nfd-worker"), func(ctx context.Context) {
|
||||
cfg, err := testutils.GetConfig()
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
|
@ -419,7 +419,7 @@ var _ = SIGDescribe("NFD master and worker", func() {
|
|||
// Test custom nodename source configured in 2 additional ConfigMaps
|
||||
//
|
||||
Context("and nfd-workers as a daemonset with 2 additional configmaps for the custom source configured", func() {
|
||||
It("the nodename matching features listed in the configmaps should be present", func(ctx context.Context) {
|
||||
It("the nodename matching features listed in the configmaps should be present", Label("nfd-worker"), func(ctx context.Context) {
|
||||
By("Getting a worker node")
|
||||
|
||||
// We need a valid nodename for the configmap
|
||||
|
@ -523,7 +523,7 @@ var _ = SIGDescribe("NFD master and worker", func() {
|
|||
),
|
||||
}
|
||||
})
|
||||
It("labels from the NodeFeature objects should be created", func(ctx context.Context) {
|
||||
It("labels from the NodeFeature objects should be created", Label("nfd-worker"), func(ctx context.Context) {
|
||||
if !useNodeFeatureApi {
|
||||
Skip("NodeFeature API not enabled")
|
||||
}
|
||||
|
@ -682,7 +682,7 @@ var _ = SIGDescribe("NFD master and worker", func() {
|
|||
testpod.SpecWithTolerations(testTolerations),
|
||||
}
|
||||
})
|
||||
It("custom features from the NodeFeatureRule rules should be created", func(ctx context.Context) {
|
||||
It("custom features from the NodeFeatureRule rules should be created", Label("nfd-worker"), func(ctx context.Context) {
|
||||
nodes, err := getNonControlPlaneNodes(ctx, f.ClientSet)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ import (
|
|||
testpod "sigs.k8s.io/node-feature-discovery/test/e2e/utils/pod"
|
||||
)
|
||||
|
||||
var _ = SIGDescribe("NFD topology updater", func() {
|
||||
var _ = NFDDescribe(Label("nfd-topology-updater"), func() {
|
||||
var (
|
||||
extClient *extclient.Clientset
|
||||
topologyClient *topologyclientset.Clientset
|
||||
|
|
Loading…
Reference in a new issue