mirror of
https://github.com/replicatedhq/troubleshoot.git
synced 2026-02-14 18:29:53 +00:00
* feat: node metrics analyser The analyser only checks PVC usage at the moment. More analysers can be added on a need to have basis * Add tests * Fix flaky test by waiting for goldpinger pods to start * Fix how outcomes get checked * Fix catch all outcome condition * Fix test * feat: node metrics analyser The analyser only checks PVC usage at the moment. More analysers can be added on a need to have basis * Add tests * Fix flaky test by waiting for goldpinger pods to start * Fix how outcomes get checked * Fix catch all outcome condition * Fix test * Regenerate schemas * Fix failing test --------- Co-authored-by: Dexter Yan <yanshaocong@gmail.com>
35 lines
570 B
Go
35 lines
570 B
Go
package analyzer
|
|
|
|
import "fmt"
|
|
|
|
type ComparisonOperator int
|
|
|
|
const (
|
|
Unknown ComparisonOperator = iota
|
|
Equal
|
|
NotEqual
|
|
GreaterThan
|
|
GreaterThanOrEqual
|
|
LessThan
|
|
LessThanOrEqual
|
|
)
|
|
|
|
func ParseComparisonOperator(s string) (ComparisonOperator, error) {
|
|
switch s {
|
|
case "=", "==", "===":
|
|
return Equal, nil
|
|
case "!=", "!==":
|
|
return NotEqual, nil
|
|
case "<":
|
|
return LessThan, nil
|
|
case ">":
|
|
return GreaterThan, nil
|
|
case "<=":
|
|
return LessThanOrEqual, nil
|
|
case ">=":
|
|
return GreaterThanOrEqual, nil
|
|
}
|
|
|
|
return Unknown, fmt.Errorf("unknown operator: %s", s)
|
|
}
|