Skip to content

Commit f4e5a60

Browse files
Merge pull request #18541 from gabemontero/add-declarative-ext-test
Automatic merge from submit-queue (batch tested with PRs 18380, 18541). add declarative pipeline example to build extended test suite @openshift/sig-developer-experience ptal
2 parents 3c18cd3 + 125803a commit f4e5a60

File tree

1 file changed

+53
-3
lines changed

1 file changed

+53
-3
lines changed

test/extended/builds/pipeline.go

Lines changed: 53 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,10 @@ func debugAnyJenkinsFailure(br *exutil.BuildResult, name string, oc *exutil.CLI,
5757
var _ = g.Describe("[Feature:Builds][Slow] openshift pipeline build", func() {
5858
defer g.GinkgoRecover()
5959
var (
60-
jenkinsTemplatePath = exutil.FixturePath("..", "..", "examples", "jenkins", "jenkins-ephemeral-template.json")
61-
mavenSlavePipelinePath = exutil.FixturePath("..", "..", "examples", "jenkins", "pipeline", "maven-pipeline.yaml")
62-
mavenSlaveGradlePipelinePath = exutil.FixturePath("testdata", "builds", "gradle-pipeline.yaml")
60+
jenkinsTemplatePath = exutil.FixturePath("..", "..", "examples", "jenkins", "jenkins-ephemeral-template.json")
61+
nodejsDeclarativePipelinePath = exutil.FixturePath("..", "..", "examples", "jenkins", "pipeline", "nodejs-sample-pipeline.yaml")
62+
mavenSlavePipelinePath = exutil.FixturePath("..", "..", "examples", "jenkins", "pipeline", "maven-pipeline.yaml")
63+
mavenSlaveGradlePipelinePath = exutil.FixturePath("testdata", "builds", "gradle-pipeline.yaml")
6364
//orchestrationPipelinePath = exutil.FixturePath("..", "..", "examples", "jenkins", "pipeline", "mapsapp-pipeline.yaml")
6465
blueGreenPipelinePath = exutil.FixturePath("..", "..", "examples", "jenkins", "pipeline", "bluegreen-pipeline.yaml")
6566
clientPluginPipelinePath = exutil.FixturePath("..", "..", "examples", "jenkins", "pipeline", "openshift-client-plugin-pipeline.yaml")
@@ -230,6 +231,55 @@ var _ = g.Describe("[Feature:Builds][Slow] openshift pipeline build", func() {
230231
})
231232
})
232233

234+
g.Context("Pipelines with declarative syntax", func() {
235+
g.BeforeEach(func() {
236+
setupJenkins()
237+
238+
if os.Getenv(jenkins.EnableJenkinsMemoryStats) != "" {
239+
ticker = jenkins.StartJenkinsMemoryTracking(oc, oc.Namespace())
240+
}
241+
242+
g.By("waiting for builder service account")
243+
err := exutil.WaitForBuilderAccount(oc.KubeClient().Core().ServiceAccounts(oc.Namespace()))
244+
o.Expect(err).NotTo(o.HaveOccurred())
245+
})
246+
247+
g.AfterEach(func() {
248+
if g.CurrentGinkgoTestDescription().Failed {
249+
exutil.DumpPodStates(oc)
250+
exutil.DumpPodLogsStartingWith("", oc)
251+
}
252+
if os.Getenv(jenkins.EnableJenkinsMemoryStats) != "" {
253+
ticker.Stop()
254+
}
255+
})
256+
257+
g.It("should build successfully", func() {
258+
// create the bc
259+
g.By(fmt.Sprintf("calling oc create -f %q", nodejsDeclarativePipelinePath))
260+
err := oc.Run("create").Args("-f", nodejsDeclarativePipelinePath).Execute()
261+
o.Expect(err).NotTo(o.HaveOccurred())
262+
263+
// start the build
264+
g.By("starting the pipeline build and waiting for it to complete")
265+
br, err := exutil.StartBuildAndWait(oc, "nodejs-sample-pipeline")
266+
if err != nil || !br.BuildSuccess {
267+
exutil.DumpBuilds(oc)
268+
exutil.DumpPodLogsStartingWith("nodejs", oc)
269+
exutil.DumpBuildLogs("nodejs-mongodb-example", oc)
270+
exutil.DumpDeploymentLogs("mongodb", 1, oc)
271+
exutil.DumpDeploymentLogs("nodejs-mongodb-example", 1, oc)
272+
}
273+
debugAnyJenkinsFailure(br, oc.Namespace()+"-nodejs-sample-pipeline", oc, true)
274+
br.AssertSuccess()
275+
276+
// wait for the service to be running
277+
g.By("expecting the openshift-jee-sample service to be deployed and running")
278+
_, err = exutil.GetEndpointAddress(oc, "nodejs-mongodb-example")
279+
o.Expect(err).NotTo(o.HaveOccurred())
280+
})
281+
})
282+
233283
g.Context("Sync secret to credential", func() {
234284
g.BeforeEach(func() {
235285
setupJenkins()

0 commit comments

Comments
 (0)