1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2025-11-23 22:34:47 +02:00
Files
opentelemetry-go/sdk/metric/metricdata/metricdatatest/assertion_fail_test.go
renovate[bot] 56138d1060 fix(deps): update golang.org/x (#7482)
This PR contains the following updates:

| Package | Type | Update | Change | Age | Confidence |
|---|---|---|---|---|---|
| golang.org/x/exp | require | digest | `27f1f14` -> `90e834f` |
[![age](https://developer.mend.io/api/mc/badges/age/go/golang.org%2fx%2fexp/v0.0.0-20251017212417-90e834f514db?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/go/golang.org%2fx%2fexp/v0.0.0-20251002181428-27f1f14c8bb9/v0.0.0-20251017212417-90e834f514db?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
| golang.org/x/exp/typeparams | indirect | digest | `27f1f14` ->
`90e834f` |
[![age](https://developer.mend.io/api/mc/badges/age/go/golang.org%2fx%2fexp%2ftypeparams/v0.0.0-20251017212417-90e834f514db?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/go/golang.org%2fx%2fexp%2ftypeparams/v0.0.0-20251002181428-27f1f14c8bb9/v0.0.0-20251017212417-90e834f514db?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
| golang.org/x/net | indirect | minor | `v0.45.0` -> `v0.46.0` |
[![age](https://developer.mend.io/api/mc/badges/age/go/golang.org%2fx%2fnet/v0.46.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/go/golang.org%2fx%2fnet/v0.45.0/v0.46.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
| golang.org/x/telemetry | indirect | digest | `ca0c2a9` -> `24f779f` |
[![age](https://developer.mend.io/api/mc/badges/age/go/golang.org%2fx%2ftelemetry/v0.0.0-20251014153721-24f779f6aaef?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/go/golang.org%2fx%2ftelemetry/v0.0.0-20251008162818-ca0c2a905e73/v0.0.0-20251014153721-24f779f6aaef?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
| golang.org/x/tools | require | minor | `v0.37.0` -> `v0.38.0` |
[![age](https://developer.mend.io/api/mc/badges/age/go/golang.org%2fx%2ftools/v0.38.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/go/golang.org%2fx%2ftools/v0.37.0/v0.38.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

> [!WARNING]
> Some dependencies could not be looked up. Check the Dependency
Dashboard for more information.

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the
rebase/retry checkbox.

👻 **Immortal**: This PR will be recreated if closed unmerged. Get
[config
help](https://redirect.github.com/renovatebot/renovate/discussions) if
that's undesired.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/open-telemetry/opentelemetry-go).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS4xMzEuOSIsInVwZGF0ZWRJblZlciI6IjQxLjE0My4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJTa2lwIENoYW5nZWxvZyIsImRlcGVuZGVuY2llcyJdfQ==-->

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Tyler Yahn <codingalias@gmail.com>
2025-10-20 09:09:34 -07:00

74 lines
3.4 KiB
Go

// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0
//go:build tests_fail
package metricdatatest // import "go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest"
import (
"testing"
"go.opentelemetry.io/otel/attribute"
)
// These tests are used to develop the failure messages of this package's
// assertions. They can be run with the following.
//
// go test -tags tests_fail ./...
func testFailDatatype[T Datatypes](a, b T) func(*testing.T) {
return func(t *testing.T) {
AssertEqual(t, a, b)
}
}
func TestFailAssertEqual(t *testing.T) {
t.Run("ResourceMetrics", testFailDatatype(resourceMetricsA, resourceMetricsB))
t.Run("ScopeMetrics", testFailDatatype(scopeMetricsA, scopeMetricsB))
t.Run("Metrics", testFailDatatype(metricsA, metricsB))
t.Run("HistogramInt64", testFailDatatype(histogramInt64A, histogramInt64B))
t.Run("HistogramFloat64", testFailDatatype(histogramFloat64A, histogramFloat64B))
t.Run("SumInt64", testFailDatatype(sumInt64A, sumInt64B))
t.Run("SumFloat64", testFailDatatype(sumFloat64A, sumFloat64B))
t.Run("GaugeInt64", testFailDatatype(gaugeInt64A, gaugeInt64B))
t.Run("GaugeFloat64", testFailDatatype(gaugeFloat64A, gaugeFloat64B))
t.Run("HistogramDataPointInt64", testFailDatatype(histogramDataPointInt64A, histogramDataPointInt64B))
t.Run("HistogramDataPointFloat64", testFailDatatype(histogramDataPointFloat64A, histogramDataPointFloat64B))
t.Run("DataPointInt64", testFailDatatype(dataPointInt64A, dataPointInt64B))
t.Run("DataPointFloat64", testFailDatatype(dataPointFloat64A, dataPointFloat64B))
t.Run("ExemplarInt64", testFailDatatype(exemplarInt64A, exemplarInt64B))
t.Run("ExemplarFloat64", testFailDatatype(exemplarFloat64A, exemplarFloat64B))
t.Run("Extrema", testFailDatatype(minA, minB))
}
func TestFailAssertAggregationsEqual(t *testing.T) {
AssertAggregationsEqual(t, sumInt64A, nil)
AssertAggregationsEqual(t, sumFloat64A, gaugeFloat64A)
AssertAggregationsEqual(t, unknownAggregation{}, unknownAggregation{})
AssertAggregationsEqual(t, sumInt64A, sumInt64B)
AssertAggregationsEqual(t, sumFloat64A, sumFloat64B)
AssertAggregationsEqual(t, gaugeInt64A, gaugeInt64B)
AssertAggregationsEqual(t, gaugeFloat64A, gaugeFloat64B)
AssertAggregationsEqual(t, histogramInt64A, histogramInt64B)
AssertAggregationsEqual(t, histogramFloat64A, histogramFloat64B)
}
func TestFailAssertAttribute(t *testing.T) {
AssertHasAttributes(t, exemplarInt64A, attribute.Bool("A", false))
AssertHasAttributes(t, exemplarFloat64A, attribute.Bool("B", true))
AssertHasAttributes(t, dataPointInt64A, attribute.Bool("A", false))
AssertHasAttributes(t, dataPointFloat64A, attribute.Bool("B", true))
AssertHasAttributes(t, gaugeInt64A, attribute.Bool("A", false))
AssertHasAttributes(t, gaugeFloat64A, attribute.Bool("B", true))
AssertHasAttributes(t, sumInt64A, attribute.Bool("A", false))
AssertHasAttributes(t, sumFloat64A, attribute.Bool("B", true))
AssertHasAttributes(t, histogramDataPointInt64A, attribute.Bool("A", false))
AssertHasAttributes(t, histogramDataPointFloat64A, attribute.Bool("B", true))
AssertHasAttributes(t, histogramInt64A, attribute.Bool("A", false))
AssertHasAttributes(t, histogramFloat64A, attribute.Bool("B", true))
AssertHasAttributes(t, metricsA, attribute.Bool("A", false))
AssertHasAttributes(t, metricsA, attribute.Bool("B", true))
AssertHasAttributes(t, resourceMetricsA, attribute.Bool("A", false))
AssertHasAttributes(t, resourceMetricsA, attribute.Bool("B", true))
}