forked from mchandramouli/blobs
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from ExpediaDotCom/blob-key-updates
use opentracing span in blob makekey
- Loading branch information
Showing
7 changed files
with
45 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 2 additions & 19 deletions
21
...k-blobs/span-blob-context/src/test/scala/com/expedia/blobs/core/SpanBlobContextSpec.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,18 @@ | ||
package com.expedia.blobs.core | ||
|
||
import com.expedia.www.haystack.client.Tracer | ||
import com.expedia.www.haystack.client.dispatchers.NoopDispatcher | ||
import com.expedia.www.haystack.client.metrics.NoopMetricsRegistry | ||
import org.junit.Assert | ||
import org.scalatest.easymock.EasyMockSugar | ||
import org.scalatest.{FunSpec, Matchers} | ||
|
||
class SpanBlobContextSpec extends FunSpec with Matchers with EasyMockSugar { | ||
|
||
private val tracer = new Tracer.Builder(new NoopMetricsRegistry, "TestService", new NoopDispatcher).build() | ||
private val span = tracer.buildSpan("TestOperation").start | ||
|
||
describe("com.expedia.blobs.core.SpanBlobContext") { | ||
|
||
it("should throw an error if span is not present") { | ||
val catchExpection = intercept[Exception] { | ||
val spanBlobContext: SpanBlobContext = new SpanBlobContext(null) | ||
val _ = new SpanBlobContext(null, "", "") | ||
} | ||
|
||
catchExpection.getMessage shouldEqual "Span cannot be null in context" | ||
} | ||
|
||
it("should return the correct operation name") { | ||
val operationName = new SpanBlobContext(span).getOperationName | ||
Assert.assertEquals("TestOperation", operationName) | ||
} | ||
|
||
it("should return the correct service name") { | ||
val serviceName = new SpanBlobContext(span).getServiceName | ||
Assert.assertEquals("TestService", serviceName) | ||
catchExpection.getMessage shouldEqual "span cannot be null in context" | ||
} | ||
} | ||
} |