fix golint issues in test/e2e_node

This commit is contained in:
SataQiu
2019-11-07 11:59:05 +08:00
parent 41757d673e
commit d2bdf89a8b
44 changed files with 104 additions and 101 deletions

View File

@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
package e2e_node
package e2enode
import (
"fmt"
@@ -72,19 +72,19 @@ var _ = framework.KubeDescribe("ResourceMetricsAPI", func() {
matchV1alpha1Expectations := gstruct.MatchAllKeys(gstruct.Keys{
"scrape_error": gstruct.Ignore(),
"node_cpu_usage_seconds_total": gstruct.MatchAllElements(nodeId, gstruct.Elements{
"node_cpu_usage_seconds_total": gstruct.MatchAllElements(nodeID, gstruct.Elements{
"": boundedSample(1, 1e6),
}),
"node_memory_working_set_bytes": gstruct.MatchAllElements(nodeId, gstruct.Elements{
"node_memory_working_set_bytes": gstruct.MatchAllElements(nodeID, gstruct.Elements{
"": boundedSample(10*volume.Mb, memoryLimit),
}),
"container_cpu_usage_seconds_total": gstruct.MatchElements(containerId, gstruct.IgnoreExtras, gstruct.Elements{
"container_cpu_usage_seconds_total": gstruct.MatchElements(containerID, gstruct.IgnoreExtras, gstruct.Elements{
fmt.Sprintf("%s::%s::%s", f.Namespace.Name, pod0, "busybox-container"): boundedSample(0, 100),
fmt.Sprintf("%s::%s::%s", f.Namespace.Name, pod1, "busybox-container"): boundedSample(0, 100),
}),
"container_memory_working_set_bytes": gstruct.MatchAllElements(containerId, gstruct.Elements{
"container_memory_working_set_bytes": gstruct.MatchAllElements(containerID, gstruct.Elements{
fmt.Sprintf("%s::%s::%s", f.Namespace.Name, pod0, "busybox-container"): boundedSample(10*volume.Kb, 80*volume.Mb),
fmt.Sprintf("%s::%s::%s", f.Namespace.Name, pod1, "busybox-container"): boundedSample(10*volume.Kb, 80*volume.Mb),
}),
@@ -114,11 +114,11 @@ func getV1alpha1ResourceMetrics() (metrics.KubeletMetrics, error) {
return metrics.GrabKubeletMetricsWithoutProxy(framework.TestContext.NodeName+":10255", "/metrics/resource/"+kubeletresourcemetricsv1alpha1.Version)
}
func nodeId(element interface{}) string {
func nodeID(element interface{}) string {
return ""
}
func containerId(element interface{}) string {
func containerID(element interface{}) string {
el := element.(*model.Sample)
return fmt.Sprintf("%s::%s::%s", el.Metric["namespace"], el.Metric["pod"], el.Metric["container"])
}