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

testing: fix import cycle in paginator test #15120

Closed
wants to merge 1 commit into from
Closed

Conversation

tgross
Copy link
Member

@tgross tgross commented Nov 3, 2022

The benchmark in the paginator test somehow includes reference cycle that hasn't been previously detected in CI. Move this up into the nomad/state package.

@shoenig I think this implies that the check that we're running all our tests isn't working correctly for some of the nested packages?

The benchmark in the paginator test somehow includes reference cycle that hasn't
been previously detected in CI. Move this up into the `nomad/state` package.
@shoenig
Copy link
Member

shoenig commented Nov 3, 2022

@tgross I'm not able to reproduce an import cycle on main. Do you have some other changes or a go.work file doing things?

➜ git rev-parse HEAD
85f472189a2ebe4a96480a728c53c91df830ecad

nomad/state/paginator on main
➜ go test
PASS
ok      github.com/hashicorp/nomad/nomad/state/paginator        0.009s
➜ go test -bench=.
goos: linux
goarch: amd64
pkg: github.com/hashicorp/nomad/nomad/state/paginator
cpu: AMD Ryzen 5 PRO 5650G with Radeon Graphics
BenchmarkEvalListFilter/filter_with_index-12                 416           2794013 ns/op
BenchmarkEvalListFilter/filter_with_go-bexpr-12                8         140127661 ns/op
BenchmarkEvalListFilter/paginated_filter_with_index-12            177604              7179 ns/op
BenchmarkEvalListFilter/paginated_filter_with_go-bexpr-12           6981            170749 ns/op
BenchmarkEvalListFilter/paginated_filter_with_index_last_page-12                    1333            855848 ns/op
BenchmarkEvalListFilter/paginated_filter_with_go-bexpr_last_page-12                 6829            167608 ns/op
PASS
ok      github.com/hashicorp/nomad/nomad/state/paginator        86.463s

@shoenig
Copy link
Member

shoenig commented Nov 3, 2022

And we should have CI coverage over these,

➜ cat ci/test-core.json | jq -r .quick[] | grep nomad/state
nomad/state/...

@tgross
Copy link
Member Author

tgross commented Nov 3, 2022

Very weird... I could have sworn I was running that against main. But I can't repro on main either, only from branches cut from the branch I have for #15117, which I now see is failing for the same reason:

$ git checkout eval-safe-delete-filter
Switched to branch 'eval-safe-delete-filter'

$ go test -v -count=1 ./nomad/state/paginator
# github.com/hashicorp/nomad/nomad/state/paginator
package github.com/hashicorp/nomad/nomad/state/paginator
        imports github.com/hashicorp/nomad/nomad/state: import cycle not allowed in test
FAIL    github.com/hashicorp/nomad/nomad/state/paginator [setup failed]
FAIL

@github-actions
Copy link

github-actions bot commented Mar 4, 2023

I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 4, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
theme/testing Test related issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants