Merge pull request #84046 from bclau/tests/agnhost-guestbook-replacement

Tests/agnhost guestbook replacement
This commit is contained in:
Kubernetes Prow Robot 2019-11-14 08:29:34 -08:00 committed by GitHub
commit 77e110fcef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 116 additions and 40 deletions

View File

@ -52,8 +52,7 @@ var _ = SIGDescribe("ReplicationController", func() {
ginkgo.It("should serve a basic image on each replica with a private image", func() { ginkgo.It("should serve a basic image on each replica with a private image", func() {
// requires private images // requires private images
framework.SkipUnlessProviderIs("gce", "gke") framework.SkipUnlessProviderIs("gce", "gke")
privateimage := imageutils.GetConfig(imageutils.Agnhost) privateimage := imageutils.GetConfig(imageutils.AgnhostPrivate)
privateimage.SetRegistry(imageutils.PrivateRegistry)
TestReplicationControllerServeImageOrFail(f, "private", privateimage.GetE2EImage()) TestReplicationControllerServeImageOrFail(f, "private", privateimage.GetE2EImage())
}) })

View File

@ -96,8 +96,7 @@ var _ = SIGDescribe("ReplicaSet", func() {
ginkgo.It("should serve a basic image on each replica with a private image", func() { ginkgo.It("should serve a basic image on each replica with a private image", func() {
// requires private images // requires private images
framework.SkipUnlessProviderIs("gce", "gke") framework.SkipUnlessProviderIs("gce", "gke")
privateimage := imageutils.GetConfig(imageutils.Agnhost) privateimage := imageutils.GetConfig(imageutils.AgnhostPrivate)
privateimage.SetRegistry(imageutils.PrivateRegistry)
testReplicaSetServeImageOrFail(f, "private", privateimage.GetE2EImage()) testReplicaSetServeImageOrFail(f, "private", privateimage.GetE2EImage())
}) })

View File

@ -68,7 +68,6 @@ var CommonImageWhiteList = sets.NewString(
type testImagesStruct struct { type testImagesStruct struct {
AgnhostImage string AgnhostImage string
BusyBoxImage string BusyBoxImage string
GBFrontendImage string
KittenImage string KittenImage string
MounttestImage string MounttestImage string
NautilusImage string NautilusImage string
@ -86,7 +85,6 @@ func init() {
testImages = testImagesStruct{ testImages = testImagesStruct{
imageutils.GetE2EImage(imageutils.Agnhost), imageutils.GetE2EImage(imageutils.Agnhost),
imageutils.GetE2EImage(imageutils.BusyBox), imageutils.GetE2EImage(imageutils.BusyBox),
imageutils.GetE2EImage(imageutils.GBFrontend),
imageutils.GetE2EImage(imageutils.Kitten), imageutils.GetE2EImage(imageutils.Kitten),
imageutils.GetE2EImage(imageutils.Mounttest), imageutils.GetE2EImage(imageutils.Mounttest),
imageutils.GetE2EImage(imageutils.Nautilus), imageutils.GetE2EImage(imageutils.Nautilus),

View File

@ -386,12 +386,12 @@ var _ = SIGDescribe("Kubectl client", func() {
forEachGBFile := func(run func(s string)) { forEachGBFile := func(run func(s string)) {
guestbookRoot := "test/e2e/testing-manifests/guestbook" guestbookRoot := "test/e2e/testing-manifests/guestbook"
for _, gbAppFile := range []string{ for _, gbAppFile := range []string{
"redis-slave-service.yaml", "agnhost-slave-service.yaml",
"redis-master-service.yaml", "agnhost-master-service.yaml",
"frontend-service.yaml", "frontend-service.yaml",
"frontend-deployment.yaml.in", "frontend-deployment.yaml.in",
"redis-master-deployment.yaml.in", "agnhost-master-deployment.yaml.in",
"redis-slave-deployment.yaml.in", "agnhost-slave-deployment.yaml.in",
} { } {
contents := commonutils.SubstituteImageName(string(testfiles.ReadOrDie(filepath.Join(guestbookRoot, gbAppFile)))) contents := commonutils.SubstituteImageName(string(testfiles.ReadOrDie(filepath.Join(guestbookRoot, gbAppFile))))
run(contents) run(contents)
@ -401,7 +401,7 @@ var _ = SIGDescribe("Kubectl client", func() {
/* /*
Release : v1.9 Release : v1.9
Testname: Kubectl, guestbook application Testname: Kubectl, guestbook application
Description: Create Guestbook application that contains redis server, 2 instances of redis slave, frontend application, frontend service and redis master service and redis slave service. Using frontend service, the test will write an entry into the guestbook application which will store the entry into the backend redis database. Application flow MUST work as expected and the data written MUST be available to read. Description: Create Guestbook application that contains an agnhost master server, 2 agnhost slaves, frontend application, frontend service and agnhost master service and agnhost slave service. Using frontend service, the test will write an entry into the guestbook application which will store the entry into the backend agnhost store. Application flow MUST work as expected and the data written MUST be available to read.
*/ */
framework.ConformanceIt("should create and stop a working application ", func() { framework.ConformanceIt("should create and stop a working application ", func() {
defer forEachGBFile(func(contents string) { defer forEachGBFile(func(contents string) {
@ -2303,17 +2303,17 @@ func validateGuestbookApp(c clientset.Interface, ns string) {
err := testutils.WaitForPodsWithLabelRunning(c, ns, label) err := testutils.WaitForPodsWithLabelRunning(c, ns, label)
framework.ExpectNoError(err) framework.ExpectNoError(err)
framework.Logf("Waiting for frontend to serve content.") framework.Logf("Waiting for frontend to serve content.")
if !waitForGuestbookResponse(c, "get", "", `{"data": ""}`, guestbookStartupTimeout, ns) { if !waitForGuestbookResponse(c, "get", "", `{"data":""}`, guestbookStartupTimeout, ns) {
framework.Failf("Frontend service did not start serving content in %v seconds.", guestbookStartupTimeout.Seconds()) framework.Failf("Frontend service did not start serving content in %v seconds.", guestbookStartupTimeout.Seconds())
} }
framework.Logf("Trying to add a new entry to the guestbook.") framework.Logf("Trying to add a new entry to the guestbook.")
if !waitForGuestbookResponse(c, "set", "TestEntry", `{"message": "Updated"}`, guestbookResponseTimeout, ns) { if !waitForGuestbookResponse(c, "set", "TestEntry", `{"message":"Updated"}`, guestbookResponseTimeout, ns) {
framework.Failf("Cannot added new entry in %v seconds.", guestbookResponseTimeout.Seconds()) framework.Failf("Cannot added new entry in %v seconds.", guestbookResponseTimeout.Seconds())
} }
framework.Logf("Verifying that added entry can be retrieved.") framework.Logf("Verifying that added entry can be retrieved.")
if !waitForGuestbookResponse(c, "get", "", `{"data": "TestEntry"}`, guestbookResponseTimeout, ns) { if !waitForGuestbookResponse(c, "get", "", `{"data":"TestEntry"}`, guestbookResponseTimeout, ns) {
framework.Failf("Entry to guestbook wasn't correctly added in %v seconds.", guestbookResponseTimeout.Seconds()) framework.Failf("Entry to guestbook wasn't correctly added in %v seconds.", guestbookResponseTimeout.Seconds())
} }
} }
@ -2342,7 +2342,7 @@ func makeRequestToGuestbook(c clientset.Interface, cmd, value string, ns string)
result, err := proxyRequest.Namespace(ns). result, err := proxyRequest.Namespace(ns).
Context(ctx). Context(ctx).
Name("frontend"). Name("frontend").
Suffix("/guestbook.php"). Suffix("/guestbook").
Param("cmd", cmd). Param("cmd", cmd).
Param("key", "messages"). Param("key", "messages").
Param("value", value). Param("value", value).

View File

@ -0,0 +1,28 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: agnhost-master
spec:
replicas: 1
selector:
matchLabels:
app: agnhost
role: master
tier: backend
template:
metadata:
labels:
app: agnhost
role: master
tier: backend
spec:
containers:
- name: master
image: {{.AgnhostImage}}
args: [ "guestbook", "--http-port", "6379" ]
resources:
requests:
cpu: 100m
memory: 100Mi
ports:
- containerPort: 6379

View File

@ -0,0 +1,16 @@
apiVersion: v1
kind: Service
metadata:
name: agnhost-master
labels:
app: agnhost
role: master
tier: backend
spec:
ports:
- port: 6379
targetPort: 6379
selector:
app: agnhost
role: master
tier: backend

View File

@ -0,0 +1,28 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: agnhost-slave
spec:
replicas: 2
selector:
matchLabels:
app: agnhost
role: slave
tier: backend
template:
metadata:
labels:
app: agnhost
role: slave
tier: backend
spec:
containers:
- name: slave
image: {{.AgnhostImage}}
args: [ "guestbook", "--slaveof", "agnhost-master", "--http-port", "6379" ]
resources:
requests:
cpu: 100m
memory: 100Mi
ports:
- containerPort: 6379

View File

@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: agnhost-slave
labels:
app: agnhost
role: slave
tier: backend
spec:
ports:
- port: 6379
selector:
app: agnhost
role: slave
tier: backend

View File

@ -15,19 +15,12 @@ spec:
tier: frontend tier: frontend
spec: spec:
containers: containers:
- name: php-redis - name: guestbook-frontend
image: {{.GBFrontendImage}} image: {{.AgnhostImage}}
args: [ "guestbook", "--backend-port", "6379" ]
resources: resources:
requests: requests:
cpu: 100m cpu: 100m
memory: 100Mi memory: 100Mi
env:
- name: GET_HOSTS_FROM
value: dns
# If your cluster config does not include a dns service, then to
# instead access environment variables to find service host
# info, comment out the 'value: dns' line above, and uncomment the
# line below:
# value: env
ports: ports:
- containerPort: 80 - containerPort: 80

View File

@ -118,6 +118,8 @@ var (
const ( const (
// Agnhost image // Agnhost image
Agnhost = iota Agnhost = iota
// AgnhostPrivate image
AgnhostPrivate
// APIServer image // APIServer image
APIServer APIServer
// AppArmorLoader image // AppArmorLoader image
@ -140,8 +142,6 @@ const (
EchoServer EchoServer
// Etcd image // Etcd image
Etcd Etcd
// GBFrontend image
GBFrontend
// GlusterDynamicProvisioner image // GlusterDynamicProvisioner image
GlusterDynamicProvisioner GlusterDynamicProvisioner
// Httpd image // Httpd image
@ -207,7 +207,8 @@ const (
func initImageConfigs() map[int]Config { func initImageConfigs() map[int]Config {
configs := map[int]Config{} configs := map[int]Config{}
configs[Agnhost] = Config{e2eRegistry, "agnhost", "2.6"} configs[Agnhost] = Config{e2eRegistry, "agnhost", "2.8"}
configs[AgnhostPrivate] = Config{PrivateRegistry, "agnhost", "2.6"}
configs[AuthenticatedAlpine] = Config{gcAuthenticatedRegistry, "alpine", "3.7"} configs[AuthenticatedAlpine] = Config{gcAuthenticatedRegistry, "alpine", "3.7"}
configs[AuthenticatedWindowsNanoServer] = Config{gcAuthenticatedRegistry, "windows-nanoserver", "v1"} configs[AuthenticatedWindowsNanoServer] = Config{gcAuthenticatedRegistry, "windows-nanoserver", "v1"}
configs[APIServer] = Config{e2eRegistry, "sample-apiserver", "1.10"} configs[APIServer] = Config{e2eRegistry, "sample-apiserver", "1.10"}
@ -219,7 +220,6 @@ func initImageConfigs() map[int]Config {
configs[Dnsutils] = Config{e2eRegistry, "dnsutils", "1.1"} configs[Dnsutils] = Config{e2eRegistry, "dnsutils", "1.1"}
configs[EchoServer] = Config{e2eRegistry, "echoserver", "2.2"} configs[EchoServer] = Config{e2eRegistry, "echoserver", "2.2"}
configs[Etcd] = Config{gcRegistry, "etcd", "3.4.3"} configs[Etcd] = Config{gcRegistry, "etcd", "3.4.3"}
configs[GBFrontend] = Config{sampleRegistry, "gb-frontend", "v6"}
configs[GlusterDynamicProvisioner] = Config{dockerGluster, "glusterdynamic-provisioner", "v1.0"} configs[GlusterDynamicProvisioner] = Config{dockerGluster, "glusterdynamic-provisioner", "v1.0"}
configs[Httpd] = Config{dockerLibraryRegistry, "httpd", "2.4.38-alpine"} configs[Httpd] = Config{dockerLibraryRegistry, "httpd", "2.4.38-alpine"}
configs[HttpdNew] = Config{dockerLibraryRegistry, "httpd", "2.4.39-alpine"} configs[HttpdNew] = Config{dockerLibraryRegistry, "httpd", "2.4.39-alpine"}