Skip to content

Commit

Permalink
Update tests that check conditions
Browse files Browse the repository at this point in the history
Update test that check nnce conditions to tolerate both
failing and aborted conditions when invalid nncp is created

Signed-off-by: Radim Hrazdil <[email protected]>
  • Loading branch information
Radim Hrazdil committed Mar 16, 2021
1 parent b9b1be6 commit b68843e
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 26 deletions.
60 changes: 35 additions & 25 deletions test/e2e/handler/nnce_conditions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,29 @@ func invalidConfig(bridgeName string) nmstate.State {
`, bridgeName))
}

var _ = Describe("[rfe_id:3503][crit:medium][vendor:[email protected]][level:component]EnactmentCondition", func() {
var _ = FDescribe("[rfe_id:3503][crit:medium][vendor:[email protected]][level:component]EnactmentCondition", func() {
var abortedEnactmentConditions = []interface{}{
shared.Condition{
Type: shared.NodeNetworkConfigurationEnactmentConditionFailing,
Status: corev1.ConditionFalse,
},
shared.Condition{
Type: shared.NodeNetworkConfigurationEnactmentConditionAvailable,
Status: corev1.ConditionFalse,
},
shared.Condition{
Type: shared.NodeNetworkConfigurationEnactmentConditionProgressing,
Status: corev1.ConditionFalse,
},
shared.Condition{
Type: shared.NodeNetworkConfigurationEnactmentConditionMatching,
Status: corev1.ConditionTrue,
},
shared.Condition{
Type: shared.NodeNetworkConfigurationEnactmentConditionAborted,
Status: corev1.ConditionTrue,
},
}
Context("when applying valid config", func() {
BeforeEach(func() {
})
Expand Down Expand Up @@ -143,7 +165,12 @@ var _ = Describe("[rfe_id:3503][crit:medium][vendor:[email protected]][level:com
It("[test_id:3795][parallel] should have Failing ConditionType set to true", func() {
for _, node := range nodes {
By(fmt.Sprintf("Check %s failing state is reached", node))
enactmentConditionsStatusEventually(node).Should(ConsistOf(failingEnactmentConditions...), "should eventually reach failing conditions at enactments")
enactmentConditionsStatusEventually(node).Should(
SatisfyAny(
ConsistOf(failingEnactmentConditions...),
ConsistOf(abortedEnactmentConditions...),
), "should eventually reach failing or aborted conditions at enactments",
)
}
By("Check policy is at degraded state")
waitForDegradedTestPolicy()
Expand All @@ -157,35 +184,18 @@ var _ = Describe("[rfe_id:3503][crit:medium][vendor:[email protected]][level:com
defer wg.Done()
defer GinkgoRecover()
By(fmt.Sprintf("Check %s failing state is kept", node))
enactmentConditionsStatusConsistently(node).Should(ConsistOf(failingEnactmentConditions...), "should consistently keep failing conditions at enactments")
enactmentConditionsStatusConsistently(node).Should(
SatisfyAny(
ConsistOf(failingEnactmentConditions...),
ConsistOf(abortedEnactmentConditions...),
), "should consistently keep failing or aborted conditions at enactments",
)
}()
}
wg.Wait()
})

It("[test_id:3795][sequential] should have one Failing the rest Aborted ConditionType set to true", func() {
var abortedEnactmentConditions = []interface{}{
shared.Condition{
Type: shared.NodeNetworkConfigurationEnactmentConditionFailing,
Status: corev1.ConditionFalse,
},
shared.Condition{
Type: shared.NodeNetworkConfigurationEnactmentConditionAvailable,
Status: corev1.ConditionFalse,
},
shared.Condition{
Type: shared.NodeNetworkConfigurationEnactmentConditionProgressing,
Status: corev1.ConditionFalse,
},
shared.Condition{
Type: shared.NodeNetworkConfigurationEnactmentConditionMatching,
Status: corev1.ConditionTrue,
},
shared.Condition{
Type: shared.NodeNetworkConfigurationEnactmentConditionAborted,
Status: corev1.ConditionTrue,
},
}
checkEnactmentCounts := func(policy string) {
failingConditions := 0
abortedConditions := 0
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/handler/nncp_parallel_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func enactmentsInProgress(policy string) int {
return progressingEnactments
}

var _ = Describe("NNCP with maxUnavailable", func() {
var _ = FDescribe("NNCP with maxUnavailable", func() {
Context("when applying a policy to matching nodes", func() {
BeforeEach(func() {
By("Create a policy")
Expand Down

0 comments on commit b68843e

Please sign in to comment.