Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: test failure cases on windows #1047

Merged
merged 10 commits into from
Dec 6, 2021
4 changes: 1 addition & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,7 @@ jobs:
strategy:
matrix:
go-version: [1.16, 1.15]
# TODO: support all of these.
#os: [ubuntu-latest, macos-latest, windows-latest]
os: [ubuntu-latest, macos-latest]
os: [ubuntu-latest, macos-latest, windows-latest]
# GitHub Actions does not support arm* architectures on default
# runners. It is possible to acomplish this with a self-hosted runner
# if we want to add this in the future:
Expand Down
11 changes: 11 additions & 0 deletions exporters/metric/cortex/utils/config_utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,17 @@ func initYAML(yamlBytes []byte, path string) (afero.Fs, error) {
// Create an in-memory file system.
fs := afero.NewMemMapFs()

// https://github.com/spf13/viper/blob/v1.8.1/viper.go#L480
// absPathify uses filepath.Clean, so here you also need to use filepath.Clean
if filepath.IsAbs(path) {
path = filepath.Clean(path)
} else {
p, err := filepath.Abs(path)
if err == nil {
path = filepath.Clean(p)
}
}

// Retrieve the directory path.
dirPath := filepath.Dir(path)

Expand Down
5 changes: 3 additions & 2 deletions exporters/metric/datadog/example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import (
controller "go.opentelemetry.io/otel/sdk/metric/controller/basic"
"go.opentelemetry.io/otel/sdk/metric/processor/basic"
"go.opentelemetry.io/otel/sdk/metric/selector/simple"
semconv "go.opentelemetry.io/otel/semconv/v1.4.0"
)

type TestUDPServer struct {
Expand Down Expand Up @@ -67,7 +68,7 @@ func ExampleExporter() {
global.SetMeterProvider(pusher.MeterProvider())
meter := global.Meter("marwandist")
m := metric.Must(meter).NewInt64Histogram("myrecorder")
meter.RecordBatch(context.Background(), []attribute.KeyValue{attribute.Int("l", 1)},
meter.RecordBatch(context.Background(), []attribute.KeyValue{attribute.Int("l", 1), semconv.ServiceNameKey.String("ExampleExporter")},
laojianzi marked this conversation as resolved.
Show resolved Hide resolved
m.Measurement(1), m.Measurement(50), m.Measurement(100))
}()

Expand Down Expand Up @@ -98,7 +99,7 @@ func ExampleExporter() {
}

// Output:
// myrecorder.max:100|g|#env:dev,l:1,service.name:unknown_service:datadog.test,telemetry.sdk.language:go,telemetry.sdk.name:opentelemetry,telemetry.sdk.version:1.0.0-RC3
// myrecorder.max:100|g|#env:dev,l:1,service.name:ExampleExporter,telemetry.sdk.language:go,telemetry.sdk.name:opentelemetry,telemetry.sdk.version:1.0.0-RC3
//
}

Expand Down