Skip to content

Commit a212a08

Browse files
committed
Update tests
1 parent 45f8fe2 commit a212a08

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

remediation/workflow/metadata/actionmetadata_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,8 @@ func TestKnowledgeBase(t *testing.T) {
181181

182182
func doesActionRepoExist(filePath string) bool {
183183
splitOnSlash := strings.Split(filePath, "/")
184-
owner := splitOnSlash[2]
185-
repo := splitOnSlash[3]
184+
owner := splitOnSlash[5]
185+
repo := splitOnSlash[6]
186186

187187
PAT := os.Getenv("PAT")
188188
if len(PAT) == 0 {
@@ -207,13 +207,13 @@ func doesActionRepoExist(filePath string) bool {
207207
ref.Ref = *branch
208208

209209
// does the path to folder is correct for action repository
210-
if len(splitOnSlash) > 5 {
211-
folder := strings.Join(splitOnSlash[4:len(splitOnSlash)-1], "/")
210+
if len(splitOnSlash) > 8 {
211+
folder := strings.Join(splitOnSlash[7:len(splitOnSlash)-1], "/")
212212
folder += "/action.yml"
213213
_, _, _, err = client.Repositories.GetContents(context.Background(), owner, repo, folder, &ref)
214214

215215
if err != nil {
216-
folder := strings.Join(splitOnSlash[4:len(splitOnSlash)-1], "/")
216+
folder := strings.Join(splitOnSlash[7:len(splitOnSlash)-1], "/")
217217
folder += "/action.yaml" // try out .yaml extension as well
218218
_, _, _, err = client.Repositories.GetContents(context.Background(), owner, repo, folder, &ref)
219219

remediation/workflow/pin/pindocker_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,13 @@ func TestDockerActions(t *testing.T) {
5252
//step.2> Get manifest file by setting header as (Authorization : Bearer <token>) and using this api call (https://<service>/v2/<name>/manifests/<tag>)
5353
//step.3> Download response and save it in this path (testfiles/pindockers/response/<name>.txt)
5454
httpmock.RegisterResponder("GET", "https://ghcr.io/v2/step-security/integration-test/int/manifests/latest",
55-
httpmock.NewStringResponder(200, httpmock.File("testfiles/pindockers/response/ghcrResponse.json").String()))
55+
httpmock.NewStringResponder(200, httpmock.File("../../../testfiles/pindockers/response/ghcrResponse.json").String()))
5656

5757
httpmock.RegisterResponder("GET", "https://gcr.io/v2/gcp-runtimes/container-structure-test/manifests/latest",
58-
httpmock.NewStringResponder(200, httpmock.File("testfiles/pindockers/response/gcrResponse.json").String()))
58+
httpmock.NewStringResponder(200, httpmock.File("../../../testfiles/pindockers/response/gcrResponse.json").String()))
5959

6060
httpmock.RegisterResponder("GET", "https://index.docker.io/v2/markstreet/conker/manifests/latest",
61-
httpmock.NewStringResponder(200, httpmock.File("testfiles/pindockers/response/dockerResponse.json").String()))
61+
httpmock.NewStringResponder(200, httpmock.File("../../../testfiles/pindockers/response/dockerResponse.json").String()))
6262

6363
for _, f := range files {
6464
input, err := ioutil.ReadFile(path.Join(inputDirectory, f.Name()))

0 commit comments

Comments
 (0)