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
IT test for long values #713
Conversation
Signed-off-by: tanvigour <tanvi.gour@gmail.com>
Signed-off-by: tanvigour <tanvi.gour@gmail.com>
"messages/testinglongvalues", | ||
null, | ||
HttpExtension.GET, CLOUD_EVENT_LIST_TYPE_REF).block(); | ||
assertEquals(590518626939830271L, messages.get(0).getData()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tanvigour Why do we have to publish N messages and then check only one message ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can check for all values, just added a commit for that
Signed-off-by: tanvigour <tanvi.gour@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
overall lgtm ... if possible test for larger values of long and varied values ....
Signed-off-by: tanvigour <tanvi.gour@gmail.com>
Signed-off-by: tanvigour <tanvi.gour@gmail.com>
Signed-off-by: tanvigour <tanvi.gour@gmail.com>
@tanvigour |
Signed-off-by: tanvigour <tanvi.gour@gmail.com>
Signed-off-by: tanvigour <tanvi.gour@gmail.com>
Signed-off-by: tanvigour <tanvi.gour@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tanvigour Please address these comments.
@@ -413,4 +467,13 @@ public void setId(String id) { | |||
this.id = id; | |||
} | |||
} | |||
|
|||
public static class ConvertToLong { | |||
public Long value; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private
public void setVal(Long value) { | ||
this.value = value; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add getter for value, and equals and Dashcode method (Can autogenerate in IntelliJ using Objects.hash etc ).
} | ||
|
||
ConvertToLong value = new ConvertToLong(); | ||
value.setVal(590518626939830271L); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Create a Random object to generate random values with 590518626939830271L
as seed.
Create a Set HashSet,
Add 590518626939830271L
as the first element.
Add more random long values upto NUM_MESSAGES size.
client.publishEvent( | ||
PUBSUB_NAME, | ||
LONG_TOPIC_NAME, | ||
value, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
create iterator of the set, and send the next element here.
daprRun.getAppName(), | ||
"messages/testinglongvalues", | ||
null, | ||
HttpExtension.GET, CLOUD_EVENT_LIST_TYPE_REF).block(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ADD an new TypeRef
private static final TypeRef<List<CloudEvent<ConvertToLong>>> CLOUD_EVENT_LONG_LIST_TYPE_REF = new TypeRef<>() {};
use that here .
null, | ||
HttpExtension.GET, CLOUD_EVENT_LIST_TYPE_REF).block(); | ||
for (int i = 0; i < NUM_MESSAGES; i++) { | ||
System.out.println("The long value received!!! " +messages.get(i).getData().value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove log.
"messages/testinglongvalues", | ||
null, | ||
HttpExtension.GET, CLOUD_EVENT_LIST_TYPE_REF).block(); | ||
for (int i = 0; i < NUM_MESSAGES; i++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for (int i = 0; i < NUM_MESSAGES; i++) { | |
Assert.assertNotNull(messages); | |
for (int i = 0; i < messages.size(); i++) { |
HttpExtension.GET, CLOUD_EVENT_LIST_TYPE_REF).block(); | ||
for (int i = 0; i < NUM_MESSAGES; i++) { | ||
System.out.println("The long value received!!! " +messages.get(i).getData().value); | ||
assertEquals(590518626939830271L, messages.get(i).getData().value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add it to the actual
ConvertToLong Set created above.
actual.add(message.getData()
assertEquals(590518626939830271L, messages.get(i).getData().value); | ||
} | ||
}, 2000); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add assert comparing two set values
Assert.assertEquals(expected, actual);
Both expected
and actual
are of type Set<ConvertToLong
@@ -402,6 +404,58 @@ public void testPubSubTTLMetadata() throws Exception { | |||
daprRun.stop(); | |||
} | |||
|
|||
@Test | |||
public void testlongValues() throws Exception { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public void testlongValues() throws Exception { | |
public void testLongValues() throws Exception { |
Signed-off-by: tanvigour <tanvi.gour@gmail.com>
Signed-off-by: tanvigour <tanvi.gour@gmail.com>
Tested this locally ... it is working ... with latest master Dapr after contrib 1.7-rc merge
@tanvigour is the test working for you locally ? |
…ue to set Signed-off-by: tanvigour <tanvi.gour@gmail.com>
Signed-off-by: tanvigour <tanvi.gour@gmail.com>
Signed-off-by: tanvigour <tanvi.gour@gmail.com>
Signed-off-by: tanvigour <tanvi.gour@gmail.com>
Signed-off-by: tanvigour <tanvi.gour@gmail.com>
Signed-off-by: tanvigour <tanvi.gour@gmail.com>
Signed-off-by: tanvigour <tanvi.gour@gmail.com>
Signed-off-by: tanvigour <tanvi.gour@gmail.com>
Signed-off-by: tanvigour <tanvi.gour@gmail.com>
Signed-off-by: tanvigour <tanvi.gour@gmail.com>
Codecov Report
@@ Coverage Diff @@
## master #713 +/- ##
=========================================
Coverage 78.19% 78.19%
Complexity 1117 1117
=========================================
Files 97 97
Lines 3417 3417
Branches 399 399
=========================================
Hits 2672 2672
Misses 547 547
Partials 198 198 Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
cc @artursouza
* run IT test for long values Signed-off-by: tanvigour <tanvi.gour@gmail.com> * Fix the class name Signed-off-by: tanvigour <tanvi.gour@gmail.com> * assert for all messages and fix class name Signed-off-by: tanvigour <tanvi.gour@gmail.com> * test for Long.MAX_VALUE Signed-off-by: tanvigour <tanvi.gour@gmail.com> * revert back long number and print Signed-off-by: tanvigour <tanvi.gour@gmail.com> * fix the typo Signed-off-by: tanvigour <tanvi.gour@gmail.com> * update the latest dapr commit in workflow files Signed-off-by: tanvigour <tanvi.gour@gmail.com> * log some more data to debug Signed-off-by: tanvigour <tanvi.gour@gmail.com> * debug Signed-off-by: tanvigour <tanvi.gour@gmail.com> * get the value from messages Signed-off-by: tanvigour <tanvi.gour@gmail.com> * address feedback Signed-off-by: tanvigour <tanvi.gour@gmail.com> * change the assertion Signed-off-by: tanvigour <tanvi.gour@gmail.com> * Add hashcode and equals functione and create new obj while adding value to set Signed-off-by: tanvigour <tanvi.gour@gmail.com> * move iterator Signed-off-by: tanvigour <tanvi.gour@gmail.com> * log value before adding to hashset Signed-off-by: tanvigour <tanvi.gour@gmail.com> * log value before adding to hashset Signed-off-by: tanvigour <tanvi.gour@gmail.com> * log value before adding to hashset Signed-off-by: tanvigour <tanvi.gour@gmail.com> * change assertion Signed-off-by: tanvigour <tanvi.gour@gmail.com> * fix equals method Signed-off-by: tanvigour <tanvi.gour@gmail.com> * adding debugging for expected value Signed-off-by: tanvigour <tanvi.gour@gmail.com> * adding logs for expected value Signed-off-by: tanvigour <tanvi.gour@gmail.com> * log value before adding to hashset Signed-off-by: tanvigour <tanvi.gour@gmail.com> Co-authored-by: Mukundan Sundararajan <65565396+mukundansundar@users.noreply.github.com> Signed-off-by: Artur Souza <artursouza.ms@outlook.com>
Description
Please explain the changes you've made
Issue reference
We strive to have all PR being opened based on an issue, where the problem or feature have been discussed prior to implementation.
Please reference the issue this PR will close: #686
Checklist
Please make sure you've completed the relevant tasks for this PR, out of the following list: