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() {
// requires private images
framework.SkipUnlessProviderIs("gce", "gke")
privateimage := imageutils.GetConfig(imageutils.Agnhost)
privateimage.SetRegistry(imageutils.PrivateRegistry)
privateimage := imageutils.GetConfig(imageutils.AgnhostPrivate)
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() {
// requires private images
framework.SkipUnlessProviderIs("gce", "gke")
privateimage := imageutils.GetConfig(imageutils.Agnhost)
privateimage.SetRegistry(imageutils.PrivateRegistry)
privateimage := imageutils.GetConfig(imageutils.AgnhostPrivate)
testReplicaSetServeImageOrFail(f, "private", privateimage.GetE2EImage())
})

View File

@ -66,18 +66,17 @@ var CommonImageWhiteList = sets.NewString(
)
type testImagesStruct struct {
AgnhostImage string
BusyBoxImage string
GBFrontendImage string
KittenImage string
MounttestImage string
NautilusImage string
NginxImage string
NginxNewImage string
HttpdImage string
HttpdNewImage string
PauseImage string
RedisImage string
AgnhostImage string
BusyBoxImage string
KittenImage string
MounttestImage string
NautilusImage string
NginxImage string
NginxNewImage string
HttpdImage string
HttpdNewImage string
PauseImage string
RedisImage string
}
var testImages testImagesStruct
@ -86,7 +85,6 @@ func init() {
testImages = testImagesStruct{
imageutils.GetE2EImage(imageutils.Agnhost),
imageutils.GetE2EImage(imageutils.BusyBox),
imageutils.GetE2EImage(imageutils.GBFrontend),
imageutils.GetE2EImage(imageutils.Kitten),
imageutils.GetE2EImage(imageutils.Mounttest),
imageutils.GetE2EImage(imageutils.Nautilus),

View File

@ -386,12 +386,12 @@ var _ = SIGDescribe("Kubectl client", func() {
forEachGBFile := func(run func(s string)) {
guestbookRoot := "test/e2e/testing-manifests/guestbook"
for _, gbAppFile := range []string{
"redis-slave-service.yaml",
"redis-master-service.yaml",
"agnhost-slave-service.yaml",
"agnhost-master-service.yaml",
"frontend-service.yaml",
"frontend-deployment.yaml.in",
"redis-master-deployment.yaml.in",
"redis-slave-deployment.yaml.in",
"agnhost-master-deployment.yaml.in",
"agnhost-slave-deployment.yaml.in",
} {
contents := commonutils.SubstituteImageName(string(testfiles.ReadOrDie(filepath.Join(guestbookRoot, gbAppFile))))
run(contents)
@ -401,7 +401,7 @@ var _ = SIGDescribe("Kubectl client", func() {
/*
Release : v1.9
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() {
defer forEachGBFile(func(contents string) {
@ -2303,17 +2303,17 @@ func validateGuestbookApp(c clientset.Interface, ns string) {
err := testutils.WaitForPodsWithLabelRunning(c, ns, label)
framework.ExpectNoError(err)
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.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.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())
}
}
@ -2342,7 +2342,7 @@ func makeRequestToGuestbook(c clientset.Interface, cmd, value string, ns string)
result, err := proxyRequest.Namespace(ns).
Context(ctx).
Name("frontend").
Suffix("/guestbook.php").
Suffix("/guestbook").
Param("cmd", cmd).
Param("key", "messages").
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
spec:
containers:
- name: php-redis
image: {{.GBFrontendImage}}
- name: guestbook-frontend
image: {{.AgnhostImage}}
args: [ "guestbook", "--backend-port", "6379" ]
resources:
requests:
cpu: 100m
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:
- containerPort: 80

View File

@ -118,6 +118,8 @@ var (
const (
// Agnhost image
Agnhost = iota
// AgnhostPrivate image
AgnhostPrivate
// APIServer image
APIServer
// AppArmorLoader image
@ -140,8 +142,6 @@ const (
EchoServer
// Etcd image
Etcd
// GBFrontend image
GBFrontend
// GlusterDynamicProvisioner image
GlusterDynamicProvisioner
// Httpd image
@ -207,7 +207,8 @@ const (
func initImageConfigs() 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[AuthenticatedWindowsNanoServer] = Config{gcAuthenticatedRegistry, "windows-nanoserver", "v1"}
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[EchoServer] = Config{e2eRegistry, "echoserver", "2.2"}
configs[Etcd] = Config{gcRegistry, "etcd", "3.4.3"}
configs[GBFrontend] = Config{sampleRegistry, "gb-frontend", "v6"}
configs[GlusterDynamicProvisioner] = Config{dockerGluster, "glusterdynamic-provisioner", "v1.0"}
configs[Httpd] = Config{dockerLibraryRegistry, "httpd", "2.4.38-alpine"}
configs[HttpdNew] = Config{dockerLibraryRegistry, "httpd", "2.4.39-alpine"}