@@ -21,7 +21,6 @@ import (
21
21
"crypto/sha256"
22
22
"encoding/json"
23
23
"fmt"
24
- "regexp"
25
24
"strconv"
26
25
"strings"
27
26
"time"
@@ -356,7 +355,6 @@ var _ = utils.SIGDescribe("CSI mock volume", func() {
356
355
ginkgo .Context ("CSI volume limit information using mock driver" , func () {
357
356
ginkgo .It ("should report attach limit when limit is bigger than 0 [Slow]" , func () {
358
357
// define volume limit to be 2 for this test
359
-
360
358
var err error
361
359
init (testParameters {attachLimit : 2 })
362
360
defer cleanup ()
@@ -563,19 +561,15 @@ var _ = utils.SIGDescribe("CSI mock volume", func() {
563
561
})
564
562
565
563
func waitForMaxVolumeCondition (pod * v1.Pod , cs clientset.Interface ) error {
566
- reg , err := regexp .Compile (`max.+volume.+count` )
567
- if err != nil {
568
- return err
569
- }
570
564
waitErr := wait .PollImmediate (10 * time .Second , csiPodUnschedulableTimeout , func () (bool , error ) {
571
- pod , err = cs .CoreV1 ().Pods (pod .Namespace ).Get (context .TODO (), pod .Name , metav1.GetOptions {})
565
+ pod , err : = cs .CoreV1 ().Pods (pod .Namespace ).Get (context .TODO (), pod .Name , metav1.GetOptions {})
572
566
if err != nil {
573
567
return false , err
574
568
}
575
- conditions := pod .Status .Conditions
576
- for _ , condition := range conditions {
577
- matched := reg . MatchString ( condition . Message )
578
- if condition . Reason == v1 .PodReasonUnschedulable && matched {
569
+ for _ , c := range pod .Status .Conditions {
570
+ // Conformance tests cannot rely on specific output of optional fields (e.g., Reason
571
+ // and Message) because these fields are not suject to the deprecation policy.
572
+ if c . Type == v1 .PodScheduled && c . Status == v1 . ConditionFalse && c . Reason != "" && c . Message != "" {
579
573
return true , nil
580
574
}
581
575
}
0 commit comments