Closed jac18281828 closed 1 month ago
expect_test
captures a snapshot of something, and checks against that snapshot for changes. This particular one is just supposed to check that the correct instructions are produced given some compiled and inner instructions to parse into bonsol instructions through a filter for some program key.
The error you are experiencing here is some non-determinism or impurity in producing account pubkey for those instructions. In a pure function, the same input will always produce the same output. The test here is the standard for ensuring that a parser is functionally correct and to prevent against regressions.
The problem was using Pubkey::new_unique()
. We aren't testing anything that would need to generate unique keys here so setting it to a static key solves it.
new program generated every time, but expect is constant. How does that work?
Seems like the build can still fail: