mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-04 01:40:07 +00:00
Cleanup printer test package.
Updates internalversion BUILD file dependencies Removes pkg/printers/internalversion from staticcheck failures
This commit is contained in:
parent
cc56738a9e
commit
30d8a93768
@ -28,7 +28,6 @@ pkg/kubelet/pluginmanager/pluginwatcher
|
|||||||
pkg/kubelet/remote
|
pkg/kubelet/remote
|
||||||
pkg/master
|
pkg/master
|
||||||
pkg/printers
|
pkg/printers
|
||||||
pkg/printers/internalversion
|
|
||||||
pkg/probe/http
|
pkg/probe/http
|
||||||
pkg/proxy/healthcheck
|
pkg/proxy/healthcheck
|
||||||
pkg/proxy/iptables
|
pkg/proxy/iptables
|
||||||
|
@ -20,12 +20,14 @@ go_test(
|
|||||||
"//pkg/apis/apps:go_default_library",
|
"//pkg/apis/apps:go_default_library",
|
||||||
"//pkg/apis/autoscaling:go_default_library",
|
"//pkg/apis/autoscaling:go_default_library",
|
||||||
"//pkg/apis/batch:go_default_library",
|
"//pkg/apis/batch:go_default_library",
|
||||||
|
"//pkg/apis/certificates:go_default_library",
|
||||||
"//pkg/apis/coordination:go_default_library",
|
"//pkg/apis/coordination:go_default_library",
|
||||||
"//pkg/apis/core:go_default_library",
|
"//pkg/apis/core:go_default_library",
|
||||||
"//pkg/apis/discovery:go_default_library",
|
"//pkg/apis/discovery:go_default_library",
|
||||||
"//pkg/apis/networking:go_default_library",
|
"//pkg/apis/networking:go_default_library",
|
||||||
"//pkg/apis/node:go_default_library",
|
"//pkg/apis/node:go_default_library",
|
||||||
"//pkg/apis/policy:go_default_library",
|
"//pkg/apis/policy:go_default_library",
|
||||||
|
"//pkg/apis/rbac:go_default_library",
|
||||||
"//pkg/apis/scheduling:go_default_library",
|
"//pkg/apis/scheduling:go_default_library",
|
||||||
"//pkg/apis/storage:go_default_library",
|
"//pkg/apis/storage:go_default_library",
|
||||||
"//pkg/printers:go_default_library",
|
"//pkg/printers:go_default_library",
|
||||||
|
@ -17,9 +17,7 @@ limitations under the License.
|
|||||||
package internalversion
|
package internalversion
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
|
||||||
"reflect"
|
"reflect"
|
||||||
"strings"
|
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -4757,41 +4755,3 @@ func TestPrintEndpointSlice(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func verifyTable(t *testing.T, table *metav1beta1.Table) {
|
|
||||||
var panicErr interface{}
|
|
||||||
func() {
|
|
||||||
defer func() {
|
|
||||||
panicErr = recover()
|
|
||||||
}()
|
|
||||||
table.DeepCopyObject() // cells are untyped, better check that types are JSON types and can be deep copied
|
|
||||||
}()
|
|
||||||
|
|
||||||
if panicErr != nil {
|
|
||||||
t.Errorf("unexpected panic during deepcopy of table %#v: %v", table, panicErr)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// VerifyDatesInOrder checks the start of each line for a RFC1123Z date
|
|
||||||
// and posts error if all subsequent dates are not equal or increasing
|
|
||||||
func VerifyDatesInOrder(
|
|
||||||
resultToTest, rowDelimiter, columnDelimiter string, t *testing.T) {
|
|
||||||
lines := strings.Split(resultToTest, rowDelimiter)
|
|
||||||
var previousTime time.Time
|
|
||||||
for _, str := range lines {
|
|
||||||
columns := strings.Split(str, columnDelimiter)
|
|
||||||
if len(columns) > 0 {
|
|
||||||
currentTime, err := time.Parse(time.RFC1123Z, columns[0])
|
|
||||||
if err == nil {
|
|
||||||
if previousTime.After(currentTime) {
|
|
||||||
t.Errorf(
|
|
||||||
"Output is not sorted by time. %s should be listed after %s. Complete output: %s",
|
|
||||||
previousTime.Format(time.RFC1123Z),
|
|
||||||
currentTime.Format(time.RFC1123Z),
|
|
||||||
resultToTest)
|
|
||||||
}
|
|
||||||
previousTime = currentTime
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user