mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-30 06:54:01 +00:00
Merge pull request #78378 from k-toyoda-pi/golint_test_e2e_common_s-v
Fix golint failure in e2e/common/util.go
This commit is contained in:
commit
c898ab2043
@ -34,13 +34,17 @@ import (
|
|||||||
"github.com/onsi/ginkgo"
|
"github.com/onsi/ginkgo"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Suite represents test suite.
|
||||||
type Suite string
|
type Suite string
|
||||||
|
|
||||||
const (
|
const (
|
||||||
E2E Suite = "e2e"
|
// E2E represents a test suite for e2e.
|
||||||
|
E2E Suite = "e2e"
|
||||||
|
// NodeE2E represents a test suite for node e2e.
|
||||||
NodeE2E Suite = "node e2e"
|
NodeE2E Suite = "node e2e"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// CurrentSuite represents current test suite.
|
||||||
var CurrentSuite Suite
|
var CurrentSuite Suite
|
||||||
|
|
||||||
// CommonImageWhiteList is the list of images used in common test. These images should be prepulled
|
// CommonImageWhiteList is the list of images used in common test. These images should be prepulled
|
||||||
@ -94,6 +98,7 @@ func init() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SubstituteImageName replaces image name in content.
|
||||||
func SubstituteImageName(content string) string {
|
func SubstituteImageName(content string) string {
|
||||||
contentWithImageName := new(bytes.Buffer)
|
contentWithImageName := new(bytes.Buffer)
|
||||||
tmpl, err := template.New("imagemanifest").Parse(content)
|
tmpl, err := template.New("imagemanifest").Parse(content)
|
||||||
@ -125,6 +130,7 @@ func svcByName(name string, port int) *v1.Service {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NewSVCByName creates a service by name.
|
||||||
func NewSVCByName(c clientset.Interface, ns, name string) error {
|
func NewSVCByName(c clientset.Interface, ns, name string) error {
|
||||||
const testPort = 9376
|
const testPort = 9376
|
||||||
_, err := c.CoreV1().Services(ns).Create(svcByName(name, testPort))
|
_, err := c.CoreV1().Services(ns).Create(svcByName(name, testPort))
|
||||||
@ -138,6 +144,7 @@ func NewRCByName(c clientset.Interface, ns, name string, replicas int32, gracePe
|
|||||||
name, replicas, framework.ServeHostnameImage, 9376, v1.ProtocolTCP, map[string]string{}, gracePeriod))
|
name, replicas, framework.ServeHostnameImage, 9376, v1.ProtocolTCP, map[string]string{}, gracePeriod))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// RestartNodes restarts specific nodes.
|
||||||
func RestartNodes(c clientset.Interface, nodes []v1.Node) error {
|
func RestartNodes(c clientset.Interface, nodes []v1.Node) error {
|
||||||
// Build mapping from zone to nodes in that zone.
|
// Build mapping from zone to nodes in that zone.
|
||||||
nodeNamesByZone := make(map[string][]string)
|
nodeNamesByZone := make(map[string][]string)
|
||||||
|
Loading…
Reference in New Issue
Block a user