Revision 3446ec2b6020af2c8481fef379ebbdcbd04e9959 authored by Paul Chaignon on 21 April 2023, 11:46:42 UTC, committed by Nick Young on 26 July 2023, 01:02:34 UTC
[ upstream commit 67a3ab3533a7f77aa4241c0da6b04f5b31da9af9 ] [ Backporter's notes: the changes had to be manually backported to the appropriate files for v1.11, as they were renamed in ffd7e57b377f982fb57cf574564b7f1debef74a4 since then. (main > v1.11) test/k8s/datapath_configuration.go > test/k8sT/DatapathConfiguration.go ] If we check res.WasSuccessful() instead of res, then ginkgo won't print the error message in case the command wasn't successful. Signed-off-by: Paul Chaignon <paul@cilium.io> Signed-off-by: Nicolas Busseneau <nicolas@isovalent.com>
1 parent 0470ee5
monitor_test.go
// SPDX-License-Identifier: Apache-2.0
// Copyright 2018 Authors of Cilium
//go:build !privileged_tests
// +build !privileged_tests
package option
import (
"strconv"
. "gopkg.in/check.v1"
)
func (s *OptionSuite) TestVerifyMonitorAggregationLevel(c *C) {
c.Assert(VerifyMonitorAggregationLevel("", ""), IsNil)
c.Assert(VerifyMonitorAggregationLevel("", "none"), IsNil)
c.Assert(VerifyMonitorAggregationLevel("", "disabled"), IsNil)
c.Assert(VerifyMonitorAggregationLevel("", "lowest"), IsNil)
c.Assert(VerifyMonitorAggregationLevel("", "low"), IsNil)
c.Assert(VerifyMonitorAggregationLevel("", "medium"), IsNil)
c.Assert(VerifyMonitorAggregationLevel("", "max"), IsNil)
c.Assert(VerifyMonitorAggregationLevel("", "maximum"), IsNil)
c.Assert(VerifyMonitorAggregationLevel("", "LoW"), IsNil)
c.Assert(VerifyMonitorAggregationLevel("", "disable"), NotNil)
}
func (s *OptionSuite) TestParseMonitorAggregationLevel(c *C) {
level, err := ParseMonitorAggregationLevel("2")
c.Assert(err, IsNil)
c.Assert(level, Equals, MonitorAggregationLevelLow)
_, err = ParseMonitorAggregationLevel(strconv.Itoa(int(MonitorAggregationLevelMax) + 1))
c.Assert(err, NotNil)
_, err = ParseMonitorAggregationLevel("-1")
c.Assert(err, NotNil)
_, err = ParseMonitorAggregationLevel("foo")
c.Assert(err, NotNil)
level, err = ParseMonitorAggregationLevel("")
c.Assert(err, IsNil)
c.Assert(level, Equals, MonitorAggregationLevelNone)
level, err = ParseMonitorAggregationLevel("none")
c.Assert(err, IsNil)
c.Assert(level, Equals, MonitorAggregationLevelNone)
level, err = ParseMonitorAggregationLevel("disabled")
c.Assert(err, IsNil)
c.Assert(level, Equals, MonitorAggregationLevelNone)
level, err = ParseMonitorAggregationLevel("lowest")
c.Assert(err, IsNil)
c.Assert(level, Equals, MonitorAggregationLevelLowest)
level, err = ParseMonitorAggregationLevel("low")
c.Assert(err, IsNil)
c.Assert(level, Equals, MonitorAggregationLevelLow)
level, err = ParseMonitorAggregationLevel("medium")
c.Assert(err, IsNil)
c.Assert(level, Equals, MonitorAggregationLevelMedium)
level, err = ParseMonitorAggregationLevel("max")
c.Assert(err, IsNil)
c.Assert(level, Equals, MonitorAggregationLevelMax)
level, err = ParseMonitorAggregationLevel("maximum")
c.Assert(err, IsNil)
c.Assert(level, Equals, MonitorAggregationLevelMax)
level, err = ParseMonitorAggregationLevel("LOW")
c.Assert(err, IsNil)
c.Assert(level, Equals, MonitorAggregationLevelLow)
}
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...