fix lint errors
parent
280ecd4d4b
commit
eea20cd06f
|
@ -37,9 +37,9 @@ var FOLDER = "site/static/images/benchmarks/cpuUsage/autoPause"
|
|||
|
||||
type integerTicks struct{}
|
||||
|
||||
func (integerTicks) Ticks(min, max float64) []plot.Tick {
|
||||
func (integerTicks) Ticks(minimum, maximum float64) []plot.Tick {
|
||||
var t []plot.Tick
|
||||
for i := math.Trunc(min); i <= max; i += 50 {
|
||||
for i := math.Trunc(minimum); i <= maximum; i += 50 {
|
||||
t = append(t, plot.Tick{Value: i, Label: fmt.Sprint(i)})
|
||||
}
|
||||
return t
|
||||
|
|
|
@ -36,9 +36,9 @@ var FOLDER = "site/static/images/benchmarks/cpuUsage/idleOnly"
|
|||
|
||||
type integerTicks struct{}
|
||||
|
||||
func (integerTicks) Ticks(min, max float64) []plot.Tick {
|
||||
func (integerTicks) Ticks(minimum, maximum float64) []plot.Tick {
|
||||
var t []plot.Tick
|
||||
for i := math.Trunc(min); i <= max; i += 50 {
|
||||
for i := math.Trunc(minimum); i <= maximum; i += 50 {
|
||||
t = append(t, plot.Tick{Value: i, Label: fmt.Sprint(i)})
|
||||
}
|
||||
return t
|
||||
|
|
|
@ -327,8 +327,8 @@ func parsePortRange(rawPortRange string) (int, int, error) {
|
|||
return minPort, maxPort, nil
|
||||
}
|
||||
|
||||
func getRandomPortNumberInRange(min, max int) int {
|
||||
return rand.Intn(max-min) + min
|
||||
func getRandomPortNumberInRange(minimum, maximum int) int {
|
||||
return rand.Intn(maximum-minimum) + minimum
|
||||
}
|
||||
|
||||
func getAvailableTCPPortFromRange(minPort, maxPort int) (int, error) {
|
||||
|
|
|
@ -268,8 +268,8 @@ func (m *MemoryAsset) GetLength() int {
|
|||
}
|
||||
|
||||
// SetLength returns length
|
||||
func (m *MemoryAsset) SetLength(len int) {
|
||||
m.length = len
|
||||
func (m *MemoryAsset) SetLength(length int) {
|
||||
m.length = length
|
||||
}
|
||||
|
||||
// Read reads the asset
|
||||
|
@ -403,8 +403,8 @@ func (m *BinAsset) GetLength() int {
|
|||
}
|
||||
|
||||
// SetLength sets length
|
||||
func (m *BinAsset) SetLength(len int) {
|
||||
m.length = len
|
||||
func (m *BinAsset) SetLength(length int) {
|
||||
m.length = length
|
||||
}
|
||||
|
||||
// Read reads the asset
|
||||
|
|
|
@ -507,13 +507,13 @@ func (r *Containerd) StopContainers(ids []string) error {
|
|||
}
|
||||
|
||||
// ContainerLogCmd returns the command to retrieve the log for a container based on ID
|
||||
func (r *Containerd) ContainerLogCmd(id string, len int, follow bool) string {
|
||||
return criContainerLogCmd(r.Runner, id, len, follow)
|
||||
func (r *Containerd) ContainerLogCmd(id string, length int, follow bool) string {
|
||||
return criContainerLogCmd(r.Runner, id, length, follow)
|
||||
}
|
||||
|
||||
// SystemLogCmd returns the command to retrieve system logs
|
||||
func (r *Containerd) SystemLogCmd(len int) string {
|
||||
return fmt.Sprintf("sudo journalctl -u containerd -n %d", len)
|
||||
func (r *Containerd) SystemLogCmd(length int) string {
|
||||
return fmt.Sprintf("sudo journalctl -u containerd -n %d", length)
|
||||
}
|
||||
|
||||
// Preload preloads the container runtime with k8s images
|
||||
|
|
|
@ -329,14 +329,14 @@ func listCRIImages(cr CommandRunner) ([]ListImage, error) {
|
|||
}
|
||||
|
||||
// criContainerLogCmd returns the command to retrieve the log for a container based on ID
|
||||
func criContainerLogCmd(cr CommandRunner, id string, len int, follow bool) string {
|
||||
func criContainerLogCmd(cr CommandRunner, id string, length int, follow bool) string {
|
||||
crictl := getCrictlPath(cr)
|
||||
var cmd strings.Builder
|
||||
cmd.WriteString("sudo ")
|
||||
cmd.WriteString(crictl)
|
||||
cmd.WriteString(" logs ")
|
||||
if len > 0 {
|
||||
cmd.WriteString(fmt.Sprintf("--tail %d ", len))
|
||||
if length > 0 {
|
||||
cmd.WriteString(fmt.Sprintf("--tail %d ", length))
|
||||
}
|
||||
if follow {
|
||||
cmd.WriteString("--follow ")
|
||||
|
|
|
@ -406,13 +406,13 @@ func (r *CRIO) StopContainers(ids []string) error {
|
|||
}
|
||||
|
||||
// ContainerLogCmd returns the command to retrieve the log for a container based on ID
|
||||
func (r *CRIO) ContainerLogCmd(id string, len int, follow bool) string {
|
||||
return criContainerLogCmd(r.Runner, id, len, follow)
|
||||
func (r *CRIO) ContainerLogCmd(id string, length int, follow bool) string {
|
||||
return criContainerLogCmd(r.Runner, id, length, follow)
|
||||
}
|
||||
|
||||
// SystemLogCmd returns the command to retrieve system logs
|
||||
func (r *CRIO) SystemLogCmd(len int) string {
|
||||
return fmt.Sprintf("sudo journalctl -u crio -n %d", len)
|
||||
func (r *CRIO) SystemLogCmd(length int) string {
|
||||
return fmt.Sprintf("sudo journalctl -u crio -n %d", length)
|
||||
}
|
||||
|
||||
// Preload preloads the container runtime with k8s images
|
||||
|
|
|
@ -524,14 +524,14 @@ func (r *Docker) UnpauseContainers(ids []string) error {
|
|||
}
|
||||
|
||||
// ContainerLogCmd returns the command to retrieve the log for a container based on ID
|
||||
func (r *Docker) ContainerLogCmd(id string, len int, follow bool) string {
|
||||
func (r *Docker) ContainerLogCmd(id string, length int, follow bool) string {
|
||||
if r.UseCRI {
|
||||
return criContainerLogCmd(r.Runner, id, len, follow)
|
||||
return criContainerLogCmd(r.Runner, id, length, follow)
|
||||
}
|
||||
var cmd strings.Builder
|
||||
cmd.WriteString("docker logs ")
|
||||
if len > 0 {
|
||||
cmd.WriteString(fmt.Sprintf("--tail %d ", len))
|
||||
if length > 0 {
|
||||
cmd.WriteString(fmt.Sprintf("--tail %d ", length))
|
||||
}
|
||||
if follow {
|
||||
cmd.WriteString("--follow ")
|
||||
|
@ -542,8 +542,8 @@ func (r *Docker) ContainerLogCmd(id string, len int, follow bool) string {
|
|||
}
|
||||
|
||||
// SystemLogCmd returns the command to retrieve system logs
|
||||
func (r *Docker) SystemLogCmd(len int) string {
|
||||
return fmt.Sprintf("sudo journalctl -u docker -u cri-docker -n %d", len)
|
||||
func (r *Docker) SystemLogCmd(length int) string {
|
||||
return fmt.Sprintf("sudo journalctl -u docker -u cri-docker -n %d", length)
|
||||
}
|
||||
|
||||
type dockerDaemonConfig struct {
|
||||
|
|
|
@ -65,16 +65,10 @@ func TestNewBinary(t *testing.T) {
|
|||
for _, test := range tests {
|
||||
t.Run(test.input, func(t *testing.T) {
|
||||
bin, err := NewBinary(test.input)
|
||||
if err == nil && test.errExpected {
|
||||
t.Fatalf("Input %v returned unexpected error", test.input)
|
||||
if wantErr, gotErr := test.errExpected, (err != nil); wantErr != gotErr {
|
||||
t.Fatalf("NewBinary(%s) returned err = %v; expected err %t", test.input, err, wantErr)
|
||||
}
|
||||
if test.errExpected {
|
||||
return
|
||||
}
|
||||
if bin == nil {
|
||||
t.Fatalf("Input string(%v) returned unexpected empty binary", test.input)
|
||||
}
|
||||
if !strings.Contains(bin.path, test.prNum) {
|
||||
if err == nil && !strings.Contains(bin.path, test.prNum) {
|
||||
t.Fatalf("Binary path(%v) doesn't contain expected(%v)", bin.path, test.prNum)
|
||||
}
|
||||
})
|
||||
|
|
|
@ -148,13 +148,13 @@ var Inspect = func(addr string) (*Parameters, error) {
|
|||
}
|
||||
gatewayIP := binary.BigEndian.Uint32(gateway)
|
||||
|
||||
min := make(net.IP, 4)
|
||||
binary.BigEndian.PutUint32(min, gatewayIP+1) // clients-from: first network IP address after gateway
|
||||
n.ClientMin = min.String()
|
||||
minIP := make(net.IP, 4)
|
||||
binary.BigEndian.PutUint32(minIP, gatewayIP+1) // clients-from: first network IP address after gateway
|
||||
n.ClientMin = minIP.String()
|
||||
|
||||
max := make(net.IP, 4)
|
||||
binary.BigEndian.PutUint32(max, broadcastIP-1) // clients-to: last network IP address before broadcast
|
||||
n.ClientMax = max.String()
|
||||
maxIP := make(net.IP, 4)
|
||||
binary.BigEndian.PutUint32(maxIP, broadcastIP-1) // clients-to: last network IP address before broadcast
|
||||
n.ClientMax = maxIP.String()
|
||||
|
||||
return n, nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue