Skip to content

Commit

Permalink
Otel-4633 Replace path.Join method with filepath.Join method (#4638)
Browse files Browse the repository at this point in the history
* Otel-4633 Replace path.Join method with filepath.Join method

* Otel-4633 Replace path.Join method with filepath.Join method
  • Loading branch information
shree007 authored Jan 5, 2022
1 parent d552222 commit 0e02722
Show file tree
Hide file tree
Showing 12 changed files with 81 additions and 81 deletions.
52 changes: 26 additions & 26 deletions config/configgrpc/configgrpc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"io/ioutil"
"net"
"os"
"path"
"path/filepath"
"runtime"
"testing"
"time"
Expand Down Expand Up @@ -466,14 +466,14 @@ func TestHttpReception(t *testing.T) {
name: "TLS",
tlsServerCreds: &configtls.TLSServerSetting{
TLSSetting: configtls.TLSSetting{
CAFile: path.Join(".", "testdata", "ca.crt"),
CertFile: path.Join(".", "testdata", "server.crt"),
KeyFile: path.Join(".", "testdata", "server.key"),
CAFile: filepath.Join("testdata", "ca.crt"),
CertFile: filepath.Join("testdata", "server.crt"),
KeyFile: filepath.Join("testdata", "server.key"),
},
},
tlsClientCreds: &configtls.TLSClientSetting{
TLSSetting: configtls.TLSSetting{
CAFile: path.Join(".", "testdata", "ca.crt"),
CAFile: filepath.Join("testdata", "ca.crt"),
},
ServerName: "localhost",
},
Expand All @@ -482,12 +482,12 @@ func TestHttpReception(t *testing.T) {
name: "NoServerCertificates",
tlsServerCreds: &configtls.TLSServerSetting{
TLSSetting: configtls.TLSSetting{
CAFile: path.Join(".", "testdata", "ca.crt"),
CAFile: filepath.Join("testdata", "ca.crt"),
},
},
tlsClientCreds: &configtls.TLSClientSetting{
TLSSetting: configtls.TLSSetting{
CAFile: path.Join(".", "testdata", "ca.crt"),
CAFile: filepath.Join("testdata", "ca.crt"),
},
ServerName: "localhost",
},
Expand All @@ -497,17 +497,17 @@ func TestHttpReception(t *testing.T) {
name: "mTLS",
tlsServerCreds: &configtls.TLSServerSetting{
TLSSetting: configtls.TLSSetting{
CAFile: path.Join(".", "testdata", "ca.crt"),
CertFile: path.Join(".", "testdata", "server.crt"),
KeyFile: path.Join(".", "testdata", "server.key"),
CAFile: filepath.Join("testdata", "ca.crt"),
CertFile: filepath.Join("testdata", "server.crt"),
KeyFile: filepath.Join("testdata", "server.key"),
},
ClientCAFile: path.Join(".", "testdata", "ca.crt"),
ClientCAFile: filepath.Join("testdata", "ca.crt"),
},
tlsClientCreds: &configtls.TLSClientSetting{
TLSSetting: configtls.TLSSetting{
CAFile: path.Join(".", "testdata", "ca.crt"),
CertFile: path.Join(".", "testdata", "client.crt"),
KeyFile: path.Join(".", "testdata", "client.key"),
CAFile: filepath.Join("testdata", "ca.crt"),
CertFile: filepath.Join("testdata", "client.crt"),
KeyFile: filepath.Join("testdata", "client.key"),
},
ServerName: "localhost",
},
Expand All @@ -516,15 +516,15 @@ func TestHttpReception(t *testing.T) {
name: "NoClientCertificate",
tlsServerCreds: &configtls.TLSServerSetting{
TLSSetting: configtls.TLSSetting{
CAFile: path.Join(".", "testdata", "ca.crt"),
CertFile: path.Join(".", "testdata", "server.crt"),
KeyFile: path.Join(".", "testdata", "server.key"),
CAFile: filepath.Join("testdata", "ca.crt"),
CertFile: filepath.Join("testdata", "server.crt"),
KeyFile: filepath.Join("testdata", "server.key"),
},
ClientCAFile: path.Join(".", "testdata", "ca.crt"),
ClientCAFile: filepath.Join("testdata", "ca.crt"),
},
tlsClientCreds: &configtls.TLSClientSetting{
TLSSetting: configtls.TLSSetting{
CAFile: path.Join(".", "testdata", "ca.crt"),
CAFile: filepath.Join("testdata", "ca.crt"),
},
ServerName: "localhost",
},
Expand All @@ -534,17 +534,17 @@ func TestHttpReception(t *testing.T) {
name: "WrongClientCA",
tlsServerCreds: &configtls.TLSServerSetting{
TLSSetting: configtls.TLSSetting{
CAFile: path.Join(".", "testdata", "ca.crt"),
CertFile: path.Join(".", "testdata", "server.crt"),
KeyFile: path.Join(".", "testdata", "server.key"),
CAFile: filepath.Join("testdata", "ca.crt"),
CertFile: filepath.Join("testdata", "server.crt"),
KeyFile: filepath.Join("testdata", "server.key"),
},
ClientCAFile: path.Join(".", "testdata", "server.crt"),
ClientCAFile: filepath.Join("testdata", "server.crt"),
},
tlsClientCreds: &configtls.TLSClientSetting{
TLSSetting: configtls.TLSSetting{
CAFile: path.Join(".", "testdata", "ca.crt"),
CertFile: path.Join(".", "testdata", "client.crt"),
KeyFile: path.Join(".", "testdata", "client.key"),
CAFile: filepath.Join("testdata", "ca.crt"),
CertFile: filepath.Join("testdata", "client.crt"),
KeyFile: filepath.Join("testdata", "client.key"),
},
ServerName: "localhost",
},
Expand Down
52 changes: 26 additions & 26 deletions config/confighttp/confighttp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"net/http"
"net/http/httptest"
"net/url"
"path"
"path/filepath"
"testing"
"time"

Expand Down Expand Up @@ -389,14 +389,14 @@ func TestHttpReception(t *testing.T) {
name: "TLS",
tlsServerCreds: &configtls.TLSServerSetting{
TLSSetting: configtls.TLSSetting{
CAFile: path.Join(".", "testdata", "ca.crt"),
CertFile: path.Join(".", "testdata", "server.crt"),
KeyFile: path.Join(".", "testdata", "server.key"),
CAFile: filepath.Join("testdata", "ca.crt"),
CertFile: filepath.Join("testdata", "server.crt"),
KeyFile: filepath.Join("testdata", "server.key"),
},
},
tlsClientCreds: &configtls.TLSClientSetting{
TLSSetting: configtls.TLSSetting{
CAFile: path.Join(".", "testdata", "ca.crt"),
CAFile: filepath.Join("testdata", "ca.crt"),
},
ServerName: "localhost",
},
Expand All @@ -405,12 +405,12 @@ func TestHttpReception(t *testing.T) {
name: "NoServerCertificates",
tlsServerCreds: &configtls.TLSServerSetting{
TLSSetting: configtls.TLSSetting{
CAFile: path.Join(".", "testdata", "ca.crt"),
CAFile: filepath.Join("testdata", "ca.crt"),
},
},
tlsClientCreds: &configtls.TLSClientSetting{
TLSSetting: configtls.TLSSetting{
CAFile: path.Join(".", "testdata", "ca.crt"),
CAFile: filepath.Join("testdata", "ca.crt"),
},
ServerName: "localhost",
},
Expand All @@ -420,17 +420,17 @@ func TestHttpReception(t *testing.T) {
name: "mTLS",
tlsServerCreds: &configtls.TLSServerSetting{
TLSSetting: configtls.TLSSetting{
CAFile: path.Join(".", "testdata", "ca.crt"),
CertFile: path.Join(".", "testdata", "server.crt"),
KeyFile: path.Join(".", "testdata", "server.key"),
CAFile: filepath.Join("testdata", "ca.crt"),
CertFile: filepath.Join("testdata", "server.crt"),
KeyFile: filepath.Join("testdata", "server.key"),
},
ClientCAFile: path.Join(".", "testdata", "ca.crt"),
ClientCAFile: filepath.Join("testdata", "ca.crt"),
},
tlsClientCreds: &configtls.TLSClientSetting{
TLSSetting: configtls.TLSSetting{
CAFile: path.Join(".", "testdata", "ca.crt"),
CertFile: path.Join(".", "testdata", "client.crt"),
KeyFile: path.Join(".", "testdata", "client.key"),
CAFile: filepath.Join("testdata", "ca.crt"),
CertFile: filepath.Join("testdata", "client.crt"),
KeyFile: filepath.Join("testdata", "client.key"),
},
ServerName: "localhost",
},
Expand All @@ -439,15 +439,15 @@ func TestHttpReception(t *testing.T) {
name: "NoClientCertificate",
tlsServerCreds: &configtls.TLSServerSetting{
TLSSetting: configtls.TLSSetting{
CAFile: path.Join(".", "testdata", "ca.crt"),
CertFile: path.Join(".", "testdata", "server.crt"),
KeyFile: path.Join(".", "testdata", "server.key"),
CAFile: filepath.Join("testdata", "ca.crt"),
CertFile: filepath.Join("testdata", "server.crt"),
KeyFile: filepath.Join("testdata", "server.key"),
},
ClientCAFile: path.Join(".", "testdata", "ca.crt"),
ClientCAFile: filepath.Join("testdata", "ca.crt"),
},
tlsClientCreds: &configtls.TLSClientSetting{
TLSSetting: configtls.TLSSetting{
CAFile: path.Join(".", "testdata", "ca.crt"),
CAFile: filepath.Join("testdata", "ca.crt"),
},
ServerName: "localhost",
},
Expand All @@ -457,17 +457,17 @@ func TestHttpReception(t *testing.T) {
name: "WrongClientCA",
tlsServerCreds: &configtls.TLSServerSetting{
TLSSetting: configtls.TLSSetting{
CAFile: path.Join(".", "testdata", "ca.crt"),
CertFile: path.Join(".", "testdata", "server.crt"),
KeyFile: path.Join(".", "testdata", "server.key"),
CAFile: filepath.Join("testdata", "ca.crt"),
CertFile: filepath.Join("testdata", "server.crt"),
KeyFile: filepath.Join("testdata", "server.key"),
},
ClientCAFile: path.Join(".", "testdata", "server.crt"),
ClientCAFile: filepath.Join("testdata", "server.crt"),
},
tlsClientCreds: &configtls.TLSClientSetting{
TLSSetting: configtls.TLSSetting{
CAFile: path.Join(".", "testdata", "ca.crt"),
CertFile: path.Join(".", "testdata", "client.crt"),
KeyFile: path.Join(".", "testdata", "client.key"),
CAFile: filepath.Join("testdata", "ca.crt"),
CertFile: filepath.Join("testdata", "client.crt"),
KeyFile: filepath.Join("testdata", "client.key"),
},
ServerName: "localhost",
},
Expand Down
12 changes: 6 additions & 6 deletions config/configunmarshaler/defaultunmarshaler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ package configunmarshaler

import (
"context"
"path"
"path/filepath"
"testing"

"github.com/stretchr/testify/assert"
Expand All @@ -37,7 +37,7 @@ func TestDecodeConfig(t *testing.T) {
assert.NoError(t, err)

// Unmarshal the config
cfg, err := loadConfigFile(t, path.Join(".", "testdata", "valid-config.yaml"), factories)
cfg, err := loadConfigFile(t, filepath.Join("testdata", "valid-config.yaml"), factories)
require.NoError(t, err, "Unable to load config")

// Verify extensions.
Expand Down Expand Up @@ -192,7 +192,7 @@ func TestDecodeConfig_Invalid(t *testing.T) {

for _, test := range testCases {
t.Run(test.name, func(t *testing.T) {
_, err := loadConfigFile(t, path.Join(".", "testdata", test.name+".yaml"), factories)
_, err := loadConfigFile(t, filepath.Join("testdata", test.name+".yaml"), factories)
require.Error(t, err)
if test.expected != 0 {
cfgErr, ok := err.(*configError)
Expand All @@ -214,15 +214,15 @@ func TestLoadEmpty(t *testing.T) {
factories, err := testcomponents.ExampleComponents()
assert.NoError(t, err)

_, err = loadConfigFile(t, path.Join(".", "testdata", "empty-config.yaml"), factories)
_, err = loadConfigFile(t, filepath.Join("testdata", "empty-config.yaml"), factories)
assert.NoError(t, err)
}

func TestLoadEmptyAllSections(t *testing.T) {
factories, err := testcomponents.ExampleComponents()
assert.NoError(t, err)

_, err = loadConfigFile(t, path.Join(".", "testdata", "empty-all-sections.yaml"), factories)
_, err = loadConfigFile(t, filepath.Join("testdata", "empty-all-sections.yaml"), factories)
assert.NoError(t, err)
}

Expand All @@ -240,7 +240,7 @@ func TestDefaultLoggerConfig(t *testing.T) {
factories, err := testcomponents.ExampleComponents()
assert.NoError(t, err)

cfg, err := loadConfigFile(t, path.Join(".", "testdata", "empty-all-sections.yaml"), factories)
cfg, err := loadConfigFile(t, filepath.Join("testdata", "empty-all-sections.yaml"), factories)
assert.NoError(t, err)

zapProdCfg := zap.NewProductionConfig()
Expand Down
4 changes: 2 additions & 2 deletions exporter/loggingexporter/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
package loggingexporter

import (
"path"
"path/filepath"
"testing"

"github.com/stretchr/testify/assert"
Expand All @@ -33,7 +33,7 @@ func TestLoadConfig(t *testing.T) {

factory := NewFactory()
factories.Exporters[typeStr] = factory
cfg, err := servicetest.LoadConfigAndValidate(path.Join(".", "testdata", "config.yaml"), factories)
cfg, err := servicetest.LoadConfigAndValidate(filepath.Join("testdata", "config.yaml"), factories)

require.NoError(t, err)
require.NotNil(t, cfg)
Expand Down
4 changes: 2 additions & 2 deletions exporter/otlpexporter/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
package otlpexporter

import (
"path"
"path/filepath"
"testing"
"time"

Expand All @@ -38,7 +38,7 @@ func TestLoadConfig(t *testing.T) {
factory := NewFactory()
factories.Exporters[typeStr] = factory

cfg, err := servicetest.LoadConfigAndValidate(path.Join(".", "testdata", "config.yaml"), factories)
cfg, err := servicetest.LoadConfigAndValidate(filepath.Join("testdata", "config.yaml"), factories)

require.NoError(t, err)
require.NotNil(t, cfg)
Expand Down
4 changes: 2 additions & 2 deletions exporter/otlphttpexporter/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
package otlphttpexporter

import (
"path"
"path/filepath"
"testing"
"time"

Expand All @@ -36,7 +36,7 @@ func TestLoadConfig(t *testing.T) {

factory := NewFactory()
factories.Exporters[typeStr] = factory
cfg, err := servicetest.LoadConfigAndValidate(path.Join(".", "testdata", "config.yaml"), factories)
cfg, err := servicetest.LoadConfigAndValidate(filepath.Join("testdata", "config.yaml"), factories)

require.NoError(t, err)
require.NotNil(t, cfg)
Expand Down
6 changes: 3 additions & 3 deletions extension/ballastextension/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
package ballastextension

import (
"path"
"path/filepath"
"testing"

"github.com/stretchr/testify/assert"
Expand All @@ -32,7 +32,7 @@ func TestLoadConfig(t *testing.T) {

factory := NewFactory()
factories.Extensions[typeStr] = factory
cfg, err := servicetest.LoadConfigAndValidate(path.Join(".", "testdata", "config.yaml"), factories)
cfg, err := servicetest.LoadConfigAndValidate(filepath.Join("testdata", "config.yaml"), factories)

require.Nil(t, err)
require.NotNil(t, cfg)
Expand All @@ -59,7 +59,7 @@ func TestLoadInvalidConfig(t *testing.T) {

factory := NewFactory()
factories.Extensions[typeStr] = factory
_, err = servicetest.LoadConfigAndValidate(path.Join(".", "testdata", "config_invalid.yaml"), factories)
_, err = servicetest.LoadConfigAndValidate(filepath.Join("testdata", "config_invalid.yaml"), factories)

require.NotNil(t, err)
assert.Equal(t, err.Error(), "extension \"memory_ballast\" has invalid configuration: size_in_percentage is not in range 0 to 100")
Expand Down
4 changes: 2 additions & 2 deletions extension/zpagesextension/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
package zpagesextension

import (
"path"
"path/filepath"
"testing"

"github.com/stretchr/testify/assert"
Expand All @@ -33,7 +33,7 @@ func TestLoadConfig(t *testing.T) {

factory := NewFactory()
factories.Extensions[typeStr] = factory
cfg, err := servicetest.LoadConfigAndValidate(path.Join(".", "testdata", "config.yaml"), factories)
cfg, err := servicetest.LoadConfigAndValidate(filepath.Join("testdata", "config.yaml"), factories)

require.Nil(t, err)
require.NotNil(t, cfg)
Expand Down
4 changes: 2 additions & 2 deletions processor/batchprocessor/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
package batchprocessor

import (
"path"
"path/filepath"
"testing"
"time"

Expand All @@ -33,7 +33,7 @@ func TestLoadConfig(t *testing.T) {

factory := NewFactory()
factories.Processors[typeStr] = factory
cfg, err := servicetest.LoadConfigAndValidate(path.Join(".", "testdata", "config.yaml"), factories)
cfg, err := servicetest.LoadConfigAndValidate(filepath.Join("testdata", "config.yaml"), factories)

require.Nil(t, err)
require.NotNil(t, cfg)
Expand Down
Loading

0 comments on commit 0e02722

Please sign in to comment.