katatestutils: Add missing distro version constraints

Added the following distro version constraints for parity with the
kernel version constraints:

- `NeedDistroVersionGE()`
- `NeedDistroVersionLE()`
- `NeedDistroVersionNotEquals()`

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
This commit is contained in:
James O. D. Hunt 2019-05-09 15:37:57 +01:00
parent 2bc03f23e0
commit 0c207c16ef
2 changed files with 42 additions and 0 deletions

View File

@ -190,6 +190,22 @@ func NeedDistroVersionEquals(version string) Constraint {
return NeedDistroVersionWithOp(version, eqOperator)
}
// NeedDistroVersionNotEquals will skip the test unless the distro version is
// different to the specified version.
//
// Note: distro versions vary in format.
func NeedDistroVersionNotEquals(version string) Constraint {
return NeedDistroVersionWithOp(version, neOperator)
}
// NeedDistroVersionLE will skip the test unless the distro version is older
// than or the same as the specified version.
//
// Note: distro versions vary in format.
func NeedDistroVersionLE(version string) Constraint {
return NeedDistroVersionWithOp(version, leOperator)
}
// NeedDistroVersionLT will skip the test unless the distro version is older
// than the specified version.
//
@ -198,6 +214,14 @@ func NeedDistroVersionLT(version string) Constraint {
return NeedDistroVersionWithOp(version, ltOperator)
}
// NeedDistroVersionGE will skip the test unless the distro version is newer
// than or the same as the specified version.
//
// Note: distro versions vary in format.
func NeedDistroVersionGE(version string) Constraint {
return NeedDistroVersionWithOp(version, geOperator)
}
// NeedDistroVersionGT will skip the test unless the distro version is newer
// than the specified version.
//

View File

@ -1295,17 +1295,35 @@ func TestConstraintNotValidDistroVersion(t *testing.T) {
result = tc.NotValid(NeedDistroVersionEquals(distroVersion))
assert.False(result)
result = tc.NotValid(NeedDistroVersionLE(higherVersion))
assert.False(result)
result = tc.NotValid(NeedDistroVersionLE(distroVersion))
assert.False(result)
result = tc.NotValid(NeedDistroVersionLT(higherVersion))
assert.False(result)
result = tc.NotValid(NeedDistroVersionLT(distroVersion))
assert.True(result)
result = tc.NotValid(NeedDistroVersionGE(higherVersion))
assert.True(result)
result = tc.NotValid(NeedDistroVersionGE(distroVersion))
assert.False(result)
result = tc.NotValid(NeedDistroVersionGT(higherVersion))
assert.True(result)
result = tc.NotValid(NeedDistroVersionGT(distroVersion))
assert.True(result)
result = tc.NotValid(NeedDistroVersionNotEquals(higherVersion))
assert.False(result)
result = tc.NotValid(NeedDistroVersionNotEquals(distroVersion))
assert.True(result)
}
}