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

build: bump golang 1.19.4 -> 1.19.5 #5557

Merged
merged 1 commit into from
Jan 23, 2023
Merged

build: bump golang 1.19.4 -> 1.19.5 #5557

merged 1 commit into from
Jan 23, 2023

Conversation

yanggangtony
Copy link
Contributor

Signed-off-by: yanggang gang.yang@daocloud.io

release go1.19.5)

go1.19.5 (released 2023-01-10) includes fixes to the compiler, the linker, and the crypto/x509, net/http, sync/atomic, and syscall packages. See the [Go 1.19.5 milestone](https://github.com/golang/go/issues?q=milestone%3AGo1.19.5+label%3ACherryPickApproved) on our issue tracker for details.

@yanggangtony
Copy link
Contributor Author

docker: Error response from daemon: manifest for golang:1.19.5 not found: manifest unknown: manifest unknown.

Oh, Might have to wait a few hours for the DockerHub base image for golang to be updated to 1.19.5
😀😀

@yanggangtony
Copy link
Contributor Author

yanggangtony commented Jan 12, 2023

rebased now.
the golang 1.19.5 image is ok.

but there is another err in ci:

2023/01/12 02:22:15 http: TLS handshake error from 127.0.0.1:59595: remote error: tls: bad certificate
--- FAIL: TestHTTPGetRequestTlsInsecureSkipVerify (0.05s)
    --- FAIL: TestHTTPGetRequestTlsInsecureSkipVerify/http.send (0.03s)
        http_test.go:[153](https://github.com/open-policy-agent/opa/actions/runs/3898497838/jobs/6657296505#step:6:154): Expected error 'x509: “Acme Co” certificate is not trusted' but got: 'http.send({"method": "get", "url": "https://127.0.0.1:59594/", "force_json_decode": true}, x): eval_builtin_error: http.send: Get "https://127.0.0.1:59594/": x509: certificate signed by unknown authority'

shows [Go Test (darwin)] ci error ..

Is there any hint from the pr in helm, helm Fixing x509 test on darwin

@srenatus
Copy link
Contributor

Looks like a test we need to update. I'm not sure which of these changes in 1.19.5 is the culprit, maybe golang/go#57427? 🤔

@yanggangtony
Copy link
Contributor Author

yanggangtony commented Jan 12, 2023

I test it in my local mac pro.
Shows the err,


=== RUN   TestHTTPGetRequestTlsInsecureSkipVerify/http.send#01
    http_test.go:153: Unexpected error: json.remove(resp, ["headers/date"]): eval_internal_error: unsupported built-in
--
    http_test.go:153: Unexpected error: json.remove(resp, ["headers/date"]): eval_internal_error: unsupported built-in
=== RUN   TestHTTPGetRequestTlsInsecureSkipVerify/http.send#02
    http_test.go:153: Unexpected error: json.remove(resp, ["headers/date"]): eval_internal_error: unsupported built-in
--
    http_test.go:153: Unexpected error: json.remove(resp, ["headers/date"]): eval_internal_error: unsupported built-in

the code source is :

x := clean_headers(resp)

function defined is :

var httpSendHelperRules = []string{
	`clean_headers(resp) = cleaned {
		cleaned = json.remove(resp, ["headers/date"])
	}`,
	`remove_headers(resp) = no_headers {
		no_headers = object.remove(resp, ["headers"])
	}`,
}

@srenatus
thanks for review.
If your have spare time , could you take a look about it?

@srenatus
Copy link
Contributor

Can't fully engage right now, sorry. But your error looks different from the one happening in CI.

@yanggangtony
Copy link
Contributor Author

yanggangtony commented Jan 12, 2023

image

the upper picture show it still the err , change the environment to linux . and go version 1.19.1. But maybe these is another err about the environment . May have no relevance with the '1.19.5' upgrade. . .

OK , I will continue to look it in my spare time..

@ashutosh-narkar
Copy link
Member

It looks like in this run, the TestHTTPGetRequestTlsInsecureSkipVerify test seems to be failing. Are you able to repro it @yanggangtony?

@yanggangtony
Copy link
Contributor Author

yanggangtony commented Jan 12, 2023

Oh.Sorry Maybe i have make someting wrong. .
I can't just execute go test xxx.go , I changed the code , and then execute make test-coverage ,the same with the CI call's function.


yanggang@yanggangdeMacBook-Pro policy-opa % make test-coverage                                    
Docker not installed or not running. Skipping OPA-WASM library build.
CGO_ENABLED=1 GOFLAGS="-buildmode=exe" go generate
CGO_ENABLED=1 GOFLAGS="-buildmode=exe" go test -tags=opa_wasm,slow -coverprofile=coverage.txt -covermode=atomic ./...
?       github.com/open-policy-agent/opa        [no test files]
ok      github.com/open-policy-agent/opa/ast    3.902s  coverage: 89.4% of statements
ok      github.com/open-policy-agent/opa/ast/internal/scanner   0.395s  coverage: 57.8% of statements
?       github.com/open-policy-agent/opa/ast/internal/tokens    [no test files]
ok      github.com/open-policy-agent/opa/ast/location   0.563s  coverage: 59.4% of statements
?       github.com/open-policy-agent/opa/build/generate-cli-docs        [no test files]
?       github.com/open-policy-agent/opa/build/generate-man     [no test files]
ok      github.com/open-policy-agent/opa/bundle 4.811s  coverage: 82.4% of statements
ok      github.com/open-policy-agent/opa/capabilities   1.039s  coverage: [no statements]
ok      github.com/open-policy-agent/opa/cmd    30.882s coverage: 71.5% of statements
?       github.com/open-policy-agent/opa/cmd/internal/exec      [no test files]
ok      github.com/open-policy-agent/opa/compile        1.211s  coverage: 92.7% of statements
ok      github.com/open-policy-agent/opa/config 1.032s  coverage: 82.9% of statements
ok      github.com/open-policy-agent/opa/cover  1.435s  coverage: 91.4% of statements
ok      github.com/open-policy-agent/opa/dependencies   1.769s  coverage: 93.4% of statements
ok      github.com/open-policy-agent/opa/download       33.993s coverage: 80.0% of statements
?       github.com/open-policy-agent/opa/features/tracing       [no test files]
?       github.com/open-policy-agent/opa/features/wasm  [no test files]
ok      github.com/open-policy-agent/opa/format 2.087s  coverage: 95.7% of statements
?       github.com/open-policy-agent/opa/internal/bundle        [no test files]
ok      github.com/open-policy-agent/opa/internal/bundle/inspect        2.325s  coverage: 83.1% of statements
?       github.com/open-policy-agent/opa/internal/cidr/merge    [no test files]
?       github.com/open-policy-agent/opa/internal/cmd/genbuiltinmetadata        [no test files]
?       github.com/open-policy-agent/opa/internal/cmd/genopacapabilities        [no test files]
ok      github.com/open-policy-agent/opa/internal/compiler/wasm 2.339s  coverage: 47.9% of statements
?       github.com/open-policy-agent/opa/internal/compiler/wasm/opa     [no test files]
ok      github.com/open-policy-agent/opa/internal/config        2.324s  coverage: 62.3% of statements
?       github.com/open-policy-agent/opa/internal/debug [no test files]
ok      github.com/open-policy-agent/opa/internal/deepcopy      2.268s  coverage: 100.0% of statements
?       github.com/open-policy-agent/opa/internal/distributedtracing    [no test files]
?       github.com/open-policy-agent/opa/internal/file/archive  [no test files]
ok      github.com/open-policy-agent/opa/internal/file/url      2.336s  coverage: 80.0% of statements
?       github.com/open-policy-agent/opa/internal/future        [no test files]
ok      github.com/open-policy-agent/opa/internal/gojsonschema  2.107s  coverage: 82.3% of statements
?       github.com/open-policy-agent/opa/internal/gqlparser     [no test files]
?       github.com/open-policy-agent/opa/internal/gqlparser/ast [no test files]
?       github.com/open-policy-agent/opa/internal/gqlparser/formatter   [no test files]
?       github.com/open-policy-agent/opa/internal/gqlparser/gqlerror    [no test files]
?       github.com/open-policy-agent/opa/internal/gqlparser/lexer       [no test files]
?       github.com/open-policy-agent/opa/internal/gqlparser/parser      [no test files]
?       github.com/open-policy-agent/opa/internal/gqlparser/parser/testrunner   [no test files]
?       github.com/open-policy-agent/opa/internal/gqlparser/validator   [no test files]
?       github.com/open-policy-agent/opa/internal/gqlparser/validator/rules     [no test files]
ok      github.com/open-policy-agent/opa/internal/json/patch    2.320s  coverage: 100.0% of statements
ok      github.com/open-policy-agent/opa/internal/jwx/buffer    1.936s  coverage: 82.9% of statements
?       github.com/open-policy-agent/opa/internal/jwx/jwa       [no test files]
ok      github.com/open-policy-agent/opa/internal/jwx/jwk       2.399s  coverage: 93.1% of statements
ok      github.com/open-policy-agent/opa/internal/jwx/jws       2.999s  coverage: 94.6% of statements
ok      github.com/open-policy-agent/opa/internal/jwx/jws/sign  2.170s  coverage: 30.7% of statements
ok      github.com/open-policy-agent/opa/internal/jwx/jws/verify        2.032s  coverage: 50.7% of statements
ok      github.com/open-policy-agent/opa/internal/lcss  2.324s  coverage: 100.0% of statements
ok      github.com/open-policy-agent/opa/internal/leb128        2.227s  coverage: 60.0% of statements
ok      github.com/open-policy-agent/opa/internal/logging       2.127s  coverage: 69.2% of statements
ok      github.com/open-policy-agent/opa/internal/merge 1.534s  coverage: 96.3% of statements
ok      github.com/open-policy-agent/opa/internal/oracle        1.412s  coverage: 97.8% of statements
ok      github.com/open-policy-agent/opa/internal/planner       1.681s  coverage: 85.7% of statements
ok      github.com/open-policy-agent/opa/internal/presentation  1.548s  coverage: 28.7% of statements
ok      github.com/open-policy-agent/opa/internal/prometheus    1.599s  coverage: 39.0% of statements
?       github.com/open-policy-agent/opa/internal/providers/aws [no test files]
ok      github.com/open-policy-agent/opa/internal/providers/aws/crypto  1.806s  coverage: 47.8% of statements
ok      github.com/open-policy-agent/opa/internal/providers/aws/v4      1.818s  coverage: 26.1% of statements
?       github.com/open-policy-agent/opa/internal/ref   [no test files]
?       github.com/open-policy-agent/opa/internal/rego/opa      [no test files]
ok      github.com/open-policy-agent/opa/internal/report        1.569s  coverage: 92.5% of statements
?       github.com/open-policy-agent/opa/internal/runtime       [no test files]
ok      github.com/open-policy-agent/opa/internal/runtime/init  1.600s  coverage: 82.1% of statements
ok      github.com/open-policy-agent/opa/internal/semver        1.922s  coverage: 91.3% of statements
?       github.com/open-policy-agent/opa/internal/storage/mock  [no test files]
?       github.com/open-policy-agent/opa/internal/strings       [no test files]
ok      github.com/open-policy-agent/opa/internal/strvals       2.015s  coverage: 89.6% of statements
ok      github.com/open-policy-agent/opa/internal/uuid  2.025s  coverage: 85.7% of statements
?       github.com/open-policy-agent/opa/internal/version       [no test files]
?       github.com/open-policy-agent/opa/internal/wasm/constant [no test files]
ok      github.com/open-policy-agent/opa/internal/wasm/encoding 2.096s  coverage: 65.7% of statements
?       github.com/open-policy-agent/opa/internal/wasm/instruction      [no test files]
?       github.com/open-policy-agent/opa/internal/wasm/module   [no test files]
?       github.com/open-policy-agent/opa/internal/wasm/opcode   [no test files]
?       github.com/open-policy-agent/opa/internal/wasm/sdk/examples/basic       [no test files]
?       github.com/open-policy-agent/opa/internal/wasm/sdk/examples/loaders     [no test files]
ok      github.com/open-policy-agent/opa/internal/wasm/sdk/internal/wasm        2.696s  coverage: 55.7% of statements
ok      github.com/open-policy-agent/opa/internal/wasm/sdk/opa  5.740s  coverage: 60.2% of statements
?       github.com/open-policy-agent/opa/internal/wasm/sdk/opa/capabilities     [no test files]
?       github.com/open-policy-agent/opa/internal/wasm/sdk/opa/errors   [no test files]
?       github.com/open-policy-agent/opa/internal/wasm/sdk/opa/loader   [no test files]
ok      github.com/open-policy-agent/opa/internal/wasm/sdk/opa/loader/file      2.215s  coverage: 73.7% of statements
ok      github.com/open-policy-agent/opa/internal/wasm/sdk/opa/loader/http      2.726s  coverage: 67.2% of statements
?       github.com/open-policy-agent/opa/internal/wasm/types    [no test files]
?       github.com/open-policy-agent/opa/internal/wasm/util     [no test files]
?       github.com/open-policy-agent/opa/ir     [no test files]
ok      github.com/open-policy-agent/opa/ir/encoding    0.392s  coverage: [no statements]
ok      github.com/open-policy-agent/opa/keys   0.486s  coverage: 93.8% of statements
ok      github.com/open-policy-agent/opa/loader 1.598s  coverage: 79.4% of statements
?       github.com/open-policy-agent/opa/loader/filter  [no test files]
ok      github.com/open-policy-agent/opa/logging        2.482s  coverage: 38.6% of statements
?       github.com/open-policy-agent/opa/logging/test   [no test files]
ok      github.com/open-policy-agent/opa/metrics        1.593s  coverage: 36.3% of statements
ok      github.com/open-policy-agent/opa/plugins        0.482s  coverage: 56.5% of statements
ok      github.com/open-policy-agent/opa/plugins/bundle 5.876s  coverage: 89.3% of statements
ok      github.com/open-policy-agent/opa/plugins/discovery      0.636s  coverage: 84.7% of statements
ok      github.com/open-policy-agent/opa/plugins/logs   14.180s coverage: 85.8% of statements
ok      github.com/open-policy-agent/opa/plugins/rest   14.601s coverage: 81.6% of statements
ok      github.com/open-policy-agent/opa/plugins/status 1.526s  coverage: 76.6% of statements
ok      github.com/open-policy-agent/opa/profiler       0.816s  coverage: 80.4% of statements
ok      github.com/open-policy-agent/opa/refactor       1.089s  coverage: 94.9% of statements
ok      github.com/open-policy-agent/opa/rego   10.406s coverage: 76.3% of statements
ok      github.com/open-policy-agent/opa/repl   1.057s  coverage: 78.5% of statements
?       github.com/open-policy-agent/opa/resolver       [no test files]
?       github.com/open-policy-agent/opa/resolver/wasm  [no test files]
ok      github.com/open-policy-agent/opa/runtime        1.213s  coverage: 70.0% of statements
ok      github.com/open-policy-agent/opa/sdk    0.918s  coverage: 86.9% of statements
?       github.com/open-policy-agent/opa/sdk/test       [no test files]
ok      github.com/open-policy-agent/opa/server 6.202s  coverage: 74.4% of statements
ok      github.com/open-policy-agent/opa/server/authorizer      0.494s  coverage: 93.9% of statements
ok      github.com/open-policy-agent/opa/server/identifier      0.444s  coverage: 100.0% of statements
?       github.com/open-policy-agent/opa/server/types   [no test files]
?       github.com/open-policy-agent/opa/server/writer  [no test files]
ok      github.com/open-policy-agent/opa/storage        0.500s  coverage: 51.3% of statements
ok      github.com/open-policy-agent/opa/storage/disk   30.460s coverage: 78.3% of statements
ok      github.com/open-policy-agent/opa/storage/inmem  0.698s  coverage: 84.4% of statements
?       github.com/open-policy-agent/opa/storage/inmem/test     [no test files]
?       github.com/open-policy-agent/opa/storage/internal/errors        [no test files]
?       github.com/open-policy-agent/opa/storage/internal/ptr   [no test files]
ok      github.com/open-policy-agent/opa/test/authz     0.781s  coverage: 80.0% of statements
?       github.com/open-policy-agent/opa/test/cases     [no test files]
?       github.com/open-policy-agent/opa/test/e2e       [no test files]
ok      github.com/open-policy-agent/opa/test/e2e/authz 1.211s  coverage: 100.0% of statements [no tests to run]
ok      github.com/open-policy-agent/opa/test/e2e/certrefresh   2.324s  coverage: [no statements]
ok      github.com/open-policy-agent/opa/test/e2e/concurrency   11.330s coverage: [no statements]
ok      github.com/open-policy-agent/opa/test/e2e/diagnostics   2.283s  coverage: [no statements]
ok      github.com/open-policy-agent/opa/test/e2e/distributedtracing    2.397s  coverage: [no statements]
ok      github.com/open-policy-agent/opa/test/e2e/h2c   3.600s  coverage: [no statements]
ok      github.com/open-policy-agent/opa/test/e2e/http  4.377s  coverage: [no statements]
?       github.com/open-policy-agent/opa/test/e2e/logs  [no test files]
ok      github.com/open-policy-agent/opa/test/e2e/logs/console  1.246s  coverage: [no statements]
ok      github.com/open-policy-agent/opa/test/e2e/metrics       1.315s  coverage: [no statements]
ok      github.com/open-policy-agent/opa/test/e2e/oci   7.510s  coverage: [no statements]
ok      github.com/open-policy-agent/opa/test/e2e/print 1.187s  coverage: [no statements]
ok      github.com/open-policy-agent/opa/test/e2e/shutdown      3.613s  coverage: [no statements]
ok      github.com/open-policy-agent/opa/test/e2e/tls   2.992s  coverage: [no statements]
ok      github.com/open-policy-agent/opa/test/e2e/wasm/authz    2.777s  coverage: 100.0% of statements [no tests to run]
ok      github.com/open-policy-agent/opa/test/scheduler 1.253s  coverage: [no statements]
?       github.com/open-policy-agent/opa/test/wasm/cmd/wasm-rego-testgen        [no test files]
ok      github.com/open-policy-agent/opa/tester 60.651s coverage: 75.2% of statements
ok      github.com/open-policy-agent/opa/topdown        31.121s coverage: 87.9% of statements
?       github.com/open-policy-agent/opa/topdown/builtins       [no test files]
ok      github.com/open-policy-agent/opa/topdown/cache  2.318s  coverage: 98.3% of statements
ok      github.com/open-policy-agent/opa/topdown/copypropagation        1.401s  coverage: 13.2% of statements
ok      github.com/open-policy-agent/opa/topdown/lineage        1.505s  coverage: 73.1% of statements
?       github.com/open-policy-agent/opa/topdown/print  [no test files]
?       github.com/open-policy-agent/opa/tracing        [no test files]
ok      github.com/open-policy-agent/opa/types  1.487s  coverage: 84.3% of statements
ok      github.com/open-policy-agent/opa/util   1.741s  coverage: 81.8% of statements
?       github.com/open-policy-agent/opa/util/test      [no test files]
?       github.com/open-policy-agent/opa/version        [no test files]
yanggang@yanggangdeMacBook-Pro policy-opa % go version
go version go1.19.5 darwin/amd64
yanggang@yanggangdeMacBook-Pro policy-opa % 

Its fine in local environment.

@yanggangtony
Copy link
Contributor Author

yanggangtony commented Jan 12, 2023

The ci test succeed....

note string
rules []string
expected interface{}
//expectedError error
Copy link
Member

@ashutosh-narkar ashutosh-narkar Jan 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expectedError seems like it wasn't used anyways.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, it is not used.
the go-lint will error if it is not used any place.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, let's remove it then.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, rebase it later.

tests = append(tests, httpsStruct{note: "http.send", rules: []string{fmt.Sprintf(
`p = x { http.send({"method": "get", "url": "%s", "force_json_decode": true, "tls_insecure_skip_verify": true, "tls_use_system_certs": true,}, resp); x := clean_headers(resp) }`, ts.URL)}, expected: resultObj.String()})

if runtime.GOOS == "darwin" {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code is keep the same with before.
but the "darwin" case special proces.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Can you please clarify why the special case is needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

@srenatus srenatus Jan 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's adapt the code so that the previous test still works with macos and 1.19.5. It's OK to adjust the error message (like with fixupDarwinGo118), but this shouldn't be a "no error" vs "some error" case.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I'll have another look tomorrow! 👀

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So something that used to be an error is no longer an error, but only on macos+go1.19.5? That's quite odd. But yeah, let's do something about it -- I'm not too worried because I think few people run OPA as server on macos.

That said, the code here doesn't look right: if runtime.GOOS != "darwin", the fixupDarwinGo118 doesn't make sense in the other branch. 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@srenatus
thanks for spending time to invest it..
So , We skip the macos test?
Delete a test case in 'fixupDarwinGo118'?
Is that ok?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Anything that makes the tests pass 😅

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just skip the macos test fixupDarwinGo118
😅😅

Signed-off-by: yanggang <gang.yang@daocloud.io>
// present.
tests = append(tests, httpsStruct{note: "http.send", rules: []string{fmt.Sprintf(
`p = x { http.send({"method": "get", "url": "%s", "force_json_decode": true, "tls_insecure_skip_verify": true, "tls_use_system_certs": true,}, resp); x := clean_headers(resp) }`, ts.URL)}, expected: resultObj.String()})

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of removing the test case can't we just not use fixupDarwinGo118 ie.

&Error{Message: "x509: certificate signed by unknown authority"}

Will this change cause the test to pass?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But then this would not work with older versions.

@ashutosh-narkar ashutosh-narkar merged commit 45e3a62 into open-policy-agent:main Jan 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants