Skip to content

Commit

Permalink
v2/contrib/hashicorp/vault: update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
darccio committed Mar 11, 2024
1 parent e86899c commit d54c964
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 14 deletions.
9 changes: 0 additions & 9 deletions ddtrace/mocktracer/mockspan.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,6 @@ func (s *Span) Tag(k string) interface{} {
if !ok {
return nil
}
if k == ext.Error {
// This is a special case because the mocktracer doesn't set the error tag
// if there is no error. The tests expect a nil value but the tracer returns
// an int32(0) which is not nil.
v := v.(int32)
if v == 0 {
return nil
}
}
return v
}

Expand Down
10 changes: 5 additions & 5 deletions v2/contrib/hashicorp/vault/vault_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ func testMountReadWrite(c *api.Client, t *testing.T) {
assert.Equal(http.MethodPost+" /v1/sys/mounts/ns1/ns2/secret", span.Tag(ext.ResourceName))
assert.Equal(ext.SpanTypeHTTP, span.Tag(ext.SpanType))
assert.Equal(float64(200), span.Tag(ext.HTTPCode))
assert.Nil(span.Tag(ext.Error))
assert.Zero(span.Tag(ext.Error))
assert.Nil(span.Tag(ext.ErrorMsg))
assert.Nil(span.Tag("vault.namespace"))
assert.Equal("hashicorp/vault", span.Tag(ext.Component))
Expand Down Expand Up @@ -170,7 +170,7 @@ func testMountReadWrite(c *api.Client, t *testing.T) {
assert.Equal(http.MethodPut+" "+fullPath, span.Tag(ext.ResourceName))
assert.Equal(ext.SpanTypeHTTP, span.Tag(ext.SpanType))
assert.Equal(float64(200), span.Tag(ext.HTTPCode))
assert.Nil(span.Tag(ext.Error))
assert.Zero(span.Tag(ext.Error))
assert.Nil(span.Tag(ext.ErrorMsg))
assert.Nil(span.Tag("vault.namespace"))
assert.Equal("hashicorp/vault", span.Tag(ext.Component))
Expand Down Expand Up @@ -206,7 +206,7 @@ func testMountReadWrite(c *api.Client, t *testing.T) {
assert.Equal(http.MethodGet+" "+fullPath, span.Tag(ext.ResourceName))
assert.Equal(ext.SpanTypeHTTP, span.Tag(ext.SpanType))
assert.Equal(float64(200), span.Tag(ext.HTTPCode))
assert.Nil(span.Tag(ext.Error))
assert.Zero(span.Tag(ext.Error))
assert.Nil(span.Tag(ext.ErrorMsg))
assert.Nil(span.Tag("vault.namespace"))
assert.Equal("hashicorp/vault", span.Tag(ext.Component))
Expand Down Expand Up @@ -300,7 +300,7 @@ func TestNamespace(t *testing.T) {
assert.Equal(http.MethodPut+" "+fullPath, span.Tag(ext.ResourceName))
assert.Equal(ext.SpanTypeHTTP, span.Tag(ext.SpanType))
assert.Equal(float64(200), span.Tag(ext.HTTPCode))
assert.Nil(span.Tag(ext.Error))
assert.Zero(span.Tag(ext.Error))
assert.Nil(span.Tag(ext.ErrorMsg))
assert.Equal(namespace, span.Tag("vault.namespace"))
assert.Equal("hashicorp/vault", span.Tag(ext.Component))
Expand Down Expand Up @@ -334,7 +334,7 @@ func TestNamespace(t *testing.T) {
assert.Equal(http.MethodGet+" "+fullPath, span.Tag(ext.ResourceName))
assert.Equal(ext.SpanTypeHTTP, span.Tag(ext.SpanType))
assert.Equal(float64(200), span.Tag(ext.HTTPCode))
assert.Nil(span.Tag(ext.Error))
assert.Zero(span.Tag(ext.Error))
assert.Nil(span.Tag(ext.ErrorMsg))
assert.Equal(namespace, span.Tag("vault.namespace"))
assert.Equal("hashicorp/vault", span.Tag(ext.Component))
Expand Down

0 comments on commit d54c964

Please sign in to comment.