Skip to content

Commit bcd20da

Browse files
Merge pull request #19584 from wozniakjan/extended_tests/mongodb/tolerate_pagecount
ext_tests: make mongodb check tolerate any non zero pagecount
2 parents bb38a8d + 3610f5b commit bcd20da

File tree

1 file changed

+95
-93
lines changed

1 file changed

+95
-93
lines changed

test/extended/image_ecosystem/sample_repos.go

+95-93
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ import (
1515
exutil "github.com/openshift/origin/test/extended/util"
1616
)
1717

18-
type SampleRepoConfig struct {
18+
var htmlCountValueNonZeroRegexp = `<span class="code" id="count-value">[^0][0-9]*</span>`
19+
20+
type sampleRepoConfig struct {
1921
repoName string
2022
templateURL string
2123
buildConfigName string
@@ -30,7 +32,7 @@ type SampleRepoConfig struct {
3032
// NewSampleRepoTest creates a function for a new ginkgo test case that will instantiate a template
3133
// from a url, kick off the buildconfig defined in that template, wait for the build/deploy,
3234
// and then confirm the application is serving an expected string value.
33-
func NewSampleRepoTest(c SampleRepoConfig) func() {
35+
func NewSampleRepoTest(c sampleRepoConfig) func() {
3436
return func() {
3537
defer g.GinkgoRecover()
3638
var oc = exutil.NewCLI(c.repoName+"-repo-test", exutil.KubeConfigPath())
@@ -114,7 +116,7 @@ func NewSampleRepoTest(c SampleRepoConfig) func() {
114116
e2e.Logf("url check got %s, expected it to contain %s", response, c.expectedString)
115117
return false, nil
116118
})
117-
o.Expect(response).Should(o.ContainSubstring(c.expectedString))
119+
o.Expect(response).Should(o.MatchRegexp(c.expectedString))
118120
})
119121
})
120122
})
@@ -124,129 +126,129 @@ func NewSampleRepoTest(c SampleRepoConfig) func() {
124126
var _ = g.Describe("[image_ecosystem][Slow] openshift sample application repositories", func() {
125127

126128
g.Describe("[image_ecosystem][ruby] test ruby images with rails-ex db repo", NewSampleRepoTest(
127-
SampleRepoConfig{
128-
"rails-postgresql",
129-
"https://raw.githubusercontent.com/openshift/rails-ex/master/openshift/templates/rails-postgresql.json",
130-
"rails-postgresql-example",
131-
"rails-postgresql-example",
132-
"rails-postgresql-example",
133-
"Listing articles",
134-
"/articles",
135-
"postgresql",
136-
"postgresql",
129+
sampleRepoConfig{
130+
repoName: "rails-postgresql",
131+
templateURL: "https://raw.githubusercontent.com/openshift/rails-ex/master/openshift/templates/rails-postgresql.json",
132+
buildConfigName: "rails-postgresql-example",
133+
serviceName: "rails-postgresql-example",
134+
deploymentConfigName: "rails-postgresql-example",
135+
expectedString: "Listing articles",
136+
appPath: "/articles",
137+
dbDeploymentConfigName: "postgresql",
138+
dbServiceName: "postgresql",
137139
},
138140
))
139141

140142
g.Describe("[image_ecosystem][python] test python images with django-ex db repo", NewSampleRepoTest(
141-
SampleRepoConfig{
142-
"django-psql",
143-
"https://raw.githubusercontent.com/openshift/django-ex/master/openshift/templates/django-postgresql.json",
144-
"django-psql-example",
145-
"django-psql-example",
146-
"django-psql-example",
147-
"Page views: 1",
148-
"",
149-
"postgresql",
150-
"postgresql",
143+
sampleRepoConfig{
144+
repoName: "django-psql",
145+
templateURL: "https://raw.githubusercontent.com/openshift/django-ex/master/openshift/templates/django-postgresql.json",
146+
buildConfigName: "django-psql-example",
147+
serviceName: "django-psql-example",
148+
deploymentConfigName: "django-psql-example",
149+
expectedString: "Page views: 1",
150+
appPath: "",
151+
dbDeploymentConfigName: "postgresql",
152+
dbServiceName: "postgresql",
151153
},
152154
))
153155

154156
g.Describe("[image_ecosystem][nodejs] test nodejs images with nodejs-ex db repo", NewSampleRepoTest(
155-
SampleRepoConfig{
156-
"nodejs-mongodb",
157-
"https://raw.githubusercontent.com/openshift/nodejs-ex/master/openshift/templates/nodejs-mongodb.json",
158-
"nodejs-mongodb-example",
159-
"nodejs-mongodb-example",
160-
"nodejs-mongodb-example",
161-
"<span class=\"code\" id=\"count-value\">1</span>",
162-
"",
163-
"mongodb",
164-
"mongodb",
157+
sampleRepoConfig{
158+
repoName: "nodejs-mongodb",
159+
templateURL: "https://raw.githubusercontent.com/openshift/nodejs-ex/master/openshift/templates/nodejs-mongodb.json",
160+
buildConfigName: "nodejs-mongodb-example",
161+
serviceName: "nodejs-mongodb-example",
162+
deploymentConfigName: "nodejs-mongodb-example",
163+
expectedString: htmlCountValueNonZeroRegexp,
164+
appPath: "",
165+
dbDeploymentConfigName: "mongodb",
166+
dbServiceName: "mongodb",
165167
},
166168
))
167169

168170
var _ = g.Describe("[image_ecosystem][php] test php images with cakephp-ex db repo", NewSampleRepoTest(
169-
SampleRepoConfig{
170-
"cakephp-mysql",
171-
"https://raw.githubusercontent.com/openshift/cakephp-ex/master/openshift/templates/cakephp-mysql.json",
172-
"cakephp-mysql-example",
173-
"cakephp-mysql-example",
174-
"cakephp-mysql-example",
175-
"<span class=\"code\" id=\"count-value\">1</span>",
176-
"",
177-
"mysql",
178-
"mysql",
171+
sampleRepoConfig{
172+
repoName: "cakephp-mysql",
173+
templateURL: "https://raw.githubusercontent.com/openshift/cakephp-ex/master/openshift/templates/cakephp-mysql.json",
174+
buildConfigName: "cakephp-mysql-example",
175+
serviceName: "cakephp-mysql-example",
176+
deploymentConfigName: "cakephp-mysql-example",
177+
expectedString: htmlCountValueNonZeroRegexp,
178+
appPath: "",
179+
dbDeploymentConfigName: "mysql",
180+
dbServiceName: "mysql",
179181
},
180182
))
181183

182184
var _ = g.Describe("[image_ecosystem][perl] test perl images with dancer-ex db repo", NewSampleRepoTest(
183-
SampleRepoConfig{
184-
"dancer-mysql",
185-
"https://raw.githubusercontent.com/openshift/dancer-ex/master/openshift/templates/dancer-mysql.json",
186-
"dancer-mysql-example",
187-
"dancer-mysql-example",
188-
"dancer-mysql-example",
189-
"<span class=\"code\" id=\"count-value\">1</span>",
190-
"",
191-
"database",
192-
"database",
185+
sampleRepoConfig{
186+
repoName: "dancer-mysql",
187+
templateURL: "https://raw.githubusercontent.com/openshift/dancer-ex/master/openshift/templates/dancer-mysql.json",
188+
buildConfigName: "dancer-mysql-example",
189+
serviceName: "dancer-mysql-example",
190+
deploymentConfigName: "dancer-mysql-example",
191+
expectedString: htmlCountValueNonZeroRegexp,
192+
appPath: "",
193+
dbDeploymentConfigName: "database",
194+
dbServiceName: "database",
193195
},
194196
))
195197

196198
// test the no-db templates too
197199
g.Describe("[image_ecosystem][python] test python images with django-ex repo", NewSampleRepoTest(
198-
SampleRepoConfig{
199-
"django",
200-
"https://raw.githubusercontent.com/openshift/django-ex/master/openshift/templates/django.json",
201-
"django-example",
202-
"django-example",
203-
"django-example",
204-
"Welcome",
205-
"",
206-
"",
207-
"",
200+
sampleRepoConfig{
201+
repoName: "django",
202+
templateURL: "https://raw.githubusercontent.com/openshift/django-ex/master/openshift/templates/django.json",
203+
buildConfigName: "django-example",
204+
serviceName: "django-example",
205+
deploymentConfigName: "django-example",
206+
expectedString: "Welcome",
207+
appPath: "",
208+
dbDeploymentConfigName: "",
209+
dbServiceName: "",
208210
},
209211
))
210212

211213
g.Describe("[image_ecosystem][nodejs] images with nodejs-ex repo", NewSampleRepoTest(
212-
SampleRepoConfig{
213-
"nodejs",
214-
"https://raw.githubusercontent.com/openshift/nodejs-ex/master/openshift/templates/nodejs.json",
215-
"nodejs-example",
216-
"nodejs-example",
217-
"nodejs-example",
218-
"Welcome",
219-
"",
220-
"",
221-
"",
214+
sampleRepoConfig{
215+
repoName: "nodejs",
216+
templateURL: "https://raw.githubusercontent.com/openshift/nodejs-ex/master/openshift/templates/nodejs.json",
217+
buildConfigName: "nodejs-example",
218+
serviceName: "nodejs-example",
219+
deploymentConfigName: "nodejs-example",
220+
expectedString: "Welcome",
221+
appPath: "",
222+
dbDeploymentConfigName: "",
223+
dbServiceName: "",
222224
},
223225
))
224226

225227
var _ = g.Describe("[image_ecosystem][php] test php images with cakephp-ex repo", NewSampleRepoTest(
226-
SampleRepoConfig{
227-
"cakephp",
228-
"https://raw.githubusercontent.com/openshift/cakephp-ex/master/openshift/templates/cakephp.json",
229-
"cakephp-example",
230-
"cakephp-example",
231-
"cakephp-example",
232-
"Welcome",
233-
"",
234-
"",
235-
"",
228+
sampleRepoConfig{
229+
repoName: "cakephp",
230+
templateURL: "https://raw.githubusercontent.com/openshift/cakephp-ex/master/openshift/templates/cakephp.json",
231+
buildConfigName: "cakephp-example",
232+
serviceName: "cakephp-example",
233+
deploymentConfigName: "cakephp-example",
234+
expectedString: "Welcome",
235+
appPath: "",
236+
dbDeploymentConfigName: "",
237+
dbServiceName: "",
236238
},
237239
))
238240

239241
var _ = g.Describe("[image_ecosystem][perl] test perl images with dancer-ex repo", NewSampleRepoTest(
240-
SampleRepoConfig{
241-
"dancer",
242-
"https://raw.githubusercontent.com/openshift/dancer-ex/master/openshift/templates/dancer.json",
243-
"dancer-example",
244-
"dancer-example",
245-
"dancer-example",
246-
"Welcome",
247-
"",
248-
"",
249-
"",
242+
sampleRepoConfig{
243+
repoName: "dancer",
244+
templateURL: "https://raw.githubusercontent.com/openshift/dancer-ex/master/openshift/templates/dancer.json",
245+
buildConfigName: "dancer-example",
246+
serviceName: "dancer-example",
247+
deploymentConfigName: "dancer-example",
248+
expectedString: "Welcome",
249+
appPath: "",
250+
dbDeploymentConfigName: "",
251+
dbServiceName: "",
250252
},
251253
))
252254

0 commit comments

Comments
 (0)