Skip to content

RUM-4030 Setup the trace end tests environment for Otel API#1983

Merged
mariusc83 merged 2 commits into
feature/otel-supportfrom
mconstantin/setup-end-to-end-test-environment
Apr 15, 2024
Merged

RUM-4030 Setup the trace end tests environment for Otel API#1983
mariusc83 merged 2 commits into
feature/otel-supportfrom
mconstantin/setup-end-to-end-test-environment

Conversation

@mariusc83

Copy link
Copy Markdown
Member

What does this PR do?

A brief description of the change being made with this pull request.

Motivation

What inspired you to submit this pull request?

Additional Notes

Anything else we should know when reviewing?

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests (unit, integration, e2e)
  • Make sure you discussed the feature or bugfix with the maintaining team in an Issue
  • Make sure each commit and the PR mention the Issue number (cf the CONTRIBUTING doc)

@mariusc83
mariusc83 marked this pull request as ready for review April 11, 2024 08:51
@mariusc83
mariusc83 requested review from a team as code owners April 11, 2024 08:51
@codecov-commenter

codecov-commenter commented Apr 11, 2024

Copy link
Copy Markdown

Codecov Report

Merging #1983 (f2f8837) into feature/otel-support (399b663) will decrease coverage by 0.02%.
The diff coverage is n/a.

Additional details and impacted files
@@                   Coverage Diff                    @@
##           feature/otel-support    #1983      +/-   ##
========================================================
- Coverage                 60.39%   60.38%   -0.02%     
========================================================
  Files                       808      808              
  Lines                     30193    30196       +3     
  Branches                   4947     4947              
========================================================
- Hits                      18234    18231       -3     
- Misses                    10747    10749       +2     
- Partials                   1212     1216       +4     

see 27 files with indirect coverage changes

@mariusc83
mariusc83 force-pushed the mconstantin/setup-end-to-end-test-environment branch from a01a6b1 to a9e72f6 Compare April 11, 2024 13:50
@mariusc83
mariusc83 requested a review from 0xnm April 11, 2024 13:50
@mariusc83
mariusc83 force-pushed the mconstantin/setup-end-to-end-test-environment branch from a9e72f6 to e2dbd24 Compare April 11, 2024 14:20
0xnm
0xnm previously approved these changes Apr 11, 2024
import org.assertj.core.data.Offset
import java.util.Locale

internal class PayloadAssert(actual: JsonObject) :

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.

Note

I would rename this class SpanPayloadAssert instead. PayloadAssert feels quite generic and this class seems very opinionated around the Span data model.

return this
}

class ChildAtAssert(actual: JsonObject, private val index: Int) :

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.

Note

Same, I'd rename this as SpanAssert or something similar. ChildAt doesn't really make any sense.

AbstractObjectAssert<ChildAtAssert, JsonObject>(actual, ChildAtAssert::class.java) {

fun hasTraceId(traceId: String): ChildAtAssert {
val key = TRACE_ID_KEY_FORMAT.format(Locale.US, index)

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.

Important

Instead of generating a key with the index for every assertions, why don't you get the object at "span[$i]" in the hasSpanAtIndexWith() function, and then pass that JsonObject as argument to this method.
Even though it's just tests, it is error prone to have this every where + quite inneficient.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I was thinking to leverage those koltin extensions under the hood, also had this approach in mind. I will give it a try.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Indeed creating all these keys with string formats is not efficient, I wanted to keep the same approach as in initial tests but maybe it's too much.

* Copyright 2016-Present Datadog, Inc.
*/

package com.datadog.android.trace.integration.assertj

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.

Note

Based on our testing guidelines, this should be in a package named com.datadog.android.trace.integration.tests.assertj

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

nope, it is in the right package there, assertj is not part of tests...maybe I should put it there though 🤔

@mariusc83
mariusc83 force-pushed the mconstantin/setup-end-to-end-test-environment branch from e2dbd24 to f2f8837 Compare April 12, 2024 08:24
@mariusc83
mariusc83 requested review from 0xnm and xgouchet April 15, 2024 07:25
@mariusc83
mariusc83 merged commit 37e2e35 into feature/otel-support Apr 15, 2024
@mariusc83
mariusc83 deleted the mconstantin/setup-end-to-end-test-environment branch April 15, 2024 07:51
@xgouchet xgouchet added this to the 2.11.x milestone Jul 31, 2024
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