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

Misc cleanups #3065

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

Conversation

stephenfin
Copy link
Contributor

A couple of somewhat generally "CI-related" changes that I'm too lazy to propose as separate PRs.

  • make: Add 'format' target
  • trivial: Consistent file extensions
  • script: Address shellcheck warnings
  • script: Combine 'coverage', 'unittest'
  • tests: Consist use of th alias
  • tests: Add AssertTypeOf helper
  • testing: Set test case names

@github-actions github-actions bot added the semver:minor Backwards-compatible change label May 31, 2024
@github-actions github-actions bot added semver:minor Backwards-compatible change and removed semver:minor Backwards-compatible change labels May 31, 2024
t.Helper()

if reflect.TypeOf(expected) != reflect.TypeOf(actual) {
logFatal(t, fmt.Sprintf("expected %s but got %s", green(expected), yellow(actual)))
Copy link
Contributor

Choose a reason for hiding this comment

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

don't you want to apply the same \033[1;31m formatting as below?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is derived from AssertEquals, not AssertDeepEquals so maybe, but I should probably fix AssertEquals also?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe one for a follow-up PR?

Copy link
Contributor

Choose a reason for hiding this comment

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

OK

@stephenfin
Copy link
Contributor Author

I'm not sure what's going on with the unit test failures. They're not reproducible locally.

@EmilienM
Copy link
Contributor

EmilienM commented Jun 7, 2024

I'm not sure what's going on with the unit test failures. They're not reproducible locally.

2024-05-31T12:30:50.2424888Z --- FAIL: TestCreate (0.00s)
2024-05-31T12:30:50.2425466Z === RUN   TestCreateMicroversion
2024-05-31T12:30:50.2426450Z --- PASS: TestCreateMicroversion (0.00s)
2024-05-31T12:30:50.2427073Z === RUN   TestGet
2024-05-31T12:30:50.2428913Z     convenience.go:273: �[1;31mFailure in requests_test.go, line 75: at .Policy expected �[0m�[1;32m"anti-affinity"�[0m�[1;31m, but got �[0m�[1;33m<nil>�[0m�[1;31m�[0m
2024-05-31T12:30:50.2431956Z     convenience.go:273: �[1;31mFailure in requests_test.go, line 75: at .Rules expected �[0m�[1;32mservergroups.Rules{MaxServerPerHost:3}�[0m�[1;31m, but got �[0m�[1;33m<nil>�[0m�[1;31m�[0m
2024-05-31T12:30:50.2433622Z --- FAIL: TestGet (0.00s)
2024-05-31T12:30:50.2434126Z === RUN   TestGetMicroversion
2024-05-31T12:30:50.2434775Z --- PASS: TestGetMicroversion (0.00s)
2024-05-31T12:30:50.2435335Z === RUN   TestDelete
2024-05-31T12:30:50.2435846Z --- PASS: TestDelete (0.00s)
2024-05-31T12:30:50.2436595Z === RUN   TestList
2024-05-31T12:30:50.2437088Z --- PASS: TestList (0.00s)
2024-05-31T12:30:50.2437549Z === RUN   TestCreate
2024-05-31T12:30:50.2439414Z     convenience.go:273: �[1;31mFailure in requests_test.go, line 41: at .Policy expected �[0m�[1;32m"anti-affinity"�[0m�[1;31m, but got �[0m�[1;33m<nil>�[0m�[1;31m�[0m
2024-05-31T12:30:50.2442508Z     convenience.go:273: �[1;31mFailure in requests_test.go, line 41: at .Rules expected �[0m�[1;32mservergroups.Rules{MaxServerPerHost:3}�[0m�[1;31m, but got �[0m�[1;33m<nil>�[0m�[1;31m�[0m
2024-05-31T12:30:50.2444211Z --- FAIL: TestCreate (0.00s)
2024-05-31T12:30:50.2444734Z === RUN   TestCreateMicroversion
2024-05-31T12:30:50.2445387Z --- PASS: TestCreateMicroversion (0.00s)
2024-05-31T12:30:50.2445959Z === RUN   TestGet
2024-05-31T12:30:50.2447728Z     convenience.go:273: �[1;31mFailure in requests_test.go, line 75: at .Policy expected �[0m�[1;32m"anti-affinity"�[0m�[1;31m, but got �[0m�[1;33m<nil>�[0m�[1;31m�[0m
2024-05-31T12:30:50.2451070Z     convenience.go:273: �[1;31mFailure in requests_test.go, line 75: at .Rules expected �[0m�[1;32mservergroups.Rules{MaxServerPerHost:3}�[0m�[1;31m, but got �[0m�[1;33m<nil>�[0m�[1;31m�[0m
2024-05-31T12:30:50.2452748Z --- FAIL: TestGet (0.00s)
2024-05-31T12:30:50.2453245Z === RUN   TestGetMicroversion
2024-05-31T12:30:50.2453851Z --- PASS: TestGetMicroversion (0.00s)
2024-05-31T12:30:50.2454383Z === RUN   TestDelete
2024-05-31T12:30:50.2454893Z --- PASS: TestDelete (0.00s)
2024-05-31T12:30:50.2455394Z === RUN   TestList
2024-05-31T12:30:50.2455899Z --- PASS: TestList (0.00s)
2024-05-31T12:30:50.2456381Z === RUN   TestCreate
2024-05-31T12:30:50.2458222Z     convenience.go:273: �[1;31mFailure in requests_test.go, line 41: at .Policy expected �[0m�[1;32m"anti-affinity"�[0m�[1;31m, but got �[0m�[1;33m<nil>�[0m�[1;31m�[0m
2024-05-31T12:30:50.2461328Z     convenience.go:273: �[1;31mFailure in requests_test.go, line 41: at .Rules expected �[0m�[1;32mservergroups.Rules{MaxServerPerHost:3}�[0m�[1;31m, but got �[0m�[1;33m<nil>�[0m�[1;31m�[0m
2024-05-31T12:30:50.2463049Z --- FAIL: TestCreate (0.00s)
2024-05-31T12:30:50.2463585Z === RUN   TestCreateMicroversion
2024-05-31T12:30:50.2464250Z --- PASS: TestCreateMicroversion (0.00s)
2024-05-31T12:30:50.2464809Z === RUN   TestGet
2024-05-31T12:30:50.2466823Z     convenience.go:273: �[1;31mFailure in requests_test.go, line 75: at .Policy expected �[0m�[1;32m"anti-affinity"�[0m�[1;31m, but got �[0m�[1;33m<nil>�[0m�[1;31m�[0m
2024-05-31T12:30:50.2469935Z     convenience.go:273: �[1;31mFailure in requests_test.go, line 75: at .Rules expected �[0m�[1;32mservergroups.Rules{MaxServerPerHost:3}�[0m�[1;31m, but got �[0m�[1;33m<nil>�[0m�[1;31m�[0m
2024-05-31T12:30:50.2471624Z --- FAIL: TestGet (0.00s)
2024-05-31T12:30:50.2472153Z === RUN   TestGetMicroversion
2024-05-31T12:30:50.2472803Z --- PASS: TestGetMicroversion (0.00s)
2024-05-31T12:30:50.2473385Z === RUN   TestDelete
2024-05-31T12:30:50.2473904Z --- PASS: TestDelete (0.00s)
2024-05-31T12:30:50.2474380Z === RUN   TestList
2024-05-31T12:30:50.2474868Z --- PASS: TestList (0.00s)
2024-05-31T12:30:50.2475341Z === RUN   TestCreate
2024-05-31T12:30:50.2477176Z     convenience.go:273: �[1;31mFailure in requests_test.go, line 41: at .Policy expected �[0m�[1;32m"anti-affinity"�[0m�[1;31m, but got �[0m�[1;33m<nil>�[0m�[1;31m�[0m
2024-05-31T12:30:50.2480185Z     convenience.go:273: �[1;31mFailure in requests_test.go, line 41: at .Rules expected �[0m�[1;32mservergroups.Rules{MaxServerPerHost:3}�[0m�[1;31m, but got �[0m�[1;33m<nil>�[0m�[1;31m�[0m
2024-05-31T12:30:50.2481826Z --- FAIL: TestCreate (0.00s)
2024-05-31T12:30:50.2482373Z === RUN   TestCreateMicroversion
2024-05-31T12:30:50.2483035Z --- PASS: TestCreateMicroversion (0.00s)
2024-05-31T12:30:50.2483612Z === RUN   TestGet
2024-05-31T12:30:50.2485423Z     convenience.go:273: �[1;31mFailure in requests_test.go, line 75: at .Policy expected �[0m�[1;32m"anti-affinity"�[0m�[1;31m, but got �[0m�[1;33m<nil>�[0m�[1;31m�[0m
2024-05-31T12:30:50.2488766Z     convenience.go:273: �[1;31mFailure in requests_test.go, line 75: at .Rules expected �[0m�[1;32mservergroups.Rules{MaxServerPerHost:3}�[0m�[1;31m, but got �[0m�[1;33m<nil>�[0m�[1;31m�[0m
2024-05-31T12:30:50.2490504Z --- FAIL: TestGet (0.00s)
2024-05-31T12:30:50.2491016Z === RUN   TestGetMicroversion
2024-05-31T12:30:50.2491639Z --- PASS: TestGetMicroversion (0.00s)
2024-05-31T12:30:50.2492214Z === RUN   TestDelete
2024-05-31T12:30:50.2492734Z --- PASS: TestDelete (0.00s)
2024-05-31T12:30:50.2493194Z FAIL
2024-05-31T12:30:50.2494071Z FAIL	github.com/gophercloud/gophercloud/v2/openstack/compute/v2/servergroups/testing	0.046s
2024-05-31T12:30:50.5664618Z ?   	github.com/gophercloud/gophercloud/v2/openstack/compute/v2/usage	[no test files]
2024-05-31T12:30:51.2404607Z ?   	github.com/gophercloud/gophercloud/v2/openstack/compute/v2/volumeattach	[no test files]
2024-05-31T12:30:51.6588384Z ?   	github.com/gophercloud/gophercloud/v2/openstack/config	[no test files]

@EmilienM
Copy link
Contributor

EmilienM commented Jun 7, 2024

failed locally for me

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Run all unit tests 5 times and produce coverage in one fell swoop.

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
testhelper is too long give how often these things are used.

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Better errors messages since we see the different types.

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Make this a little easier to understand failures when they occur.

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
@github-actions github-actions bot added semver:minor Backwards-compatible change and removed semver:minor Backwards-compatible change labels Jul 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver:minor Backwards-compatible change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants