Files
troubleshoot/pkg/analyze/comparison.go
Evans Mungai db871e6889 feat: node metrics analyser (#1520)
* 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>
2024-04-09 12:14:10 +01:00

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)
}