Skip to content

Commit 77e110f

Browse files
authored
Merge pull request kubernetes#84046 from bclau/tests/agnhost-guestbook-replacement
Tests/agnhost guestbook replacement
2 parents d1e8702 + e8d062b commit 77e110f

File tree

10 files changed

+116
-40
lines changed

10 files changed

+116
-40
lines changed

test/e2e/apps/rc.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,7 @@ var _ = SIGDescribe("ReplicationController", func() {
5252
ginkgo.It("should serve a basic image on each replica with a private image", func() {
5353
// requires private images
5454
framework.SkipUnlessProviderIs("gce", "gke")
55-
privateimage := imageutils.GetConfig(imageutils.Agnhost)
56-
privateimage.SetRegistry(imageutils.PrivateRegistry)
55+
privateimage := imageutils.GetConfig(imageutils.AgnhostPrivate)
5756
TestReplicationControllerServeImageOrFail(f, "private", privateimage.GetE2EImage())
5857
})
5958

test/e2e/apps/replica_set.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,7 @@ var _ = SIGDescribe("ReplicaSet", func() {
9696
ginkgo.It("should serve a basic image on each replica with a private image", func() {
9797
// requires private images
9898
framework.SkipUnlessProviderIs("gce", "gke")
99-
privateimage := imageutils.GetConfig(imageutils.Agnhost)
100-
privateimage.SetRegistry(imageutils.PrivateRegistry)
99+
privateimage := imageutils.GetConfig(imageutils.AgnhostPrivate)
101100
testReplicaSetServeImageOrFail(f, "private", privateimage.GetE2EImage())
102101
})
103102

test/e2e/common/util.go

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -66,18 +66,17 @@ var CommonImageWhiteList = sets.NewString(
6666
)
6767

6868
type testImagesStruct struct {
69-
AgnhostImage string
70-
BusyBoxImage string
71-
GBFrontendImage string
72-
KittenImage string
73-
MounttestImage string
74-
NautilusImage string
75-
NginxImage string
76-
NginxNewImage string
77-
HttpdImage string
78-
HttpdNewImage string
79-
PauseImage string
80-
RedisImage string
69+
AgnhostImage string
70+
BusyBoxImage string
71+
KittenImage string
72+
MounttestImage string
73+
NautilusImage string
74+
NginxImage string
75+
NginxNewImage string
76+
HttpdImage string
77+
HttpdNewImage string
78+
PauseImage string
79+
RedisImage string
8180
}
8281

8382
var testImages testImagesStruct
@@ -86,7 +85,6 @@ func init() {
8685
testImages = testImagesStruct{
8786
imageutils.GetE2EImage(imageutils.Agnhost),
8887
imageutils.GetE2EImage(imageutils.BusyBox),
89-
imageutils.GetE2EImage(imageutils.GBFrontend),
9088
imageutils.GetE2EImage(imageutils.Kitten),
9189
imageutils.GetE2EImage(imageutils.Mounttest),
9290
imageutils.GetE2EImage(imageutils.Nautilus),

test/e2e/kubectl/kubectl.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -386,12 +386,12 @@ var _ = SIGDescribe("Kubectl client", func() {
386386
forEachGBFile := func(run func(s string)) {
387387
guestbookRoot := "test/e2e/testing-manifests/guestbook"
388388
for _, gbAppFile := range []string{
389-
"redis-slave-service.yaml",
390-
"redis-master-service.yaml",
389+
"agnhost-slave-service.yaml",
390+
"agnhost-master-service.yaml",
391391
"frontend-service.yaml",
392392
"frontend-deployment.yaml.in",
393-
"redis-master-deployment.yaml.in",
394-
"redis-slave-deployment.yaml.in",
393+
"agnhost-master-deployment.yaml.in",
394+
"agnhost-slave-deployment.yaml.in",
395395
} {
396396
contents := commonutils.SubstituteImageName(string(testfiles.ReadOrDie(filepath.Join(guestbookRoot, gbAppFile))))
397397
run(contents)
@@ -401,7 +401,7 @@ var _ = SIGDescribe("Kubectl client", func() {
401401
/*
402402
Release : v1.9
403403
Testname: Kubectl, guestbook application
404-
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.
404+
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.
405405
*/
406406
framework.ConformanceIt("should create and stop a working application ", func() {
407407
defer forEachGBFile(func(contents string) {
@@ -2303,17 +2303,17 @@ func validateGuestbookApp(c clientset.Interface, ns string) {
23032303
err := testutils.WaitForPodsWithLabelRunning(c, ns, label)
23042304
framework.ExpectNoError(err)
23052305
framework.Logf("Waiting for frontend to serve content.")
2306-
if !waitForGuestbookResponse(c, "get", "", `{"data": ""}`, guestbookStartupTimeout, ns) {
2306+
if !waitForGuestbookResponse(c, "get", "", `{"data":""}`, guestbookStartupTimeout, ns) {
23072307
framework.Failf("Frontend service did not start serving content in %v seconds.", guestbookStartupTimeout.Seconds())
23082308
}
23092309

23102310
framework.Logf("Trying to add a new entry to the guestbook.")
2311-
if !waitForGuestbookResponse(c, "set", "TestEntry", `{"message": "Updated"}`, guestbookResponseTimeout, ns) {
2311+
if !waitForGuestbookResponse(c, "set", "TestEntry", `{"message":"Updated"}`, guestbookResponseTimeout, ns) {
23122312
framework.Failf("Cannot added new entry in %v seconds.", guestbookResponseTimeout.Seconds())
23132313
}
23142314

23152315
framework.Logf("Verifying that added entry can be retrieved.")
2316-
if !waitForGuestbookResponse(c, "get", "", `{"data": "TestEntry"}`, guestbookResponseTimeout, ns) {
2316+
if !waitForGuestbookResponse(c, "get", "", `{"data":"TestEntry"}`, guestbookResponseTimeout, ns) {
23172317
framework.Failf("Entry to guestbook wasn't correctly added in %v seconds.", guestbookResponseTimeout.Seconds())
23182318
}
23192319
}
@@ -2342,7 +2342,7 @@ func makeRequestToGuestbook(c clientset.Interface, cmd, value string, ns string)
23422342
result, err := proxyRequest.Namespace(ns).
23432343
Context(ctx).
23442344
Name("frontend").
2345-
Suffix("/guestbook.php").
2345+
Suffix("/guestbook").
23462346
Param("cmd", cmd).
23472347
Param("key", "messages").
23482348
Param("value", value).
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: agnhost-master
5+
spec:
6+
replicas: 1
7+
selector:
8+
matchLabels:
9+
app: agnhost
10+
role: master
11+
tier: backend
12+
template:
13+
metadata:
14+
labels:
15+
app: agnhost
16+
role: master
17+
tier: backend
18+
spec:
19+
containers:
20+
- name: master
21+
image: {{.AgnhostImage}}
22+
args: [ "guestbook", "--http-port", "6379" ]
23+
resources:
24+
requests:
25+
cpu: 100m
26+
memory: 100Mi
27+
ports:
28+
- containerPort: 6379
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: agnhost-master
5+
labels:
6+
app: agnhost
7+
role: master
8+
tier: backend
9+
spec:
10+
ports:
11+
- port: 6379
12+
targetPort: 6379
13+
selector:
14+
app: agnhost
15+
role: master
16+
tier: backend
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: agnhost-slave
5+
spec:
6+
replicas: 2
7+
selector:
8+
matchLabels:
9+
app: agnhost
10+
role: slave
11+
tier: backend
12+
template:
13+
metadata:
14+
labels:
15+
app: agnhost
16+
role: slave
17+
tier: backend
18+
spec:
19+
containers:
20+
- name: slave
21+
image: {{.AgnhostImage}}
22+
args: [ "guestbook", "--slaveof", "agnhost-master", "--http-port", "6379" ]
23+
resources:
24+
requests:
25+
cpu: 100m
26+
memory: 100Mi
27+
ports:
28+
- containerPort: 6379
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: agnhost-slave
5+
labels:
6+
app: agnhost
7+
role: slave
8+
tier: backend
9+
spec:
10+
ports:
11+
- port: 6379
12+
selector:
13+
app: agnhost
14+
role: slave
15+
tier: backend

test/e2e/testing-manifests/guestbook/frontend-deployment.yaml.in

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,12 @@ spec:
1515
tier: frontend
1616
spec:
1717
containers:
18-
- name: php-redis
19-
image: {{.GBFrontendImage}}
18+
- name: guestbook-frontend
19+
image: {{.AgnhostImage}}
20+
args: [ "guestbook", "--backend-port", "6379" ]
2021
resources:
2122
requests:
2223
cpu: 100m
2324
memory: 100Mi
24-
env:
25-
- name: GET_HOSTS_FROM
26-
value: dns
27-
# If your cluster config does not include a dns service, then to
28-
# instead access environment variables to find service host
29-
# info, comment out the 'value: dns' line above, and uncomment the
30-
# line below:
31-
# value: env
3225
ports:
3326
- containerPort: 80

test/utils/image/manifest.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,8 @@ var (
118118
const (
119119
// Agnhost image
120120
Agnhost = iota
121+
// AgnhostPrivate image
122+
AgnhostPrivate
121123
// APIServer image
122124
APIServer
123125
// AppArmorLoader image
@@ -140,8 +142,6 @@ const (
140142
EchoServer
141143
// Etcd image
142144
Etcd
143-
// GBFrontend image
144-
GBFrontend
145145
// GlusterDynamicProvisioner image
146146
GlusterDynamicProvisioner
147147
// Httpd image
@@ -207,7 +207,8 @@ const (
207207

208208
func initImageConfigs() map[int]Config {
209209
configs := map[int]Config{}
210-
configs[Agnhost] = Config{e2eRegistry, "agnhost", "2.6"}
210+
configs[Agnhost] = Config{e2eRegistry, "agnhost", "2.8"}
211+
configs[AgnhostPrivate] = Config{PrivateRegistry, "agnhost", "2.6"}
211212
configs[AuthenticatedAlpine] = Config{gcAuthenticatedRegistry, "alpine", "3.7"}
212213
configs[AuthenticatedWindowsNanoServer] = Config{gcAuthenticatedRegistry, "windows-nanoserver", "v1"}
213214
configs[APIServer] = Config{e2eRegistry, "sample-apiserver", "1.10"}
@@ -219,7 +220,6 @@ func initImageConfigs() map[int]Config {
219220
configs[Dnsutils] = Config{e2eRegistry, "dnsutils", "1.1"}
220221
configs[EchoServer] = Config{e2eRegistry, "echoserver", "2.2"}
221222
configs[Etcd] = Config{gcRegistry, "etcd", "3.4.3"}
222-
configs[GBFrontend] = Config{sampleRegistry, "gb-frontend", "v6"}
223223
configs[GlusterDynamicProvisioner] = Config{dockerGluster, "glusterdynamic-provisioner", "v1.0"}
224224
configs[Httpd] = Config{dockerLibraryRegistry, "httpd", "2.4.38-alpine"}
225225
configs[HttpdNew] = Config{dockerLibraryRegistry, "httpd", "2.4.39-alpine"}

0 commit comments

Comments
 (0)