Skip to content

Commit

Permalink
e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
laurentsimon committed May 2, 2022
1 parent f1e4d9f commit c95a257
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
1 change: 0 additions & 1 deletion checks/raw/binary_artifact.go
Expand Up @@ -107,7 +107,6 @@ var checkBinaryFileContent fileparser.DoWhileTrueOnFileContent = func(path strin
})
}

fmt.Println(*pfiles)
return true, nil
}

Expand Down
19 changes: 11 additions & 8 deletions e2e/binary_artifacts_test.go
Expand Up @@ -76,10 +76,11 @@ var _ = Describe("E2E TEST:"+checks.CheckBinaryArtifacts, func() {
Dlogger: &dl,
}
// TODO: upload real binaries to the repo as well.
// There are 24 dummy binaries that are ignoreed because they only contain ASCII characters.
expected := scut.TestReturn{
Error: nil,
Score: checker.MinResultScore,
NumberOfWarn: 24,
Score: checker.MaxResultScore - 1,
NumberOfWarn: 1,
NumberOfInfo: 0,
NumberOfDebug: 0,
}
Expand All @@ -96,7 +97,7 @@ var _ = Describe("E2E TEST:"+checks.CheckBinaryArtifacts, func() {
repo, err := githubrepo.MakeGithubRepo("ossf-tests/scorecard-check-binary-artifacts-e2e")
Expect(err).Should(BeNil())
repoClient := githubrepo.CreateGithubRepoClient(context.Background(), logger)
err = repoClient.InitRepo(repo, "0c6e8991781bba24bfaaa0525f69329f672ef7b5")
err = repoClient.InitRepo(repo, "5b48dea88825662d67ed94b609b45cf7705333b6")
Expect(err).Should(BeNil())

req := checker.CheckRequest{
Expand All @@ -106,10 +107,11 @@ var _ = Describe("E2E TEST:"+checks.CheckBinaryArtifacts, func() {
Dlogger: &dl,
}
// TODO: upload real binaries to the repo as well.
// There are 24 dummy binaries that are ignoreed because they only contain ASCII characters.
expected := scut.TestReturn{
Error: nil,
Score: checker.MinResultScore,
NumberOfWarn: 24,
Score: checker.MaxResultScore - 1,
NumberOfWarn: 1,
NumberOfInfo: 0,
NumberOfDebug: 0,
}
Expand All @@ -121,7 +123,7 @@ var _ = Describe("E2E TEST:"+checks.CheckBinaryArtifacts, func() {
Expect(scut.ValidateTestReturn(nil, "binary artifacts", &expected, &result, &dl)).Should(BeTrue())
Expect(repoClient.Close()).Should(BeNil())
})
It("Should return binary artifacts present in source code", func() {
It("Should return no binary artifacts present in source code", func() {
dl := scut.TestDetailLogger{}
repo, err := githubrepo.MakeGithubRepo("ossf-tests/scorecard-check-binary-artifacts-e2e-4-binaries")
Expect(err).Should(BeNil())
Expand All @@ -136,10 +138,11 @@ var _ = Describe("E2E TEST:"+checks.CheckBinaryArtifacts, func() {
Dlogger: &dl,
}
// TODO: upload real binaries to the repo as well.
// Existing binaries only contain SCII characters and are ignored.
expected := scut.TestReturn{
Error: nil,
Score: checker.MaxResultScore - 4,
NumberOfWarn: 4,
Score: checker.MaxResultScore,
NumberOfWarn: 0,
NumberOfInfo: 0,
NumberOfDebug: 0,
}
Expand Down

0 comments on commit c95a257

Please sign in to comment.