Skip to content

Commit 794630f

Browse files
authored
Merge pull request #1489 from ArangoGutierrez/ginkofocus
Makefile: add env var controls to make test targets configurable
2 parents fae0825 + f9195ef commit 794630f

File tree

7 files changed

+40
-26
lines changed

7 files changed

+40
-26
lines changed

Makefile

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ HOSTMOUNT_PREFIX ?= /
5656
KUBECONFIG ?= ${HOME}/.kube/config
5757
E2E_TEST_CONFIG ?=
5858
E2E_PULL_IF_NOT_PRESENT ?= false
59+
E2E_TEST_FULL_IMAGE ?= false
60+
E2E_GINKGO_LABEL_FILTER ?=
5961

6062
BUILD_FLAGS = -tags osusergo,netgo \
6163
-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:
191193
-kubeconfig=$(KUBECONFIG) \
192194
-nfd.e2e-config=$(E2E_TEST_CONFIG) \
193195
-nfd.pull-if-not-present=$(E2E_PULL_IF_NOT_PRESENT) \
194-
-ginkgo.focus="\[kubernetes-sigs\]" \
195-
-test.timeout=1h \
196-
$(if $(OPENSHIFT),-nfd.openshift,)
197-
$(GO_CMD) test -v ./test/e2e/ -args -nfd.repo=$(IMAGE_REPO) -nfd.tag=$(IMAGE_TAG_NAME)-full \
198-
-kubeconfig=$(KUBECONFIG) \
199-
-nfd.e2e-config=$(E2E_TEST_CONFIG) \
200-
-nfd.pull-if-not-present=$(E2E_PULL_IF_NOT_PRESENT) \
201-
-ginkgo.focus="\[kubernetes-sigs\]" \
196+
-ginkgo.focus="\[k8s-sigs\/node-feature-discovery\]" \
197+
-ginkgo.label-filter=$(E2E_GINKGO_LABEL_FILTER) \
202198
-test.timeout=1h \
203199
$(if $(OPENSHIFT),-nfd.openshift,)
200+
@if [ "$(E2E_TEST_FULL_IMAGE)" = "true" ]; then \
201+
$(GO_CMD) test -v ./test/e2e/ -args -nfd.repo=$(IMAGE_REPO) -nfd.tag=$(IMAGE_TAG_NAME)-full \
202+
-kubeconfig=$(KUBECONFIG) \
203+
-nfd.e2e-config=$(E2E_TEST_CONFIG) \
204+
-nfd.pull-if-not-present=$(E2E_PULL_IF_NOT_PRESENT) \
205+
-ginkgo.focus="\[k8s-sigs\/node-feature-discovery\]" \
206+
-ginkgo.label-filter=$(E2E_GINKGO_LABEL_FILTER) \
207+
-test.timeout=1h \
208+
$(if $(OPENSHIFT),-nfd.openshift,)
209+
fi
204210

205211
push:
206212
$(IMAGE_PUSH_CMD) $(IMAGE_TAG)

docs/developer-guide/index.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,6 @@ makefile overrides.
121121
| IMAGE_TAG_NAME | Container image tag name | <nfd version> |
122122
| IMAGE_EXTRA_TAG_NAMES | Additional container image tag(s) to create when building image | *empty* |
123123
| K8S_NAMESPACE | nfd-master and nfd-worker namespace | node-feature-discovery |
124-
| KUBECONFIG | Kubeconfig for running e2e-tests | *empty* |
125-
| E2E_TEST_CONFIG | Parameterization file of e2e-tests (see [example][e2e-config-sample]) | *empty* |
126-
| E2E_PULL_IF_NOT_PRESENT | True-ish value makes the image pull policy IfNotPresent (to be used only in e2e tests) | false |
127-
| OPENSHIFT | Non-empty value enables OpenShift specific support (only affects e2e tests) | *empty* |
128124

129125
For example, to use a custom registry:
130126

@@ -163,6 +159,18 @@ cluster you need to specify the kubeconfig to be used:
163159
make e2e-test KUBECONFIG=$HOME/.kube/config
164160
```
165161

162+
There are several environment variables that can be used to customize the
163+
e2e-tests:
164+
165+
| Variable | Description | Default value |
166+
| -------------------------- | ----------------------------------------------------------------- | ------------- |
167+
| KUBECONFIG | Kubeconfig for running e2e-tests | *empty* |
168+
| E2E_TEST_CONFIG | Parameterization file of e2e-tests (see [example][e2e-config-sample]) | *empty* |
169+
| E2E_PULL_IF_NOT_PRESENT | True-ish value makes the image pull policy IfNotPresent (to be used only in e2e tests) | false |
170+
| E2E_TEST_FULL_IMAGE | Run e2e-test also against the Full Image tag | false |
171+
| E2E_GINKGO_LABEL_FILTER | Ginkgo label filter to use for running e2e tests | *empty* |
172+
| OPENSHIFT | Non-empty value enables OpenShift specific support (only affects e2e tests) | *empty* |
173+
166174
## Running locally
167175

168176
> ****DEPRECATED**: Running NFD locally is deprecated and will be removed in a

scripts/test-infra/test-e2e.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ chmod a+x /usr/local/bin/kubectl
1111
# Configure environment
1212
export KUBECONFIG=`pwd`/kubeconfig
1313
export E2E_TEST_CONFIG=`pwd`/e2e-test-config
14+
export E2E_TEST_FULL_IMAGE=true
1415

1516
echo "$KUBECONFIG_DATA" > "$KUBECONFIG"
1617
echo "$E2E_TEST_CONFIG_DATA" > "$E2E_TEST_CONFIG"

test/e2e/framework.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2021 The Kubernetes Authors.
2+
Copyright 2023 The Kubernetes Authors.
33
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.
@@ -18,7 +18,6 @@ package e2e
1818

1919
import "github.com/onsi/ginkgo/v2"
2020

21-
// SIGDescribe annotates the test with the SIG label.
22-
func SIGDescribe(text string, body func()) bool {
23-
return ginkgo.Describe("[kubernetes-sigs] "+text, body)
21+
func NFDDescribe(args ...interface{}) bool {
22+
return ginkgo.Describe("[k8s-sigs/node-feature-discovery]", append(args, ginkgo.Label("nfd-all"))...)
2423
}

test/e2e/nfd_gc_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ import (
3838
)
3939

4040
// Actual test suite
41-
var _ = SIGDescribe("NFD GC", func() {
41+
var _ = NFDDescribe(Label("nfd-gc"), func() {
4242
f := framework.NewDefaultFramework("nfd-gc")
4343

4444
Context("when deploying nfd-gc", Ordered, func() {
@@ -117,7 +117,7 @@ var _ = SIGDescribe("NFD GC", func() {
117117
// Test GC at startup
118118
//
119119
Context("with pre-existing NodeFeature and NodeResourceTopology objects", func() {
120-
It("it should delete stale objects at startup", func(ctx context.Context) {
120+
It("it should delete stale objects at startup", Label("gc-startup"), func(ctx context.Context) {
121121
nodes, err := f.ClientSet.CoreV1().Nodes().List(ctx, metav1.ListOptions{})
122122
Expect(err).NotTo(HaveOccurred())
123123
targetNodeNames := []string{nodes.Items[0].GetName()}
@@ -153,7 +153,7 @@ var _ = SIGDescribe("NFD GC", func() {
153153
// Test periodic GC
154154
//
155155
Context("with stale NodeFeature and NodeResourceTopology objects appearing", func() {
156-
It("it should remove stale objects", func(ctx context.Context) {
156+
It("it should remove stale objects", Label("gc-periodic"), func(ctx context.Context) {
157157
nodes, err := f.ClientSet.CoreV1().Nodes().List(ctx, metav1.ListOptions{})
158158
Expect(err).NotTo(HaveOccurred())
159159
targetNodeNames := []string{nodes.Items[0].GetName()}

test/e2e/node_feature_discovery_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ func cleanupCRs(ctx context.Context, cli *nfdclient.Clientset, namespace string)
183183
}
184184

185185
// Actual test suite
186-
var _ = SIGDescribe("NFD master and worker", func() {
186+
var _ = NFDDescribe(Label("nfd-master"), func() {
187187
f := framework.NewDefaultFramework("node-feature-discovery")
188188

189189
nfdTestSuite := func(useNodeFeatureApi bool) {
@@ -278,7 +278,7 @@ var _ = SIGDescribe("NFD master and worker", func() {
278278
// Simple test with only the fake source enabled
279279
//
280280
Context("and a single worker pod with fake source enabled", func() {
281-
It("it should decorate the node with the fake feature labels", func(ctx context.Context) {
281+
It("it should decorate the node with the fake feature labels", Label("nfd-worker"), func(ctx context.Context) {
282282
nodes, err := getNonControlPlaneNodes(ctx, f.ClientSet)
283283
Expect(err).NotTo(HaveOccurred())
284284

@@ -327,7 +327,7 @@ var _ = SIGDescribe("NFD master and worker", func() {
327327
// More comprehensive test when --e2e-node-config is enabled
328328
//
329329
Context("and nfd-workers as a daemonset with default sources enabled", func() {
330-
It("the node labels and annotations listed in the e2e config should be present", func(ctx context.Context) {
330+
It("the node labels and annotations listed in the e2e config should be present", Label("nfd-worker"), func(ctx context.Context) {
331331
cfg, err := testutils.GetConfig()
332332
Expect(err).ToNot(HaveOccurred())
333333

@@ -419,7 +419,7 @@ var _ = SIGDescribe("NFD master and worker", func() {
419419
// Test custom nodename source configured in 2 additional ConfigMaps
420420
//
421421
Context("and nfd-workers as a daemonset with 2 additional configmaps for the custom source configured", func() {
422-
It("the nodename matching features listed in the configmaps should be present", func(ctx context.Context) {
422+
It("the nodename matching features listed in the configmaps should be present", Label("nfd-worker"), func(ctx context.Context) {
423423
By("Getting a worker node")
424424

425425
// We need a valid nodename for the configmap
@@ -523,7 +523,7 @@ var _ = SIGDescribe("NFD master and worker", func() {
523523
),
524524
}
525525
})
526-
It("labels from the NodeFeature objects should be created", func(ctx context.Context) {
526+
It("labels from the NodeFeature objects should be created", Label("nfd-worker"), func(ctx context.Context) {
527527
if !useNodeFeatureApi {
528528
Skip("NodeFeature API not enabled")
529529
}
@@ -682,7 +682,7 @@ var _ = SIGDescribe("NFD master and worker", func() {
682682
testpod.SpecWithTolerations(testTolerations),
683683
}
684684
})
685-
It("custom features from the NodeFeatureRule rules should be created", func(ctx context.Context) {
685+
It("custom features from the NodeFeatureRule rules should be created", Label("nfd-worker"), func(ctx context.Context) {
686686
nodes, err := getNonControlPlaneNodes(ctx, f.ClientSet)
687687
Expect(err).NotTo(HaveOccurred())
688688

test/e2e/topology_updater_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ import (
4646
testpod "sigs.k8s.io/node-feature-discovery/test/e2e/utils/pod"
4747
)
4848

49-
var _ = SIGDescribe("NFD topology updater", func() {
49+
var _ = NFDDescribe(Label("nfd-topology-updater"), func() {
5050
var (
5151
extClient *extclient.Clientset
5252
topologyClient *topologyclientset.Clientset

0 commit comments

Comments
 (0)