mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-07-31 23:36:12 +00:00
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:
parent
2bc03f23e0
commit
0c207c16ef
@ -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.
|
||||
//
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user