@@ -34,7 +34,7 @@ func runStartTask(opts ...ttr.TaskRunOpt) error {
3434func TestStartTaskClonesRepoAtBranch (t * testing.T ) {
3535 k8sClient := newK8sClient (t )
3636 if err := runStartTask (
37- withBitbucketSourceWorkspace (t , "../testdata/workspaces/hello-world-app" , k8sClient , namespaceConfig .Name ),
37+ withBitbucketSourceWorkspace (t , "../testdata/workspaces/hello-world-app" , k8sClient , namespaceConfig .Name , false ),
3838 func (c * ttr.TaskRunConfig ) error {
3939 c .Params = append (c .Params , ttr .TektonParamsFromStringParams (map [string ]string {
4040 "url" : bitbucketURLForWorkspace (c .WorkspaceConfigs ["source" ]),
@@ -48,7 +48,7 @@ func TestStartTaskClonesRepoAtBranch(t *testing.T) {
4848 wsDir , odsContext := ott .GetSourceWorkspaceContext (t , config )
4949 checkODSContext (t , wsDir , odsContext )
5050 checkFilesExist (t , wsDir , filepath .Join (pipelinectxt .ArtifactsPath , pipelinectxt .ArtifactsManifestFilename ))
51- bitbucketClient := tasktesting .BitbucketClientOrFatal (t , k8sClient , namespaceConfig .Name , * privateCertFlag )
51+ bitbucketClient := tasktesting .BitbucketClientOrFatal (t , k8sClient , namespaceConfig .Name , false )
5252 checkBuildStatus (t , bitbucketClient , odsContext .GitCommitSHA , bitbucket .BuildStatusInProgress )
5353 }),
5454 ); err != nil {
@@ -59,7 +59,7 @@ func TestStartTaskClonesRepoAtBranch(t *testing.T) {
5959func TestStartTaskClonesRepoAtTag (t * testing.T ) {
6060 k8sClient := newK8sClient (t )
6161 if err := runStartTask (
62- withBitbucketSourceWorkspace (t , "../testdata/workspaces/hello-world-app" , k8sClient , namespaceConfig .Name ),
62+ withBitbucketSourceWorkspace (t , "../testdata/workspaces/hello-world-app" , k8sClient , namespaceConfig .Name , false ),
6363 func (c * ttr.TaskRunConfig ) error {
6464 wsDir , odsContext := ott .GetSourceWorkspaceContext (t , c )
6565 tasktesting .UpdateBitbucketRepoWithTagOrFatal (t , odsContext , wsDir , "v1.0.0" )
@@ -91,7 +91,7 @@ func TestStartTaskClonesRepoAndSubrepos(t *testing.T) {
9191 // Setup sub-component
9292 subrepoContext = setupBitbucketRepoWithSubdirOrFatal (t , c , k8sClient )
9393 // Nexus artifacts
94- nexusClient := tasktesting .NexusClientOrFatal (t , k8sClient , namespaceConfig .Name , * privateCertFlag )
94+ nexusClient := tasktesting .NexusClientOrFatal (t , k8sClient , namespaceConfig .Name , false )
9595 artifactsBaseDir := filepath .Join (projectpath .Root , "test" , testdataWorkspacesPath , "hello-world-app-with-artifacts" , pipelinectxt .ArtifactsPath )
9696 _ , err := nexusClient .Upload (
9797 nexus .TestTemporaryRepository ,
@@ -141,7 +141,7 @@ func TestStartTaskClonesRepoAndSubrepos(t *testing.T) {
141141 checkFileContent (t , destinationArtifactsBaseDir , xUnitFileSource , xUnitContent )
142142 checkFilesExist (t , destinationArtifactsBaseDir , pipelinectxt .ArtifactsManifestFilename )
143143
144- bitbucketClient := tasktesting .BitbucketClientOrFatal (t , k8sClient , namespaceConfig .Name , * privateCertFlag )
144+ bitbucketClient := tasktesting .BitbucketClientOrFatal (t , k8sClient , namespaceConfig .Name , false )
145145 checkBuildStatus (t , bitbucketClient , odsContext .GitCommitSHA , bitbucket .BuildStatusInProgress )
146146 }),
147147 ); err != nil {
@@ -194,7 +194,7 @@ func TestStartTaskClonesUsingLFS(t *testing.T) {
194194 "../testdata/workspaces/hello-world-app" ,
195195 func (c * ttr.WorkspaceConfig ) error {
196196 odsContext := tasktesting .SetupBitbucketRepo (
197- t , k8sClient , namespaceConfig .Name , c .Dir , tasktesting .BitbucketProjectKey , * privateCertFlag ,
197+ t , k8sClient , namespaceConfig .Name , c .Dir , tasktesting .BitbucketProjectKey , false ,
198198 )
199199 tasktesting .EnableLfsOnBitbucketRepoOrFatal (t , filepath .Base (c .Dir ), tasktesting .BitbucketProjectKey )
200200 lfsFilename = "lfspicture.jpg"
@@ -221,40 +221,33 @@ func TestStartTaskClonesUsingLFS(t *testing.T) {
221221 }
222222}
223223
224- // func TestStartTaskUsesPrivateCert(t *testing.T) {
225- // k8sClient := newK8sClient(t)
226- // nc, cleanup, err := ttr.SetupTempNamespace(
227- // clusterConfig,
228- // ott.StartBitbucket(),
229- // ott.StartNexus(),
230- // ott.InstallODSPipeline(&ott.InstallOptions{PrivateCert: true}),
231- // )
232- // if err != nil {
233- // t.Fatal(err)
234- // }
235- // defer cleanup()
236- // if err := runStartTask(
237- // withBitbucketSourceWorkspace(t, "../testdata/workspaces/hello-world-app", k8sClient, nc.Name),
238- // func(c *ttr.TaskRunConfig) error {
239- // c.Params = append(c.Params, ttr.TektonParamsFromStringParams(map[string]string{
240- // "url": bitbucketURLForWorkspace(c.WorkspaceConfigs["source"]),
241- // "git-full-ref": "refs/heads/master",
242- // "project": tasktesting.BitbucketProjectKey,
243- // "pipeline-run-name": "foo",
244- // })...)
245- // return nil
246- // },
247- // ttr.AfterRun(func(config *ttr.TaskRunConfig, run *tekton.TaskRun, logs bytes.Buffer) {
248- // wsDir, odsContext := ott.GetSourceWorkspaceContext(t, config)
249- // checkODSContext(t, wsDir, odsContext)
250- // checkFilesExist(t, wsDir, filepath.Join(pipelinectxt.ArtifactsPath, pipelinectxt.ArtifactsManifestFilename))
251- // bitbucketClient := tasktesting.BitbucketClientOrFatal(t, k8sClient, nc.Name, *privateCertFlag)
252- // checkBuildStatus(t, bitbucketClient, odsContext.GitCommitSHA, bitbucket.BuildStatusInProgress)
253- // }),
254- // ); err != nil {
255- // t.Fatal(err)
256- // }
257- // }
224+ func TestStartTaskUsesPrivateCert (t * testing.T ) {
225+ k8sClient := newK8sClient (t )
226+ nc , cleanup , err := ttr .SetupTempNamespace (
227+ clusterConfig ,
228+ ott .InstallODSPipeline (& ott.InstallOptions {PrivateCert : true }),
229+ )
230+ if err != nil {
231+ t .Fatal (err )
232+ }
233+ defer cleanup ()
234+ if err := ttr .RunTask (
235+ ttr .InNamespace (nc .Name ),
236+ ttr .UsingTask ("ods-pipeline-start" ),
237+ withBitbucketSourceWorkspace (t , "../testdata/workspaces/hello-world-app" , k8sClient , nc .Name , true ),
238+ func (c * ttr.TaskRunConfig ) error {
239+ c .Params = append (c .Params , ttr .TektonParamsFromStringParams (map [string ]string {
240+ "url" : bitbucketURLForWorkspace (c .WorkspaceConfigs ["source" ]),
241+ "git-full-ref" : "refs/heads/master" ,
242+ "project" : tasktesting .BitbucketProjectKey ,
243+ "pipeline-run-name" : "foo" ,
244+ })... )
245+ return nil
246+ },
247+ ); err != nil {
248+ t .Fatal (err )
249+ }
250+ }
258251
259252func setupBitbucketRepoWithSubdirOrFatal (t * testing.T , c * ttr.WorkspaceConfig , k8sClient kubernetes.Interface ) * pipelinectxt.ODSContext {
260253 // Setup sub-component
@@ -267,7 +260,7 @@ func setupBitbucketRepoWithSubdirOrFatal(t *testing.T, c *ttr.WorkspaceConfig, k
267260 t .Fatal (err )
268261 }
269262 subCtxt := tasktesting .SetupBitbucketRepo (
270- t , k8sClient , namespaceConfig .Name , tempDir , tasktesting .BitbucketProjectKey , * privateCertFlag ,
263+ t , k8sClient , namespaceConfig .Name , tempDir , tasktesting .BitbucketProjectKey , false ,
271264 )
272265 err = os .RemoveAll (tempDir )
273266 if err != nil {
@@ -278,7 +271,7 @@ func setupBitbucketRepoWithSubdirOrFatal(t *testing.T, c *ttr.WorkspaceConfig, k
278271 t .Fatal (err )
279272 }
280273 _ = tasktesting .SetupBitbucketRepo (
281- t , k8sClient , namespaceConfig .Name , c .Dir , tasktesting .BitbucketProjectKey , * privateCertFlag ,
274+ t , k8sClient , namespaceConfig .Name , c .Dir , tasktesting .BitbucketProjectKey , false ,
282275 )
283276 return subCtxt
284277}
0 commit comments