Skip to content

chore: Add unit test for view-generator service#196

Merged
sarthak77 merged 4 commits intomainfrom
sarthak_test
May 24, 2021
Merged

chore: Add unit test for view-generator service#196
sarthak77 merged 4 commits intomainfrom
sarthak_test

Conversation

@sarthak77
Copy link
Copy Markdown
Member

@sarthak77 sarthak77 commented May 21, 2021

Added unit tests for RawTraceViewGenerator.java class

@sarthak77 sarthak77 requested a review from a team May 21, 2021 11:50
@codecov
Copy link
Copy Markdown

codecov Bot commented May 21, 2021

Codecov Report

Merging #196 (78215e6) into main (94b8c05) will increase coverage by 0.59%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff              @@
##               main     #196      +/-   ##
============================================
+ Coverage     78.92%   79.51%   +0.59%     
- Complexity     1128     1133       +5     
============================================
  Files           101      101              
  Lines          4370     4370              
  Branches        406      406              
============================================
+ Hits           3449     3475      +26     
+ Misses          732      704      -28     
- Partials        189      191       +2     
Flag Coverage Δ Complexity Δ
unit 79.51% <ø> (+0.59%) 1133.00 <ø> (+5.00)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ Complexity Δ
...iewgenerator/generators/RawTraceViewGenerator.java 83.87% <0.00%> (+83.87%) 5.00% <0.00%> (+5.00%)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 94b8c05...78215e6. Read the comment docs.

@github-actions

This comment has been minimized.

assertEquals(50,rawTraceViews.get(0).getNumSpans());
// assertEquals(ByteBuffer.wrap("java.nio.HeapByteBuffer[pos=0 lim=44 cap=44]".getBytes("UTF-8")),rawTraceViews.get(0).getTraceId());
//
// ByteBuffer bf = rawTraceViews.get(0).getTraceId();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: remove this commented code.

@findingrish
Copy link
Copy Markdown
Contributor

Build is failing, try gw spotlessApply first

@findingrish
Copy link
Copy Markdown
Contributor

nit: rename the pr to chore: Add unit test for view-generator service
accordingly rename pr description

@github-actions

This comment has been minimized.

@sarthak77 sarthak77 changed the title test_commit chore: Add unit test for view-generator service May 23, 2021
}

@Test
public void testGenerateView_HotrodTrace() throws IOException {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is a good practice to name the test aftert the scenario it is testing. What are we trying to verify here?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, this is a unit test with a sample trace to test the corresponding view
maybe we could rename it to testGenerateView_SampleHotrodTrace ?


@Test
public void testGenerateView_HotrodTrace() throws IOException {
URL resource =
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think from here to line 33 is the preparation for the test and we could abstract it into a private static function, otherwise it makes it makes noise when reading the test.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@sarthak77 sarthak77 merged commit 23bd0d7 into main May 24, 2021
@sarthak77 sarthak77 deleted the sarthak_test branch May 24, 2021 14:24
@github-actions
Copy link
Copy Markdown

Unit Test Results

  65 files  +1    65 suites  +1   47s ⏱️ -2s
315 tests +1  315 ✔️ +1  0 💤 ±0  0 ❌ ±0 

Results for commit 23bd0d7. ± Comparison against base commit 94b8c05.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants