1
0
Fork 0
mirror of https://github.com/kubernetes-sigs/node-feature-discovery.git synced 2025-03-06 16:57:10 +00:00
node-feature-discovery/test/e2e/data/nodefeaturerule-2.yaml
Markus Lehtonen 6ef6112d58 test/e2e: add tests for NodeFeatureRules
Add tests covering the basic functionality of NodeFeatureRule objects,
covering different feature types ("flag features", "attribute features"
and "instance features") as well as backreferencing (using the output of
previously run rules) and templating. The test relies on the "fake"
feature source and its default configuration.
2022-10-11 17:23:52 +03:00

41 lines
1.2 KiB
YAML

apiVersion: nfd.k8s-sigs.io/v1alpha1
kind: NodeFeatureRule
metadata:
name: e2e-test-2
spec:
rules:
#
# More complex rule testing backreferencing and matchAny field
#
- name: "e2e-matchany-test-1"
labels:
e2e-matchany-test-1: "true"
vars:
e2e-instance-test-1.not: "false"
matchFeatures:
- feature: "rule.matched"
matchExpressions:
"e2e-attribute-test-1": {op: InRegexp, value: ["^tru"]}
"e2e-instance-test-1.123": {op: In, value: ["1", "12", "123"]}
matchAny:
- matchFeatures:
- feature: "fake.instance"
matchExpressions:
"attr_1": {op: In, value: ["nomatch"]}
- matchFeatures:
- feature: "fake.instance"
matchExpressions:
"attr_3": {op: In, value: ["100"]}
#
# Simple test for templating
#
- name: "e2e-template-test-1"
labelsTemplate: |
{{ range .fake.instance }}e2e-template-test-1-{{ .name }}=found
{{ end }}
matchFeatures:
- feature: "fake.instance"
matchExpressions:
"attr_1": {op: In, value: ["true"]}