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

Tests on the main branch fail #6703

Closed
nikpivkin opened this issue Apr 19, 2024 · 3 comments · Fixed by #6707
Closed

Tests on the main branch fail #6703

nikpivkin opened this issue Apr 19, 2024 · 3 comments · Fixed by #6707

Comments

@nikpivkin
Copy link

nikpivkin commented Apr 19, 2024

Short description

  • branch: main
  • commit: 3954ba0c80b5f00a8b30caff7b5ae600d551df1f
  • opa: 0.63.0
  • go: go1.22.2 darwin/arm64
  • os: MacOS

Steps To Reproduce

  1. git checkout main
  2. make test

Expected behavior

Tests will be completed successfully

Additional context

--- FAIL: TestBenchMainWithBundleRegoVersion (67.37s)
    --- FAIL: TestBenchMainWithBundleRegoVersion/bundle_dir,_v0_bundle,_e2e (0.45s)
        bench_test.go:1001: Unexpected return code 1, expected 0
{"level":"error","msg":"Bundle activation failed: 1 error occurred: ~0/policy2.rego:3: rego_parse_error: unexpected identifier token: expected \\n or ; or }\n\t42 in p\n\t   ^","name":"~0","plugin":"bundle","time":"2024-04-19T22:11:50+07:00"}
{"level":"error","msg":"Bundle activation failed: 1 error occurred: ~0/policy2.rego:3: rego_parse_error: unexpected identifier token: expected \\n or ; or }\n\t42 in p\n\t   ^","name":"~0","plugin":"bundle","time":"2024-04-19T22:11:50+07:00"}
{"level":"error","msg":"Bundle activation failed: 3 errors occurred:\n~0/policy.rego:2: rego_parse_error: var cannot be used for rule name\n~0/policy.rego:2: rego_parse_error: var cannot be used for rule name\n~0/policy.rego:2: rego_parse_error: string cannot be used for rule name","name":"~0","plugin":"bundle","time":"2024-04-19T22:11:50+07:00"}
{"level":"error","msg":"Bundle activation failed: 1 error occurred: ~0/policy2.rego:3: rego_parse_error: unexpected identifier token: expected \\n or ; or }\n\t42 in p\n\t   ^","name":"~0","plugin":"bundle","time":"2024-04-19T22:11:50+07:00"}
{"level":"error","msg":"Bundle activation failed: 1 error occurred: ~0/policy2.rego:3: rego_parse_error: unexpected identifier token: expected \\n or ; or }\n\t42 in p\n\t   ^","name":"~0","plugin":"bundle","time":"2024-04-19T22:11:50+07:00"}
{"level":"error","msg":"Bundle activation failed: 2 errors occurred:\n~0/policy.rego:2: rego_parse_error: `if` keyword is required before rule body\n~0/policy.rego:2: rego_parse_error: `contains` keyword is required for partial set rules","name":"~0","plugin":"bundle","time":"2024-04-19T22:11:50+07:00"}
{"level":"error","msg":"Bundle activation failed: 2 errors occurred:\n~0/policy1.rego:2: rego_parse_error: `if` keyword is required before rule body\n~0/policy1.rego:2: rego_parse_error: `contains` keyword is required for partial set rules","name":"~0","plugin":"bundle","time":"2024-04-19T22:11:50+07:00"}
{"level":"error","msg":"Bundle activation failed: 2 errors occurred:\n~0/policy1.rego:2: rego_parse_error: `if` keyword is required before rule body\n~0/policy1.rego:2: rego_parse_error: `contains` keyword is required for partial set rules","name":"~0","plugin":"bundle","time":"2024-04-19T22:11:50+07:00"}
{"level":"error","msg":"Bundle activation failed: 2 errors occurred:\n~0/policy1.rego:2: rego_parse_error: `if` keyword is required before rule body\n~0/policy1.rego:2: rego_parse_error: `contains` keyword is required for partial set rules","name":"~0","plugin":"bundle","time":"2024-04-19T22:11:50+07:00"}
{"level":"error","msg":"Bundle activation failed: 2 errors occurred:\n~0/policy1.rego:2: rego_parse_error: `if` keyword is required before rule body\n~0/policy1.rego:2: rego_parse_error: `contains` keyword is required for partial set rules","name":"~0","plugin":"bundle","time":"2024-04-19T22:11:50+07:00"}
{"level":"error","msg":"Bundle activation failed: 1 error occurred: ~0/policy2.rego:3: rego_parse_error: unexpected identifier token: expected \\n or ; or }\n\t42 in p\n\t   ^","name":"~0","plugin":"bundle","time":"2024-04-19T22:11:50+07:00"}
{"level":"error","msg":"Bundle activation failed: 1 error occurred: ~0/policy2.rego:3: rego_parse_error: unexpected identifier token: expected \\n or ; or }\n\t42 in p\n\t   ^","name":"~0","plugin":"bundle","time":"2024-04-19T22:11:50+07:00"}
{"level":"error","msg":"Bundle activation failed: 3 errors occurred:\n~0/policy.rego:2: rego_parse_error: var cannot be used for rule name\n~0/policy.rego:2: rego_parse_error: var cannot be used for rule name\n~0/policy.rego:2: rego_parse_error: string cannot be used for rule name","name":"~0","plugin":"bundle","time":"2024-04-19T22:11:50+07:00"}
{"level":"error","msg":"Bundle activation failed: 1 error occurred: ~0/policy2.rego:3: rego_parse_error: unexpected identifier token: expected \\n or ; or }\n\t42 in p\n\t   ^","name":"~0","plugin":"bundle","time":"2024-04-19T22:11:50+07:00"}
{"level":"error","msg":"Bundle activation failed: 1 error occurred: ~0/policy2.rego:3: rego_parse_error: unexpected identifier token: expected \\n or ; or }\n\t42 in p\n\t   ^","name":"~0","plugin":"bundle","time":"2024-04-19T22:11:50+07:00"}
{"level":"error","msg":"Bundle activation failed: 2 errors occurred:\n~0/policy.rego:2: rego_parse_error: `if` keyword is required before rule body\n~0/policy.rego:2: rego_parse_error: `contains` keyword is required for partial set rules","name":"~0","plugin":"bundle","time":"2024-04-19T22:11:50+07:00"}
{"level":"error","msg":"Bundle activation failed: 2 errors occurred:\n~0/policy1.rego:2: rego_parse_error: `if` keyword is required before rule body\n~0/policy1.rego:2: rego_parse_error: `contains` keyword is required for partial set rules","name":"~0","plugin":"bundle","time":"2024-04-19T22:11:50+07:00"}
{"level":"error","msg":"Bundle activation failed: 2 errors occurred:\n~0/policy1.rego:2: rego_parse_error: `if` keyword is required before rule body\n~0/policy1.rego:2: rego_parse_error: `contains` keyword is required for partial set rules","name":"~0","plugin":"bundle","time":"2024-04-19T22:11:50+07:00"}
{"level":"error","msg":"Bundle activation failed: 2 errors occurred:\n~0/policy1.rego:2: rego_parse_error: `if` keyword is required before rule body\n~0/policy1.rego:2: rego_parse_error: `contains` keyword is required for partial set rules","name":"~0","plugin":"bundle","time":"2024-04-19T22:11:50+07:00"}
{"level":"error","msg":"Bundle activation failed: 2 errors occurred:\n~0/policy1.rego:2: rego_parse_error: `if` keyword is required before rule body\n~0/policy1.rego:2: rego_parse_error: `contains` keyword is required for partial set rules","name":"~0","plugin":"bundle","time":"2024-04-19T22:11:50+07:00"}
{"level":"error","msg":"Bundle activation failed: 1 error occurred: /example.rego:4: rego_type_error: undefined function bits.sand","name":"test","plugin":"bundle","time":"2024-04-19T22:11:50+07:00"}
@nikpivkin nikpivkin added the bug label Apr 19, 2024
@ashutosh-narkar
Copy link
Member

Hmm..I am not able to repro this. There could be something going on in your local setup. My version is go1.21.0 darwin/amd64 but even with the updated Go version, I wouldn't expect this test failure.

@nikpivkin
Copy link
Author

Strangely, clearing the cache helped. But I am facing another error while running wasm tests, could you please help?

docker run --name opa-wasm-testgen-container -u 501:20 -v /Users/nikita/projects/opa/.go/bin:/go/bin:Z -v /Users/nikita/projects/opa:/src:z -v /Users/nikita/projects/opa/test/wasm/assets:/assets:Z -e GOCACHE=/src/.go/cache -w /src golang:1.22.2 sh -c 'make wasm-rego-testgen-install \
                && wasm-rego-testgen \
                --input-dir=/assets \
                --runner=/src/test/wasm/assets/test.js \
                --output=/src/.go/cache/testcases.tar.gz'
fatal: detected dubious ownership in repository at '/src'
To add an exception for this directory, call:

        git config --global --add safe.directory /src
CGO_ENABLED=1 GOFLAGS=""-buildmode=exe"" go install ./test/wasm/cmd/wasm-rego-testgen
error obtaining VCS status: exit status 128
        Use -buildvcs=false to disable VCS stamping.
make: *** [Makefile:236: wasm-rego-testgen-install] Error 1

ashutosh-narkar added a commit to ashutosh-narkar/opa that referenced this issue Apr 22, 2024
This change updates the WASM Rego test generation docker
command to address CVE-2022-24765 in Git which could cause
it to execute arbitrary commands.

The error was seen when running the `make wasm-rego-test` target on
darwin/arm64.

Fixes: open-policy-agent#6703

Signed-off-by: Ashutosh Narkar <anarkar4387@gmail.com>
@ashutosh-narkar
Copy link
Member

This PR should address it.

ashutosh-narkar added a commit to ashutosh-narkar/opa that referenced this issue Apr 22, 2024
This change updates the WASM Rego test generation docker
command to address CVE-2022-24765 in Git which could cause
it to execute arbitrary commands.

The error was seen when running the `make wasm-rego-test` target on
darwin/arm64.

Fixes: open-policy-agent#6703

Signed-off-by: Ashutosh Narkar <anarkar4387@gmail.com>
johanfylling pushed a commit that referenced this issue Apr 23, 2024
This change updates the WASM Rego test generation docker
command to address CVE-2022-24765 in Git which could cause
it to execute arbitrary commands.

The error was seen when running the `make wasm-rego-test` target on
darwin/arm64.

Fixes: #6703

Signed-off-by: Ashutosh Narkar <anarkar4387@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants