-
Notifications
You must be signed in to change notification settings - Fork 116
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
Test transaction from extension with appsignal_transaction_to_json
#252
Labels
Comments
|
Merged
Closed
tombruijn
changed the title
Test transaction from extension with
⌨️ Test transaction from extension with Oct 27, 2017
appsignal_transaction_to_json
appsignal_transaction_to_json
Merged
tombruijn
changed the title
⌨️ Test transaction from extension with
Test transaction from extension with May 30, 2018
appsignal_transaction_to_json
appsignal_transaction_to_json
While performing the daily checks some issues were found with this issue.
|
tombruijn
added a commit
that referenced
this issue
Feb 4, 2022
Something changed in the rspec-mocks gem between versions 3.10.2 and 3.10.3, because that's what causes tests to fail like this on Ruby 3.1.0 and 3.0.3 locally and on the CI: ``` Failure/Error: monitor_transaction(name, env, &block) Appsignal received :monitor_transaction with unexpected arguments expected: ("perform_job.something", {:key=>:value}) got: ("perform_job.something", {:key=>:value}) Diff: ``` In this example the arguments are exactly the same, except they're not the identical objects. This particular issue seems to be caused by a recent change that for Ruby 3 keyword argument matching: rspec/rspec-mocks#1460 ## Rewriting specs What helps is rewriting the tests to not mock method calls and check the arguments given. Instead, assert what's being stored on the transactions, like how we want all tests to be written as described in issue #252. ## Adding curly brackets For other specs that are a little more difficult to rewrite this way right now, I've chosen to add additional curly brackets around the argument expectations so that it's clear to Ruby/RSpec it's a hash argument and not keywords arguments. To solve this more permanently, we should rewrite the specs at some point. We can remove these curly brackets if the issue is fixed in a future rspec-mocks version as well. [skip changeset]
tombruijn
added a commit
that referenced
this issue
Feb 7, 2022
Something changed in the rspec-mocks gem between versions 3.10.2 and 3.10.3, because that's what causes tests to fail like this on Ruby 3.1.0 and 3.0.3 locally and on the CI: ``` Failure/Error: monitor_transaction(name, env, &block) Appsignal received :monitor_transaction with unexpected arguments expected: ("perform_job.something", {:key=>:value}) got: ("perform_job.something", {:key=>:value}) Diff: ``` In this example the arguments are exactly the same, except they're not the identical objects. This particular issue seems to be caused by a recent change that for Ruby 3 keyword argument matching: rspec/rspec-mocks#1460 ## Rewriting specs What helps is rewriting the tests to not mock method calls and check the arguments given. Instead, assert what's being stored on the transactions, like how we want all tests to be written as described in issue #252. ## Adding curly brackets For other specs that are a little more difficult to rewrite this way right now, I've chosen to add additional curly brackets around the argument expectations so that it's clear to Ruby/RSpec it's a hash argument and not keywords arguments. To solve this more permanently, we should rewrite the specs at some point. We can remove these curly brackets if the issue is fixed in a future rspec-mocks version as well. [skip changeset]
tombruijn
added a commit
that referenced
this issue
Aug 2, 2022
Instead of asserting method calls, test what is actually set on the extension. This also test it in more detail by asserting the actual values that are set, rather than if a certain method is called with what we hope is the expected value. Part of #252.
tombruijn
added a commit
that referenced
this issue
Jun 24, 2024
Don't assert method calls but check what the extension receives for transaction data. Part of #252 [skip changeset]
tombruijn
added a commit
that referenced
this issue
Jul 1, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
appsignal_transaction_to_json
in the Gem's C-extension Implement Transaction#to_json #291complete
callSee: https://github.com/appsignal/appsignal-agent/pull/228
The text was updated successfully, but these errors were encountered: