@@ -2,6 +2,7 @@ package scanner
2
2
3
3
import (
4
4
"context"
5
+ "github.com/boostsecurityio/poutine/models"
5
6
"github.com/boostsecurityio/poutine/opa"
6
7
"github.com/stretchr/testify/assert"
7
8
"testing"
@@ -69,3 +70,31 @@ func TestRun(t *testing.T) {
69
70
assert .Contains (t , s .Package .PackageDependencies , "pkg:docker/alpine%3Alatest" )
70
71
assert .Equal (t , 3 , len (s .Package .GitlabciConfigs ))
71
72
}
73
+
74
+ func TestPipelineAsCodeTekton (t * testing.T ) {
75
+ s := NewScanner ("testdata" )
76
+ o , _ := opa .NewOpa ()
77
+ err := s .Run (context .TODO (), o )
78
+ assert .NoError (t , err )
79
+
80
+ pipelines := s .Package .PipelineAsCodeTekton
81
+
82
+ assert .Len (t , pipelines , 1 )
83
+ expectedAnnotations := map [string ]string {
84
+ "pipelinesascode.tekton.dev/on-event" : "[push, pull_request]" ,
85
+ "pipelinesascode.tekton.dev/on-target-branch" : "[*]" ,
86
+ "pipelinesascode.tekton.dev/task" : "[git-clone]" ,
87
+ }
88
+ expectedPipeline := models.PipelineAsCodeTekton {
89
+ ApiVersion : "tekton.dev/v1beta1" ,
90
+ Kind : "PipelineRun" ,
91
+ Metadata : struct {
92
+ Name string `json:"name"`
93
+ Annotations map [string ]string `json:"annotations"`
94
+ }{
95
+ Name : "linters" ,
96
+ Annotations : expectedAnnotations ,
97
+ },
98
+ }
99
+ assert .Equal (t , expectedPipeline , pipelines [0 ])
100
+ }
0 commit comments