Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Units Tests are Failing #332

Open
DarikshaAnsari opened this issue Jun 2, 2024 · 0 comments
Open

Units Tests are Failing #332

DarikshaAnsari opened this issue Jun 2, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@DarikshaAnsari
Copy link

When I run go test -v in the in_toto folder, I encounter several tests functions running with FAIL output:

  1. TestEncodeProvenanceStatementSLSA02
  2. TestEncodeProvenanceStatementSLSA01
  3. TestSymlinkToFile
  4. TestIndirectSymlinkCycles
  5. TestSymlinkToFolder
  6. TestSymlinkCycle

This indicates that the unit tests are not working correctly.

My terminal is throwing errors:

=== RUN   TestEncodeProvenanceStatementSLSA02
    attestations_test.go:188:
                Error Trace:    C:/Users/asus/OneDrive/Desktop/in-toto-golang/in_toto/attestations_test.go:188
                Error:          Not equal:
                                expected: "{\"_type\":\"https://in-toto.io/Statement/v0.1\",\"predicateType\":\"https://slsa.dev/provenance/v0.2\",\"subject\":[{\"name\":\"curl-7.72.0.tar.bz2\",\"digest\":{\"sha256\":\"ad91970864102a59765e20ce16216efc9d6ad381471f7accceceab7d905703ef\"}},{\"name\":\"curl-7.72.0.tar.gz\",\"digest\":{\"sha256\":\"d4d5899a3868fbb6ae1856c3e55a32ce35913de3956d1973caccd37bd0174fa2\"}}],\"predicate\":{\"builder\":{\"id\":\"https://github.com/Attestations/GitHubHostedActions@v1\"},\"buildType\":\"https://github.com/Attestations/GitHubActionsWorkflow@v1\",\"invocation\":{\"configSource\":{\"uri\":\"git+https://github.com/curl/curl-docker@master\",\"digest\":{\"sha1\":\"d6525c840a62b398424a78d792f457477135d0cf\"},\"entryPoint\":\"build.yaml:maketgz\"}},\"metadata\":{\"buildStartedOn\":\"2020-08-19T08:38:00Z\",\"buildFinishedOn\":\"2020-08-19T08:38:00Z\",\"completeness\":{\"parameters\":true,\"environment\":false,\"materials\":true},\"reproducible\":false},\"materials\":[{\"uri\":\"git+https://github.com/curl/curl-docker@master\",\"digest\":{\"sha1\":\"d6525c840a62b398424a78d792f457477135d0cf\"}},{\"uri\":\"github_hosted_vm:ubuntu-18.04:20210123.1\"},{\"uri\":\"git+https://github.com/curl/\"}]}}"
                                actual  : "{\"_type\":\"https://in-toto.io/Statement/v0.1\",\"predicateType\":\"https://slsa.dev/provenance/v0.2\",\"subject\":[{\"name\":\"curl-7.72.0.tar.bz2\",\"digest\":{\"sha256\":\"ad91970864102a59765e20ce16216efc9d6ad381471f7accceceab7d905703ef\"}},{\"name\":\"curl-7.72.0.tar.gz\",\"digest\":{\"sha256\":\"d4d5899a3868fbb6ae1856c3e55a32ce35913de3956d1973caccd37bd0174fa2\"}}],\"predicate\":{\"builder\":{\"id\":\"https://github.com/Attestations/GitHubHostedActions@v1\"},\"buildType\":\"https://github.com/Attestations/GitHubActionsWorkflow@v1\",\"invocation\":{\"configSource\":{\"uri\":\"git+https://github.com/curl/curl-docker@master\",\"digest\":{\"sha1\":\"d6525c840a62b398424a78d792f457477135d0cf\"},\"entryPoint\":\"build.yaml:maketgz\"}},\"metadata\":{\"buildStartedOn\":\"2020-08-19T14:08:00+05:30\",\"buildFinishedOn\":\"2020-08-19T14:08:00+05:30\",\"completeness\":{\"parameters\":true,\"environment\":false,\"materials\":true},\"reproducible\":false},\"materials\":[{\"uri\":\"git+https://github.com/curl/curl-docker@master\",\"digest\":{\"sha1\":\"d6525c840a62b398424a78d792f457477135d0cf\"}},{\"uri\":\"github_hosted_vm:ubuntu-18.04:20210123.1\"},{\"uri\":\"git+https://github.com/curl/\"}]}}"

                                Diff:
                                --- Expected
                                +++ Actual
                                @@ -1 +1 @@
                                -{"_type":"https://in-toto.io/Statement/v0.1","predicateType":"https://slsa.dev/provenance/v0.2","subject":[{"name":"curl-7.72.0.tar.bz2","digest":{"sha256":"ad91970864102a59765e20ce16216efc9d6ad381471f7accceceab7d905703ef"}},{"name":"curl-7.72.0.tar.gz","digest":{"sha256":"d4d5899a3868fbb6ae1856c3e55a32ce35913de3956d1973caccd37bd0174fa2"}}],"predicate":{"builder":{"id":"https://github.com/Attestations/GitHubHostedActions@v1"},"buildType":"https://github.com/Attestations/GitHubActionsWorkflow@v1","invocation":{"configSource":{"uri":"git+https://github.com/curl/curl-docker@master","digest":{"sha1":"d6525c840a62b398424a78d792f457477135d0cf"},"entryPoint":"build.yaml:maketgz"}},"metadata":{"buildStartedOn":"2020-08-19T08:38:00Z","buildFinishedOn":"2020-08-19T08:38:00Z","completeness":{"parameters":true,"environment":false,"materials":true},"reproducible":false},"materials":[{"uri":"git+https://github.com/curl/curl-docker@master","digest":{"sha1":"d6525c840a62b398424a78d792f457477135d0cf"}},{"uri":"github_hosted_vm:ubuntu-18.04:20210123.1"},{"uri":"git+https://github.com/curl/"}]}}
                                +{"_type":"https://in-toto.io/Statement/v0.1","predicateType":"https://slsa.dev/provenance/v0.2","subject":[{"name":"curl-7.72.0.tar.bz2","digest":{"sha256":"ad91970864102a59765e20ce16216efc9d6ad381471f7accceceab7d905703ef"}},{"name":"curl-7.72.0.tar.gz","digest":{"sha256":"d4d5899a3868fbb6ae1856c3e55a32ce35913de3956d1973caccd37bd0174fa2"}}],"predicate":{"builder":{"id":"https://github.com/Attestations/GitHubHostedActions@v1"},"buildType":"https://github.com/Attestations/GitHubActionsWorkflow@v1","invocation":{"configSource":{"uri":"git+https://github.com/curl/curl-docker@master","digest":{"sha1":"d6525c840a62b398424a78d792f457477135d0cf"},"entryPoint":"build.yaml:maketgz"}},"metadata":{"buildStartedOn":"2020-08-19T14:08:00+05:30","buildFinishedOn":"2020-08-19T14:08:00+05:30","completeness":{"parameters":true,"environment":false,"materials":true},"reproducible":false},"materials":[{"uri":"git+https://github.com/curl/curl-docker@master","digest":{"sha1":"d6525c840a62b398424a78d792f457477135d0cf"}},{"uri":"github_hosted_vm:ubuntu-18.04:20210123.1"},{"uri":"git+https://github.com/curl/"}]}}
                Test:           TestEncodeProvenanceStatementSLSA02
                Messages:       Wrong JSON produced
--- FAIL: TestEncodeProvenanceStatementSLSA02 (0.01s)
=== RUN   TestEncodeProvenanceStatementSLSA01
    attestations_test.go:352:
                Error Trace:    C:/Users/asus/OneDrive/Desktop/in-toto-golang/in_toto/attestations_test.go:352
                Error:          Not equal:
                                expected: "{\"_type\":\"https://in-toto.io/Statement/v0.1\",\"predicateType\":\"https://slsa.dev/provenance/v0.1\",\"subject\":[{\"name\":\"curl-7.72.0.tar.bz2\",\"digest\":{\"sha256\":\"ad91970864102a59765e20ce16216efc9d6ad381471f7accceceab7d905703ef\"}},{\"name\":\"curl-7.72.0.tar.gz\",\"digest\":{\"sha256\":\"d4d5899a3868fbb6ae1856c3e55a32ce35913de3956d1973caccd37bd0174fa2\"}}],\"predicate\":{\"builder\":{\"id\":\"https://github.com/Attestations/GitHubHostedActions@v1\"},\"recipe\":{\"type\":\"https://github.com/Attestations/GitHubActionsWorkflow@v1\",\"definedInMaterial\":0,\"entryPoint\":\"build.yaml:maketgz\"},\"metadata\":{\"buildStartedOn\":\"2020-08-19T08:38:00Z\",\"buildFinishedOn\":\"2020-08-19T08:38:00Z\",\"completeness\":{\"arguments\":true,\"environment\":false,\"materials\":true},\"reproducible\":false},\"materials\":[{\"uri\":\"git+https://github.com/curl/curl-docker@master\",\"digest\":{\"sha1\":\"d6525c840a62b398424a78d792f457477135d0cf\"}},{\"uri\":\"github_hosted_vm:ubuntu-18.04:20210123.1\"},{\"uri\":\"git+https://github.com/curl/\"}]}}"
                                actual  : "{\"_type\":\"https://in-toto.io/Statement/v0.1\",\"predicateType\":\"https://slsa.dev/provenance/v0.1\",\"subject\":[{\"name\":\"curl-7.72.0.tar.bz2\",\"digest\":{\"sha256\":\"ad91970864102a59765e20ce16216efc9d6ad381471f7accceceab7d905703ef\"}},{\"name\":\"curl-7.72.0.tar.gz\",\"digest\":{\"sha256\":\"d4d5899a3868fbb6ae1856c3e55a32ce35913de3956d1973caccd37bd0174fa2\"}}],\"predicate\":{\"builder\":{\"id\":\"https://github.com/Attestations/GitHubHostedActions@v1\"},\"recipe\":{\"type\":\"https://github.com/Attestations/GitHubActionsWorkflow@v1\",\"definedInMaterial\":0,\"entryPoint\":\"build.yaml:maketgz\"},\"metadata\":{\"buildStartedOn\":\"2020-08-19T14:08:00+05:30\",\"buildFinishedOn\":\"2020-08-19T14:08:00+05:30\",\"completeness\":{\"arguments\":true,\"environment\":false,\"materials\":true},\"reproducible\":false},\"materials\":[{\"uri\":\"git+https://github.com/curl/curl-docker@master\",\"digest\":{\"sha1\":\"d6525c840a62b398424a78d792f457477135d0cf\"}},{\"uri\":\"github_hosted_vm:ubuntu-18.04:20210123.1\"},{\"uri\":\"git+https://github.com/curl/\"}]}}"

                                Diff:
                                --- Expected
                                +++ Actual
                                @@ -1 +1 @@
                                -{"_type":"https://in-toto.io/Statement/v0.1","predicateType":"https://slsa.dev/provenance/v0.1","subject":[{"name":"curl-7.72.0.tar.bz2","digest":{"sha256":"ad91970864102a59765e20ce16216efc9d6ad381471f7accceceab7d905703ef"}},{"name":"curl-7.72.0.tar.gz","digest":{"sha256":"d4d5899a3868fbb6ae1856c3e55a32ce35913de3956d1973caccd37bd0174fa2"}}],"predicate":{"builder":{"id":"https://github.com/Attestations/GitHubHostedActions@v1"},"recipe":{"type":"https://github.com/Attestations/GitHubActionsWorkflow@v1","definedInMaterial":0,"entryPoint":"build.yaml:maketgz"},"metadata":{"buildStartedOn":"2020-08-19T08:38:00Z","buildFinishedOn":"2020-08-19T08:38:00Z","completeness":{"arguments":true,"environment":false,"materials":true},"reproducible":false},"materials":[{"uri":"git+https://github.com/curl/curl-docker@master","digest":{"sha1":"d6525c840a62b398424a78d792f457477135d0cf"}},{"uri":"github_hosted_vm:ubuntu-18.04:20210123.1"},{"uri":"git+https://github.com/curl/"}]}}
                                +{"_type":"https://in-toto.io/Statement/v0.1","predicateType":"https://slsa.dev/provenance/v0.1","subject":[{"name":"curl-7.72.0.tar.bz2","digest":{"sha256":"ad91970864102a59765e20ce16216efc9d6ad381471f7accceceab7d905703ef"}},{"name":"curl-7.72.0.tar.gz","digest":{"sha256":"d4d5899a3868fbb6ae1856c3e55a32ce35913de3956d1973caccd37bd0174fa2"}}],"predicate":{"builder":{"id":"https://github.com/Attestations/GitHubHostedActions@v1"},"recipe":{"type":"https://github.com/Attestations/GitHubActionsWorkflow@v1","definedInMaterial":0,"entryPoint":"build.yaml:maketgz"},"metadata":{"buildStartedOn":"2020-08-19T14:08:00+05:30","buildFinishedOn":"2020-08-19T14:08:00+05:30","completeness":{"arguments":true,"environment":false,"materials":true},"reproducible":false},"materials":[{"uri":"git+https://github.com/curl/curl-docker@master","digest":{"sha1":"d6525c840a62b398424a78d792f457477135d0cf"}},{"uri":"github_hosted_vm:ubuntu-18.04:20210123.1"},{"uri":"git+https://github.com/curl/"}]}}     
                Test:           TestEncodeProvenanceStatementSLSA01
                Messages:       Wrong JSON produced
--- FAIL: TestEncodeProvenanceStatementSLSA01 (0.01s)
    runlib_test.go:129: could not create a symlink: symlink foo.tar.gz foo.tar.gz.sym: A required privilege is not held by the client.
    runlib_test.go:139: RecordArtifacts returned '(map[], CreateFile foo.tar.gz.sym: The system cannot find the file specified.)', expected '(map[foo.tar.gz.sym:map[sha256:52947cb78b91ad01fe81cd6aef42d1f6817e92b9e6936c1e5aabb7c98514f355]], nil)'
    runlib_test.go:144: could not remove foo.tar.gz.sym: remove foo.tar.gz.sym: The system cannot find the file specified.
--- FAIL: TestSymlinkToFile (0.00s)
=== RUN   TestIndirectSymlinkCycles
    runlib_test.go:169: could not create a symlink: symlink C:\Users\asus\AppData\Local\Temp\in_toto_test_dir3807065635\symTestA symTestB\linkToA.sym: A required privilege is not held by the client.
    runlib_test.go:172: could not create a symlink: symlink C:\Users\asus\AppData\Local\Temp\in_toto_test_dir3807065635\symTestB symTestA\linkToB.sym: A required privilege is not held by the client.
    runlib_test.go:178: we expected: symlink cycle detected, we got: CreateFile symTestA/linkToB.sym: The system cannot find the file specified.
    runlib_test.go:183: could not remove path: remove symTestA/linkToB.sym: The system cannot find the file specified.
    runlib_test.go:187: could not remove path: remove symTestB/linkToA.sym: The system cannot find the file specified.
--- FAIL: TestIndirectSymlinkCycles (0.01s)
=== RUN   TestSymlinkToFolder
    runlib_test.go:207: could not create a symlink: symlink symTest\symTest2 symTmpfile.sym: A required privilege is not held by the client.
    runlib_test.go:221: CreateFile symTmpfile.sym: The system cannot find the file specified.
    runlib_test.go:231: RecordArtifacts returned '(map[], CreateFile symTmpfile.sym: The system cannot find the file specified.)', expected '(map[symTmpfile.sym/symTmpfile:map[sha256:ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad]], nil)'
    runlib_test.go:241: could not remove path symTest/symTest2/symTmpfile.sym: remove symTmpfile.sym: The system cannot find the file specified.
--- FAIL: TestSymlinkToFolder (0.01s)
=== RUN   TestSymlinkCycle
    runlib_test.go:267: could not create a symlink: symlink C:\Users\asus\AppData\Local\Temp\in_toto_test_dir3807065635\symlinkCycle symlinkCycle/symCycle.sym: A required privilege is not held by the client.
    runlib_test.go:273: we expected: symlink cycle detected, we got: CreateFile symlinkCycle/symCycle.sym: The system cannot find the file specified.
    runlib_test.go:277: could not remove path symlinkCycle/symCycle.sym: remove symlinkCycle/symCycle.sym: The system cannot find the file specified.
--- FAIL: TestSymlinkCycle (0.01s)
FAIL
Unable to remove directory C:\Users\asus\AppData\Local\Temp\in_toto_test_dir3807065635: remove C:\Users\asus\AppData\Local\Temp\in_toto_test_dir3807065635: The process cannot access the file because it is being used by another process.exit status 1
FAIL    github.com/in-toto/in-toto-golang/in_toto       2.633s
@DarikshaAnsari DarikshaAnsari added the bug Something isn't working label Jun 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant