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

suite: TestSubtestPanic is failing #1501

Closed
dolmen opened this issue Nov 1, 2023 · 6 comments
Closed

suite: TestSubtestPanic is failing #1501

dolmen opened this issue Nov 1, 2023 · 6 comments

Comments

@dolmen
Copy link
Collaborator

dolmen commented Nov 1, 2023

$ git log -1 --oneline --no-abbrev-commit          
331c520966e81450aef3b50956ea4a5db5e0ccdf (HEAD -> master, origin/master, origin/HEAD) Improve readability
$ go version
go version go1.21.3 darwin/amd64
$ go test -v -race -run TestSubtestPanic -failfast ./suite
=== RUN   TestSubtestPanic
=== RUN   TestSubtestPanic
=== RUN   TestSubtestPanic/TestSubtestPanic
=== RUN   TestSubtestPanic/TestSubtestPanic/subtest
    suite.go:87: test panicked: panic
        goroutine 35 [running]:
        runtime/debug.Stack()
        	/usr/local/Cellar/go/1.21.3/libexec/src/runtime/debug/stack.go:24 +0x67
        github.com/stretchr/testify/suite.failOnPanic(0xc000103040, {0x1646ec0, 0x176d450})
        	/Users/omengue/go/src/github.com/stretchr/testify/suite/suite.go:87 +0x3a
        github.com/stretchr/testify/suite.recoverAndFailOnPanic(0x913f1f8?)
        	/Users/omengue/go/src/github.com/stretchr/testify/suite/suite.go:82 +0x37
        panic({0x1646ec0?, 0x176d450?})
        	/usr/local/Cellar/go/1.21.3/libexec/src/runtime/panic.go:920 +0x270
        github.com/stretchr/testify/suite.(*subtestPanicSuite).TestSubtestPanic.func1()
        	/Users/omengue/go/src/github.com/stretchr/testify/suite/suite_test.go:673 +0x2b
        github.com/stretchr/testify/suite.(*Suite).Run.func1(0xc000103040)
        	/Users/omengue/go/src/github.com/stretchr/testify/suite/suite.go:113 +0x1fa
        testing.tRunner(0xc000103040, 0xc0001355e0)
        	/usr/local/Cellar/go/1.21.3/libexec/src/testing/testing.go:1595 +0x239
        created by testing.(*T).Run in goroutine 34
        	/usr/local/Cellar/go/1.21.3/libexec/src/testing/testing.go:1648 +0x82b
--- FAIL: TestSubtestPanic (0.01s)
    --- FAIL: TestSubtestPanic/TestSubtestPanic (0.00s)
        --- FAIL: TestSubtestPanic/TestSubtestPanic/subtest (0.00s)
--- PASS: TestSubtestPanic (0.01s)
PASS
ok  	github.com/stretchr/testify/suite	1.348s
@dolmen
Copy link
Collaborator Author

dolmen commented Nov 1, 2023

@linusbarth Could you fix this? I suppose it is related to #1471.

@linusbarth
Copy link
Contributor

linusbarth commented Nov 1, 2023

I'm not sure why your pull request fixes this. But I needed some time to even notice that not the test fails but rather this is just output from an internal test.

If I run the test (go test -v -race -run TestSubtestPanic -failfast ./suite) on the branch from your 1502-PR, I see no difference in output. Is this correct?

Also wouldn't it be better to somehow manipulate/mark/remove the output from the internal tests? (If that's even possible)

dolmen added a commit that referenced this issue Nov 1, 2023
The subtest of TestSubtestPanic is expected to fail, but that must not
make the testuite of package 'suite' to fail. So call Skip to make 'go
test' to ignore that expected failure.
@dolmen
Copy link
Collaborator Author

dolmen commented Nov 1, 2023

@linusbarth #1502 is just a fix for an issue I found thanks to your mistake, but is NOT the fix for 1501. #1503 IS the fix.

@dolmen
Copy link
Collaborator Author

dolmen commented Nov 1, 2023

Well. I think that we need both #1502 and #1503. So I will just rebase #1503 on top of #1502.

@dolmen
Copy link
Collaborator Author

dolmen commented Nov 1, 2023

We have another test failure in suite:

$ go test -run TestSuiteWithStats -failfast -parallel 1 -count=1 ./suite
--- FAIL: WithStats (0.00s)
    --- FAIL: WithStats/TestPanic (0.00s)
        suite.go:87: test panicked: oops
            goroutine 21 [running]:
            runtime/debug.Stack()
            	/usr/local/Cellar/go/1.21.3/libexec/src/runtime/debug/stack.go:24 +0x5e
            github.com/stretchr/testify/suite.failOnPanic(0xc000134340, {0x13ef4a0, 0x14f7f10})
            	/Users/omengue/go/src/github.com/stretchr/testify/suite/suite.go:87 +0x39
            github.com/stretchr/testify/suite.Run.func1.1()
            	/Users/omengue/go/src/github.com/stretchr/testify/suite/suite.go:184 +0x24c
            panic({0x13ef4a0?, 0x14f7f10?})
            	/usr/local/Cellar/go/1.21.3/libexec/src/runtime/panic.go:914 +0x21f
            github.com/stretchr/testify/suite.(*suiteWithStats).TestPanic(0x0?)
            	/Users/omengue/go/src/github.com/stretchr/testify/suite/suite_test.go:549 +0x25
            reflect.Value.call({0xc0000f9e00?, 0xc00009b008?, 0x13?}, {0x146993b, 0x4}, {0xc00004be70, 0x1, 0x1?})
            	/usr/local/Cellar/go/1.21.3/libexec/src/reflect/value.go:596 +0xce7
            reflect.Value.Call({0xc0000f9e00?, 0xc00009b008?, 0x13d1b2f?}, {0xc000036670?, 0x11180cd?, 0x16d2098?})
            	/usr/local/Cellar/go/1.21.3/libexec/src/reflect/value.go:380 +0xb9
            github.com/stretchr/testify/suite.Run.func1(0xc000134340)
            	/Users/omengue/go/src/github.com/stretchr/testify/suite/suite.go:198 +0x467
            testing.tRunner(0xc000134340, 0xc00012e090)
            	/usr/local/Cellar/go/1.21.3/libexec/src/testing/testing.go:1595 +0xff
            created by testing.(*T).Run in goroutine 20
            	/usr/local/Cellar/go/1.21.3/libexec/src/testing/testing.go:1648 +0x3ad
--- FAIL: TestSuiteWithStats (0.00s)
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
	panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x131fd22]

goroutine 19 [running]:
testing.tRunner.func1.2({0x1409f20, 0x17a5c80})
	/usr/local/Cellar/go/1.21.3/libexec/src/testing/testing.go:1545 +0x238
testing.tRunner.func1()
	/usr/local/Cellar/go/1.21.3/libexec/src/testing/testing.go:1548 +0x397
panic({0x1409f20?, 0x17a5c80?})
	/usr/local/Cellar/go/1.21.3/libexec/src/runtime/panic.go:914 +0x21f
github.com/stretchr/testify/suite.TestSuiteWithStats(0x0?)
	/Users/omengue/go/src/github.com/stretchr/testify/suite/suite_test.go:571 +0x242
testing.tRunner(0xc0000831e0, 0x149d878)
	/usr/local/Cellar/go/1.21.3/libexec/src/testing/testing.go:1595 +0xff
created by testing.(*T).Run in goroutine 1
	/usr/local/Cellar/go/1.21.3/libexec/src/testing/testing.go:1648 +0x3ad
FAIL	github.com/stretchr/testify/suite	0.648s
FAIL

@dolmen
Copy link
Collaborator Author

dolmen commented Nov 2, 2023

#1503 didn't work. TestSubtestPanic wasn't the only test to have issues.

#1504 is (hopefully) the real fix: use consistent subtest-like names for subtests when running them via testing.InternalTest and testing.RunTests.

algitbot pushed a commit to alpinelinux/build-server-status that referenced this issue May 6, 2024
This MR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [github.com/stretchr/testify](https://github.com/stretchr/testify) | require | minor | `v1.8.0` -> `v1.9.0` |

---

### Release Notes

<details>
<summary>stretchr/testify (github.com/stretchr/testify)</summary>

### [`v1.9.0`](https://github.com/stretchr/testify/releases/tag/v1.9.0)

[Compare Source](stretchr/testify@v1.8.4...v1.9.0)

#### What's Changed

-   Fix Go modules version by [@&#8203;SuperQ](https://github.com/SuperQ) in stretchr/testify#1394
-   Document that require is not safe to call in created goroutines by [@&#8203;programmer04](https://github.com/programmer04) in stretchr/testify#1392
-   Remove myself from MAINTAINERS.md by [@&#8203;mvdkleijn](https://github.com/mvdkleijn) in stretchr/testify#1367
-   Correct spelling/grammar by [@&#8203;echarrod](https://github.com/echarrod) in stretchr/testify#1389
-   docs: Update URLs in README by [@&#8203;davidjb](https://github.com/davidjb) in stretchr/testify#1349
-   Update mockery link to Github Pages in README by [@&#8203;LandonTClipp](https://github.com/LandonTClipp) in stretchr/testify#1346
-   docs: Fix typos in tests and comments by [@&#8203;alexandear](https://github.com/alexandear) in stretchr/testify#1410
-   CI: tests from go1.17 by [@&#8203;SuperQ](https://github.com/SuperQ) in stretchr/testify#1409
-   Fix adding ? when no values passed by [@&#8203;lesichkovm](https://github.com/lesichkovm) in stretchr/testify#1320
-   codegen: use standard header for generated files by [@&#8203;dolmen](https://github.com/dolmen) in stretchr/testify#1406
-   mock: AssertExpectations log reason only on failure by [@&#8203;hikyaru-suzuki](https://github.com/hikyaru-suzuki) in stretchr/testify#1360
-   assert: fix flaky TestNeverTrue by [@&#8203;dolmen](https://github.com/dolmen) in stretchr/testify#1417
-   README: fix typos "set up" vs "setup" by [@&#8203;ossan-dev](https://github.com/ossan-dev) in stretchr/testify#1428
-   mock: move regexp compilation outside of `Called` by [@&#8203;aud10slave](https://github.com/aud10slave) in stretchr/testify#631
-   assert: refactor internal func getLen() by [@&#8203;dolmen](https://github.com/dolmen) in stretchr/testify#1445
-   mock: deprecate type AnythingOfTypeArgument ([#&#8203;1434](stretchr/testify#1434)) by [@&#8203;dolmen](https://github.com/dolmen) in stretchr/testify#1441
-   Remove no longer needed assert.canConvert by [@&#8203;alexandear](https://github.com/alexandear) in stretchr/testify#1470
-   assert: ObjectsAreEqual: use time.Equal for time.Time types by [@&#8203;tscales](https://github.com/tscales) in stretchr/testify#1464
-   Bump actions/checkout from 3 to 4 by [@&#8203;dependabot](https://github.com/dependabot) in stretchr/testify#1466
-   Bump actions/setup-go from 3.2.0 to 4.1.0 by [@&#8203;dependabot](https://github.com/dependabot) in stretchr/testify#1451
-   fix: make EventuallyWithT concurrency safe by [@&#8203;czeslavo](https://github.com/czeslavo) in stretchr/testify#1395
-   assert: fix httpCode and HTTPBody occur panic when http.Handler read Body by [@&#8203;hidu](https://github.com/hidu) in stretchr/testify#1484
-   assert.EqualExportedValues: fix handling of arrays by [@&#8203;zrbecker](https://github.com/zrbecker) in stretchr/testify#1473
-   .github: use latest Go versions by [@&#8203;kevinburkesegment](https://github.com/kevinburkesegment) in stretchr/testify#1489
-   assert: Deprecate EqualExportedValues by [@&#8203;HaraldNordgren](https://github.com/HaraldNordgren) in stretchr/testify#1488
-   suite: refactor test assertions by [@&#8203;alexandear](https://github.com/alexandear) in stretchr/testify#1474
-   suite: fix SetupSubTest and TearDownSubTest execution order by [@&#8203;linusbarth](https://github.com/linusbarth) in stretchr/testify#1471
-   docs: Fix deprecation comments for http package by [@&#8203;alexandear](https://github.com/alexandear) in stretchr/testify#1335
-   Add map support doc comments to Subset and NotSubset by [@&#8203;jedevc](https://github.com/jedevc) in stretchr/testify#1306
-   TestErrorIs/TestNotErrorIs: check error message contents by [@&#8203;craig65535](https://github.com/craig65535) in stretchr/testify#1435
-   suite: fix subtest names (fix [#&#8203;1501](stretchr/testify#1501)) by [@&#8203;dolmen](https://github.com/dolmen) in stretchr/testify#1504
-   assert: improve unsafe.Pointer tests by [@&#8203;dolmen](https://github.com/dolmen) in stretchr/testify#1505
-   assert: simplify isNil implementation by [@&#8203;dolmen](https://github.com/dolmen) in stretchr/testify#1506
-   assert.InEpsilonSlice: fix expected/actual order and other improvements by [@&#8203;dolmen](https://github.com/dolmen) in stretchr/testify#1483
-   Fix dependency cycle with objx [#&#8203;1292](stretchr/testify#1292) by [@&#8203;dolmen](https://github.com/dolmen) in stretchr/testify#1453
-   mock: refactor TestIsArgsEqual by [@&#8203;dolmen](https://github.com/dolmen) in stretchr/testify#1444
-   mock: optimize argument matching checks by [@&#8203;dolmen](https://github.com/dolmen) in stretchr/testify#1416
-   assert: fix TestEventuallyTimeout by [@&#8203;dolmen](https://github.com/dolmen) in stretchr/testify#1412
-   CI: add go 1.21 in GitHub Actions by [@&#8203;dolmen](https://github.com/dolmen) in stretchr/testify#1450
-   suite: fix recoverAndFailOnPanic to report test failure at the right location by [@&#8203;dolmen](https://github.com/dolmen) in stretchr/testify#1502
-   Update maintainers by [@&#8203;brackendawson](https://github.com/brackendawson) in stretchr/testify#1533
-   assert: Fix EqualValues to handle overflow/underflow by [@&#8203;arjunmahishi](https://github.com/arjunmahishi) in stretchr/testify#1531
-   assert: better formatting for Len() error by [@&#8203;kevinburkesegment](https://github.com/kevinburkesegment) in stretchr/testify#1485
-   Ensure AssertExpectations does not fail in skipped tests by [@&#8203;ianrose14](https://github.com/ianrose14) in stretchr/testify#1331
-   suite: fix deadlock in suite.Require()/Assert() by [@&#8203;arjunmahishi](https://github.com/arjunmahishi) in stretchr/testify#1535
-   Revert "assert: ObjectsAreEqual: use time.Equal for time.Time type" by [@&#8203;brackendawson](https://github.com/brackendawson) in stretchr/testify#1537
-   \[chore] Add issue templates by [@&#8203;arjunmahishi](https://github.com/arjunmahishi) in stretchr/testify#1538
-   Update the build status badge by [@&#8203;brackendawson](https://github.com/brackendawson) in stretchr/testify#1540
-   Update Github workflows setup-go to V5 by [@&#8203;hendrywiranto](https://github.com/hendrywiranto) in stretchr/testify#1545
-   Support Pointer to Struct in EqualExportedValues by [@&#8203;Lucaber](https://github.com/Lucaber) in stretchr/testify#1517
-   README: drop link to gorc by [@&#8203;guettli](https://github.com/guettli) in stretchr/testify#1248
-   http_assertions: honour the msgAndArgs provided with each assertion by [@&#8203;arjunmahishi](https://github.com/arjunmahishi) in stretchr/testify#1548
-   fix typos in comments and tests by [@&#8203;ccoVeille](https://github.com/ccoVeille) in stretchr/testify#1247
-   Include the auto-release notes in releases by [@&#8203;brackendawson](https://github.com/brackendawson) in stretchr/testify#1550
-   Add `NotImplements` and variants by [@&#8203;hslatman](https://github.com/hslatman) in stretchr/testify#1385
-   Add support to compare uintptr by [@&#8203;bogdandrutu](https://github.com/bogdandrutu) in stretchr/testify#1339
-   build(deps): bump github.com/stretchr/objx from 0.5.1 to 0.5.2 by [@&#8203;dependabot](https://github.com/dependabot) in stretchr/testify#1552

#### New Contributors

-   [@&#8203;SuperQ](https://github.com/SuperQ) made their first contribution in stretchr/testify#1394
-   [@&#8203;programmer04](https://github.com/programmer04) made their first contribution in stretchr/testify#1392
-   [@&#8203;echarrod](https://github.com/echarrod) made their first contribution in stretchr/testify#1389
-   [@&#8203;davidjb](https://github.com/davidjb) made their first contribution in stretchr/testify#1349
-   [@&#8203;LandonTClipp](https://github.com/LandonTClipp) made their first contribution in stretchr/testify#1346
-   [@&#8203;alexandear](https://github.com/alexandear) made their first contribution in stretchr/testify#1410
-   [@&#8203;lesichkovm](https://github.com/lesichkovm) made their first contribution in stretchr/testify#1320
-   [@&#8203;dolmen](https://github.com/dolmen) made their first contribution in stretchr/testify#1406
-   [@&#8203;hikyaru-suzuki](https://github.com/hikyaru-suzuki) made their first contribution in stretchr/testify#1360
-   [@&#8203;ossan-dev](https://github.com/ossan-dev) made their first contribution in stretchr/testify#1428
-   [@&#8203;aud10slave](https://github.com/aud10slave) made their first contribution in stretchr/testify#631
-   [@&#8203;tscales](https://github.com/tscales) made their first contribution in stretchr/testify#1464
-   [@&#8203;czeslavo](https://github.com/czeslavo) made their first contribution in stretchr/testify#1395
-   [@&#8203;hidu](https://github.com/hidu) made their first contribution in stretchr/testify#1484
-   [@&#8203;zrbecker](https://github.com/zrbecker) made their first contribution in stretchr/testify#1473
-   [@&#8203;kevinburkesegment](https://github.com/kevinburkesegment) made their first contribution in stretchr/testify#1489
-   [@&#8203;linusbarth](https://github.com/linusbarth) made their first contribution in stretchr/testify#1471
-   [@&#8203;jedevc](https://github.com/jedevc) made their first contribution in stretchr/testify#1306
-   [@&#8203;craig65535](https://github.com/craig65535) made their first contribution in stretchr/testify#1435
-   [@&#8203;arjunmahishi](https://github.com/arjunmahishi) made their first contribution in stretchr/testify#1531
-   [@&#8203;ianrose14](https://github.com/ianrose14) made their first contribution in stretchr/testify#1331
-   [@&#8203;hendrywiranto](https://github.com/hendrywiranto) made their first contribution in stretchr/testify#1545
-   [@&#8203;Lucaber](https://github.com/Lucaber) made their first contribution in stretchr/testify#1517
-   [@&#8203;guettli](https://github.com/guettli) made their first contribution in stretchr/testify#1248
-   [@&#8203;ccoVeille](https://github.com/ccoVeille) made their first contribution in stretchr/testify#1247
-   [@&#8203;hslatman](https://github.com/hslatman) made their first contribution in stretchr/testify#1385
-   [@&#8203;bogdandrutu](https://github.com/bogdandrutu) made their first contribution in stretchr/testify#1339

**Full Changelog**: stretchr/testify@v1.8.4...v1.9.0

### [`v1.8.4`](https://github.com/stretchr/testify/releases/tag/v1.8.4)

[Compare Source](stretchr/testify@v1.8.3...v1.8.4)

#### What's Changed

-   Create GitHub release when new release tag is pushed by [@&#8203;aldas](https://github.com/aldas) in stretchr/testify#1354

#### New Contributors

-   [@&#8203;aldas](https://github.com/aldas) made their first contribution in stretchr/testify#1354

**Full Changelog**: stretchr/testify@v1.8.3...v1.8.4

### [`v1.8.3`](https://github.com/stretchr/testify/releases/tag/v1.8.3)

[Compare Source](stretchr/testify@v1.8.2...v1.8.3)

#### What's Changed

-   Compare public elements of struct by [@&#8203;mchlp](https://github.com/mchlp) in stretchr/testify#1309
-   assert: fix error message formatting for NotContains by [@&#8203;wwade](https://github.com/wwade) in stretchr/testify#1362
-   allow testing for functional options by [@&#8203;nbaztec](https://github.com/nbaztec) in stretchr/testify#1023
-   add EventuallyWithT assertion by [@&#8203;tobikris](https://github.com/tobikris) in stretchr/testify#1264
-   EqualExportedValues: Handle nested pointer, slice and map fields by [@&#8203;HaraldNordgren](https://github.com/HaraldNordgren) in stretchr/testify#1379

#### New Contributors

-   [@&#8203;mchlp](https://github.com/mchlp) made their first contribution in stretchr/testify#1309
-   [@&#8203;wwade](https://github.com/wwade) made their first contribution in stretchr/testify#1362
-   [@&#8203;nbaztec](https://github.com/nbaztec) made their first contribution in stretchr/testify#1023
-   [@&#8203;tobikris](https://github.com/tobikris) made their first contribution in stretchr/testify#1264

**Full Changelog**: stretchr/testify@v1.8.2...v1.8.3

### [`v1.8.2`](https://github.com/stretchr/testify/releases/tag/v1.8.2)

[Compare Source](stretchr/testify@v1.8.1...v1.8.2)

#### What's Changed

-   Add opportunity to trigger setup/teardown for subtest by [@&#8203;qerdcv](https://github.com/qerdcv) in stretchr/testify#1246
-   fix: fix bug for check unsafe.Pointer isNil by [@&#8203;sunpe](https://github.com/sunpe) in stretchr/testify#1319
-   Fix Call.Unset() panic (issue [#&#8203;1236](stretchr/testify#1236)) by [@&#8203;lisitsky](https://github.com/lisitsky) in stretchr/testify#1250
-   Fix `CallerInfo()` source file paths by [@&#8203;bozaro](https://github.com/bozaro) in stretchr/testify#1288
-   assert: Fix Subset/NotSubset when map is missing keys from the subset by [@&#8203;danielwhite](https://github.com/danielwhite) in stretchr/testify#1261

#### New Contributors

-   [@&#8203;qerdcv](https://github.com/qerdcv) made their first contribution in stretchr/testify#1246
-   [@&#8203;sunpe](https://github.com/sunpe) made their first contribution in stretchr/testify#1319
-   [@&#8203;lisitsky](https://github.com/lisitsky) made their first contribution in stretchr/testify#1250
-   [@&#8203;bozaro](https://github.com/bozaro) made their first contribution in stretchr/testify#1288
-   [@&#8203;danielwhite](https://github.com/danielwhite) made their first contribution in stretchr/testify#1261

**Full Changelog**: stretchr/testify@v1.8.1...v1.8.2

### [`v1.8.1`](https://github.com/stretchr/testify/releases/tag/v1.8.1)

[Compare Source](stretchr/testify@v1.8.0...v1.8.1)

#### What's Changed

-   Bump github.com/stretchr/objx from 0.4.0 to 0.5.0 by [@&#8203;dependabot](https://github.com/dependabot) in stretchr/testify#1283

**Full Changelog**: stretchr/testify@v1.8.0...v1.8.1

</details>

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

&nbsp;
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4yODYuMSIsInVwZGF0ZWRJblZlciI6IjM3LjI4Ni4xIiwidGFyZ2V0QnJhbmNoIjoibWFzdGVyIiwibGFiZWxzIjpbXX0=-->

See merge request alpine/infra/build-server-status!12
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

No branches or pull requests

2 participants