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 #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.
This commit is contained in:
Claudiu Belu 2019-09-20 19:42:43 +03:00
parent 75aca1fe03
commit e8d062bd4a
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

@ -378,12 +378,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)
@ -393,7 +393,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) {
@ -2216,17 +2216,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())
}
}
@ -2255,7 +2255,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"}