Closed samarth-aws closed 4 weeks ago
I see that it moves all testdata files into their respective packages, but then backtrace_test now needs to be in the taint package. That doesn't seem to be optimal to me?
I see that it moves all testdata files into their respective packages, but then backtrace_test now needs to be in the taint package. That doesn't seem to be optimal to me?
It's not ideal but the embed
package only supports embedding files in the same directory which is why I couldn't keep the existing testdata/src/<package>
style. We could maybe have makefile rules (e.g. make taint-test
) to run the tests in the taint
package excluding the backtrace tests?
An alternative is to copy over the taint/testdata
directory to the backtrace directory, but that also seems sub-optimal to me.
@amzn-jasonrk do you have an opinion on this? I was hoping the change to embedding would not change the testing files structures that is clearly separate from the source code (and makes working with complex tests in an IDE easier).
Is this the only way to fix the flaky tests? It seems like there is something deeper that we should fix, especially if this is only happening on one machine. Have we confirmed the root cause analysis of the bug?
Is this the only way to fix the flaky tests? It seems like there is something deeper that we should fix, especially if this is only happening on one machine. Have we confirmed the root cause analysis of the bug?
I wouldn't say the tests are "flaky" since they fail consistently in Terminal.app but pass consistently in the GoLand terminal. I found the root cause of the issue: https://github.com/awslabs/ar-go-tools/issues/67
I still would like to merge this PR since doing file I/O in tests isn't great in general.
Description of changes: Tests for the different analyses perform I/O to read from files which can cause errors and prevent the tests from running in parallel.
This PR avoids performing I/O in tests by embedding the test files into the test binaries via the
embed
package.Notable changes:
embed
package.taint_test
packageanalysistest.LoadTest
to use thefs.FS
interface instead of performing file I/O directlygo.mod
files from all the test directories because these files cannot be embedded via theembed
packageBy submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.