kill repo-root : test/e2e/serviceloadbalancers.go

bindata and yaml, Gobindata automation
bindata utils for generating, go generate
match server version
gitignore for dirty, ca, rbase, KUBE_ROOT, buildfix
(rebased jul-25,29)
This commit is contained in:
Jay Vyas
2016-05-13 15:15:11 -04:00
committed by jayunit100
parent 9fab05fe59
commit 6166083c78
13 changed files with 2114 additions and 5512 deletions

View File

@@ -129,7 +129,7 @@ var _ = ginkgo.SynchronizedBeforeSuite(func() []byte {
if err := framework.WaitForPodsRunningReady(c, api.NamespaceSystem, int32(framework.TestContext.MinStartupPods), podStartupTimeout, framework.ImagePullerLabels); err != nil {
framework.DumpAllNamespaceInfo(c, api.NamespaceSystem)
framework.LogFailedContainers(c, api.NamespaceSystem)
framework.RunKubernetesServiceTestContainer(c, framework.TestContext.RepoRoot, api.NamespaceDefault)
framework.RunKubernetesServiceTestContainer(c, api.NamespaceDefault)
framework.Failf("Error waiting for all pods to be running and ready: %v", err)
}

View File

@@ -16,26 +16,17 @@ limitations under the License.
package framework
//go:generate ../../../hack/update-bindata.sh
// See https://github.com/kubernetes/kubernetes/issues/23987
import "k8s.io/kubernetes/test/e2e/generated"
/*
ReadOrDie reads a file from gobindata. To generate gobindata, run
# Install the program
go get -u github.com/jteeuwen/go-bindata/...
# Generate the bindata file.
go-bindata \
-pkg generated -ignore .jpg -ignore .png -ignore .md \
./examples/* ./docs/user-guide/* test/e2e/testing-manifests/kubectl/* test/images/*
# Copy it into the generated directory if the results are what you expected.
cp bindata.go test/e2e/generated
# Don't forget to gofmt it
gofmt -s -w test/e2e/generated/bindata.go
ReadOrDie reads a file from gobindata.
Relies heavily on the successful generation of build artifacts as per the go:generate directives above.
*/
func ReadOrDie(filePath string) []byte {
fileBytes, err := generated.Asset(filePath)
if err != nil {
gobindata_msg := "An error occured, possibly gobindata doesn't know about the file you're opening. For questions on maintaining gobindata, contact the sig-testing group."

View File

@@ -33,15 +33,16 @@ type TestContextType struct {
KubeVolumeDir string
CertDir string
Host string
RepoRoot string
Provider string
CloudConfig CloudConfig
KubectlPath string
OutputDir string
ReportDir string
ReportPrefix string
Prefix string
MinStartupPods int
// TODO: Deprecating this over time... instead just use gobindata_util.go , see #23987.
RepoRoot string
Provider string
CloudConfig CloudConfig
KubectlPath string
OutputDir string
ReportDir string
ReportPrefix string
Prefix string
MinStartupPods int
// Timeout for waiting for system pods to be running
SystemPodsStartupTimeout time.Duration
UpgradeTarget string

View File

@@ -21,7 +21,6 @@ import (
"encoding/json"
"fmt"
"io"
"io/ioutil"
"math"
"math/rand"
"net"
@@ -640,10 +639,7 @@ func WaitForPodsRunningReady(c *client.Client, ns string, minPods int32, timeout
func podFromManifest(filename string) (*api.Pod, error) {
var pod api.Pod
Logf("Parsing pod from %v", filename)
data, err := ioutil.ReadFile(filename)
if err != nil {
return nil, err
}
data := ReadOrDie(filename)
json, err := utilyaml.ToJSON(data)
if err != nil {
return nil, err
@@ -656,8 +652,13 @@ func podFromManifest(filename string) (*api.Pod, error) {
// Run a test container to try and contact the Kubernetes api-server from a pod, wait for it
// to flip to Ready, log its output and delete it.
func RunKubernetesServiceTestContainer(c *client.Client, repoRoot string, ns string) {
path := filepath.Join(repoRoot, "test", "images", "clusterapi-tester", "pod.yaml")
func RunKubernetesServiceTestContainer(c *client.Client, ns string) {
c, err := LoadClient()
if err != nil {
Logf("Failed to load client")
return
}
path := "test/images/clusterapi-tester/pod.yaml"
p, err := podFromManifest(path)
if err != nil {
Logf("Failed to parse clusterapi-tester from manifest %v: %v", path, err)

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,19 @@
/*
Copyright 2015 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package generated
// No code is needed here. This is a stub for compilation purposes.

View File

@@ -18,7 +18,6 @@ package e2e
import (
"fmt"
"path/filepath"
"time"
"k8s.io/kubernetes/pkg/api"
@@ -697,8 +696,7 @@ var _ = framework.KubeDescribe("SchedulerPredicates [Serial]", func() {
By("Trying to launch a pod that with NodeAffinity setting as embedded JSON string in the annotation value.")
labelPodName := "with-labels"
nodeSelectionRoot := filepath.Join(framework.TestContext.RepoRoot, "test/e2e/testing-manifests/node-selection")
testPodPath := filepath.Join(nodeSelectionRoot, "pod-with-node-affinity.yaml")
testPodPath := string(framework.ReadOrDie("test/e2e/testing-manifests/node-selection/pod-with-node-affinity.yaml"))
framework.RunKubectlOrDie("create", "-f", testPodPath, fmt.Sprintf("--namespace=%v", ns))
// check that pod got scheduled. We intentionally DO NOT check that the
@@ -1213,8 +1211,7 @@ var _ = framework.KubeDescribe("SchedulerPredicates [Serial]", func() {
By("Trying to launch a pod that with PodAffinity & PodAntiAffinity setting as embedded JSON string in the annotation value.")
labelPodName := "with-newlabels"
nodeSelectionRoot := filepath.Join(framework.TestContext.RepoRoot, "test/e2e/testing-manifests/node-selection")
testPodPath := filepath.Join(nodeSelectionRoot, "pod-with-pod-affinity.yaml")
testPodPath := string(framework.ReadOrDie("test/e2e/testing-manifests/node-selection/pos-with-node-affinity.yaml"))
framework.RunKubectlOrDie("create", "-f", testPodPath, fmt.Sprintf("--namespace=%v", ns))
// check that pod got scheduled. We intentionally DO NOT check that the

View File

@@ -20,7 +20,6 @@ import (
"fmt"
"io/ioutil"
"net/http"
"path/filepath"
"k8s.io/kubernetes/pkg/api"
client "k8s.io/kubernetes/pkg/client/unversioned"
@@ -35,23 +34,23 @@ import (
)
// getLoadBalancerControllers returns a list of LBCtesters.
func getLoadBalancerControllers(repoRoot string, client *client.Client) []LBCTester {
func getLoadBalancerControllers(client *client.Client) []LBCTester {
return []LBCTester{
&haproxyControllerTester{
name: "haproxy",
cfg: filepath.Join(repoRoot, "test", "e2e", "testing-manifests", "serviceloadbalancer", "haproxyrc.yaml"),
cfg: "test/e2e/testing-manifests/serviceloadbalancer/haproxyrc.yaml",
client: client,
},
}
}
// getIngManagers returns a list of ingManagers.
func getIngManagers(repoRoot string, client *client.Client) []*ingManager {
func getIngManagers(client *client.Client) []*ingManager {
return []*ingManager{
{
name: "netexec",
rcCfgPaths: []string{filepath.Join(repoRoot, "test", "e2e", "testing-manifests", "serviceloadbalancer", "netexecrc.yaml")},
svcCfgPaths: []string{filepath.Join(repoRoot, "test", "e2e", "testing-manifests", "serviceloadbalancer", "netexecsvc.yaml")},
rcCfgPaths: []string{"test/e2e/testing-manifests/serviceloadbalancer/netexecrc.yaml"},
svcCfgPaths: []string{"test/e2e/testing-manifests/serviceloadbalancer/netexecsvc.yaml"},
svcNames: []string{},
client: client,
},
@@ -208,7 +207,6 @@ func (s *ingManager) test(path string) error {
var _ = framework.KubeDescribe("ServiceLoadBalancer [Feature:ServiceLoadBalancer]", func() {
// These variables are initialized after framework's beforeEach.
var ns string
var repoRoot string
var client *client.Client
f := framework.NewDefaultFramework("servicelb")
@@ -216,15 +214,14 @@ var _ = framework.KubeDescribe("ServiceLoadBalancer [Feature:ServiceLoadBalancer
BeforeEach(func() {
client = f.Client
ns = f.Namespace.Name
repoRoot = framework.TestContext.RepoRoot
})
It("should support simple GET on Ingress ips", func() {
for _, t := range getLoadBalancerControllers(repoRoot, client) {
for _, t := range getLoadBalancerControllers(client) {
By(fmt.Sprintf("Starting loadbalancer controller %v in namespace %v", t.getName(), ns))
Expect(t.start(ns)).NotTo(HaveOccurred())
for _, s := range getIngManagers(repoRoot, client) {
for _, s := range getIngManagers(client) {
By(fmt.Sprintf("Starting ingress manager %v in namespace %v", s.getName(), ns))
Expect(s.start(ns)).NotTo(HaveOccurred())
@@ -268,8 +265,7 @@ func simpleGET(c *http.Client, url, host string) (string, error) {
func rcFromManifest(fileName string) *api.ReplicationController {
var controller api.ReplicationController
framework.Logf("Parsing rc from %v", fileName)
data, err := ioutil.ReadFile(fileName)
Expect(err).NotTo(HaveOccurred())
data := framework.ReadOrDie(fileName)
json, err := utilyaml.ToJSON(data)
Expect(err).NotTo(HaveOccurred())
@@ -282,8 +278,7 @@ func rcFromManifest(fileName string) *api.ReplicationController {
func svcFromManifest(fileName string) *api.Service {
var svc api.Service
framework.Logf("Parsing service from %v", fileName)
data, err := ioutil.ReadFile(fileName)
Expect(err).NotTo(HaveOccurred())
data := framework.ReadOrDie(fileName)
json, err := utilyaml.ToJSON(data)
Expect(err).NotTo(HaveOccurred())

View File

@@ -28,7 +28,16 @@ set -x
. $1
if [ "$INSTALL_GODEP" = true ] ; then
go get -u github.com/tools/godep
go get -u github.com/onsi/ginkgo/ginkgo
go get -u github.com/onsi/gomega
fi
make generated_files
# TODO converge build steps with hack/build-go some day if possible.
go generate test/e2e/framework/gobindata_util.go
go build test/e2e_node/environment/conformance.go
WORKSPACE=${WORKSPACE:-"/tmp/"}