Skip to content

Commit 9d1ae04

Browse files
committed
tests/types: add configMax version to expand blackbox testing flexability
Add a field which can limit the max version of config generated from blackbox testing. If left blank blackbox tests will act as they always have. The new field simply limits the registration of tests to that version number. This is for the odd case where we want to ensure functionality does not exist when using older versions of configs.
1 parent 84ca89a commit 9d1ae04

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

tests/register/register.go

+9
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,15 @@ func Register(tType TestType, t types.Test) {
6363
if semverErr == nil && version != nil && t.ConfigMinVersion != "" {
6464
for _, v := range configVersions[version.Major] {
6565
if version.LessThan(v) {
66+
// Check if the test is limited to a max version
67+
if test.ConfigMaxVersion != "" {
68+
maximumVersion, maxVersionSemverErr := semver.NewVersion(test.ConfigMinVersion)
69+
// If a valid max version is given and the next deep copy is greater than the max version then we dont register it
70+
if maxVersionSemverErr == nil && maximumVersion.LessThan(v) {
71+
continue
72+
}
73+
}
74+
6675
test = types.DeepCopy(t)
6776
test.ReplaceAllVersionVars(v.String())
6877
test.ConfigVersion = v.String()

tests/types/types.go

+1
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ type Test struct {
101101
SystemDirFiles []File
102102
Env []string // Environment variables for Ignition
103103
Config string
104+
ConfigMaxVersion string
104105
ConfigMinVersion string
105106
ConfigVersion string
106107
ConfigShouldBeBad bool // Set to true to skip config validation step

0 commit comments

Comments
 (0)