Skip to content

Commit e8d062b

Browse files
committed
tests: Replaces guestbook with agnhost equivalent
The redis version has been bumped to version 5.0.5, but the maximum version supported on Windows is 3.2. This can lead to failing tests, the output and behaviour can be different (see kubernetes#80516). In order to prevent such failures, the amount of times the Redis image is used can be reduced. This commit uses the previously added agnhost guestbook subcommand as a replacement for the Guestbook application created by the test "should create and stop a working application". Adds AgnhostPrivate to test/utils/image/manifest. Some tests are trying to pull the agnhost image from the private registry, meaning that we would need to always build and push the agnhost image to both e2e and private registry whenever we bump its version. Decoupling them would mean that we only need to push the image to the e2e registry.
1 parent 75aca1f commit e8d062b

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
@@ -378,12 +378,12 @@ var _ = SIGDescribe("Kubectl client", func() {
378378
forEachGBFile := func(run func(s string)) {
379379
guestbookRoot := "test/e2e/testing-manifests/guestbook"
380380
for _, gbAppFile := range []string{
381-
"redis-slave-service.yaml",
382-
"redis-master-service.yaml",
381+
"agnhost-slave-service.yaml",
382+
"agnhost-master-service.yaml",
383383
"frontend-service.yaml",
384384
"frontend-deployment.yaml.in",
385-
"redis-master-deployment.yaml.in",
386-
"redis-slave-deployment.yaml.in",
385+
"agnhost-master-deployment.yaml.in",
386+
"agnhost-slave-deployment.yaml.in",
387387
} {
388388
contents := commonutils.SubstituteImageName(string(testfiles.ReadOrDie(filepath.Join(guestbookRoot, gbAppFile))))
389389
run(contents)
@@ -393,7 +393,7 @@ var _ = SIGDescribe("Kubectl client", func() {
393393
/*
394394
Release : v1.9
395395
Testname: Kubectl, guestbook application
396-
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.
396+
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.
397397
*/
398398
framework.ConformanceIt("should create and stop a working application ", func() {
399399
defer forEachGBFile(func(contents string) {
@@ -2216,17 +2216,17 @@ func validateGuestbookApp(c clientset.Interface, ns string) {
22162216
err := testutils.WaitForPodsWithLabelRunning(c, ns, label)
22172217
framework.ExpectNoError(err)
22182218
framework.Logf("Waiting for frontend to serve content.")
2219-
if !waitForGuestbookResponse(c, "get", "", `{"data": ""}`, guestbookStartupTimeout, ns) {
2219+
if !waitForGuestbookResponse(c, "get", "", `{"data":""}`, guestbookStartupTimeout, ns) {
22202220
framework.Failf("Frontend service did not start serving content in %v seconds.", guestbookStartupTimeout.Seconds())
22212221
}
22222222

22232223
framework.Logf("Trying to add a new entry to the guestbook.")
2224-
if !waitForGuestbookResponse(c, "set", "TestEntry", `{"message": "Updated"}`, guestbookResponseTimeout, ns) {
2224+
if !waitForGuestbookResponse(c, "set", "TestEntry", `{"message":"Updated"}`, guestbookResponseTimeout, ns) {
22252225
framework.Failf("Cannot added new entry in %v seconds.", guestbookResponseTimeout.Seconds())
22262226
}
22272227

22282228
framework.Logf("Verifying that added entry can be retrieved.")
2229-
if !waitForGuestbookResponse(c, "get", "", `{"data": "TestEntry"}`, guestbookResponseTimeout, ns) {
2229+
if !waitForGuestbookResponse(c, "get", "", `{"data":"TestEntry"}`, guestbookResponseTimeout, ns) {
22302230
framework.Failf("Entry to guestbook wasn't correctly added in %v seconds.", guestbookResponseTimeout.Seconds())
22312231
}
22322232
}
@@ -2255,7 +2255,7 @@ func makeRequestToGuestbook(c clientset.Interface, cmd, value string, ns string)
22552255
result, err := proxyRequest.Namespace(ns).
22562256
Context(ctx).
22572257
Name("frontend").
2258-
Suffix("/guestbook.php").
2258+
Suffix("/guestbook").
22592259
Param("cmd", cmd).
22602260
Param("key", "messages").
22612261
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)