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

Apply the "safe bool" idiom to ConfigureQueueStatus #350

Open
hallfox opened this issue Jul 5, 2024 · 3 comments
Open

Apply the "safe bool" idiom to ConfigureQueueStatus #350

hallfox opened this issue Jul 5, 2024 · 3 comments
Assignees
Labels
A-Client Area: C++ SDK bug Something isn't working

Comments

@hallfox
Copy link
Collaborator

hallfox commented Jul 5, 2024

The implicit operator bool conversion is not particularly safe, we prefer the unspecified bool type to help prevent implicit conversions to integral types. We do this for CloseQueueStatus, but we seemed to have missed it for this class.

@hallfox hallfox added bug Something isn't working A-Client Area: C++ SDK labels Jul 5, 2024
@vinay-deshmukh
Copy link
Collaborator

I've started work on this one ^

@vinay-deshmukh vinay-deshmukh self-assigned this Jan 29, 2025
@vinay-deshmukh
Copy link
Collaborator

@hallfox

A random test I picked, doesn't seem to be working for me.

I think I'm missing something:

After running bin/build-darwin.sh, I did:

make -C build/blazingmq bmqa_message.t

And when I run the .t.tsk, I get the following failures:

Am I supposed to run the bmqtool / broker in a separate shell so these tests "pass" ?

❯ build/blazingmq/src/groups/bmq/bmqa_message.t.tsk
TEST /Users/vinay/coding/blazingmq/src/groups/bmq/bmqa/bmqa_message.t.cpp CASE 0
Error /Users/vinay/coding/blazingmq/src/groups/bmq/bmqa/bmqa_message.cpp(240): isInitialized()    (failed)
Error /Users/vinay/coding/blazingmq/src/groups/bmq/bmqa/bmqa_message.cpp(263): isInitialized()    (failed)
Error /Users/vinay/coding/blazingmq/src/groups/bmq/bmqa/bmqa_message.cpp(317): isInitialized()    (failed)
Error /Users/vinay/coding/blazingmq/src/groups/bmq/bmqa/bmqa_message.cpp(384): isInitialized() && "message is invalid: use " "'MessageEventBuilder::startMessage' to get one"    (failed)
Error /Users/vinay/coding/blazingmq/src/groups/bmq/bmqa/bmqa_message.cpp(394): isInitialized()    (failed)
Error /Users/vinay/coding/blazingmq/src/groups/bmq/bmqa/bmqa_message.cpp(431): isInitialized()    (failed)
Error /Users/vinay/coding/blazingmq/src/groups/bmq/bmqa/bmqa_message.cpp(453): isInitialized()    (failed)
Error /Users/vinay/coding/blazingmq/src/groups/bmq/bmqa/bmqa_message.cpp(240): isInitialized()    (failed)
Error /Users/vinay/coding/blazingmq/src/groups/bmq/bmqa/bmqa_message.cpp(263): isInitialized()    (failed)
Error /Users/vinay/coding/blazingmq/src/groups/bmq/bmqa/bmqa_message.cpp(317): isInitialized()    (failed)
Error /Users/vinay/coding/blazingmq/src/groups/bmq/bmqa/bmqa_message.cpp(384): isInitialized() && "message is invalid: use " "'MessageEventBuilder::startMessage' to get one"    (failed)
Error /Users/vinay/coding/blazingmq/src/groups/bmq/bmqa/bmqa_message.cpp(394): isInitialized()    (failed)
Error /Users/vinay/coding/blazingmq/src/groups/bmq/bmqa/bmqa_message.cpp(431): isInitialized()    (failed)
Error /Users/vinay/coding/blazingmq/src/groups/bmq/bmqa/bmqa_message.cpp(453): isInitialized()    (failed)

@hallfox
Copy link
Collaborator Author

hallfox commented Jan 29, 2025

All the .t targets are unit tests that don't require the broker to run. To run specific tests, please use

ctest --test-dir <path/to/build/dir> -R bmqa_message.t

BlazingMQ tests are passed to a helper script to run BDE-style tests correctly. As invoked, the test case being run is specifically checking for errors from using bmqa::Message incorrectly, so it will look like the test is failing when it's actually succeeding (echo $? should print 0.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Client Area: C++ SDK bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants