Skip to content

Commit

Permalink
Remove opamp remote config dir readable validation (#1385)
Browse files Browse the repository at this point in the history
* remove opamp remote config dir readable validation

Signed-off-by: Sean Porter <[email protected]>

* changelog entry

Signed-off-by: Sean Porter <[email protected]>

---------

Signed-off-by: Sean Porter <[email protected]>
  • Loading branch information
portertech authored Dec 13, 2023
1 parent 6f3f290 commit 8d723b4
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 12 deletions.
1 change: 1 addition & 0 deletions .changelog/1385.changed.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Removed OpAMP extension remote configuration directory readable validation.
7 changes: 0 additions & 7 deletions pkg/extension/opampextension/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ package opampextension

import (
"errors"
"fmt"
"os"

"github.com/oklog/ulid/v2"
"go.opentelemetry.io/collector/component"
Expand Down Expand Up @@ -63,10 +61,5 @@ func (cfg *Config) Validate() error {
return errors.New("opamp remote_configuration_directory must be provided")
}

d := cfg.RemoteConfigurationDirectory
if _, err := os.Stat(d); err != nil {
return fmt.Errorf("opamp remote_configuration_directory %s must be readable: %v", d, err)
}

return nil
}
5 changes: 0 additions & 5 deletions pkg/extension/opampextension/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ package opampextension
import (
"os"
"path/filepath"
"strings"
"testing"

"github.com/stretchr/testify/assert"
Expand Down Expand Up @@ -63,10 +62,6 @@ func TestConfigValidate(t *testing.T) {
require.Error(t, err)
assert.Equal(t, "opamp remote_configuration_directory must be provided", err.Error())

cfg.RemoteConfigurationDirectory = "/tmp/opamp.d"
err = cfg.Validate()
assert.True(t, strings.HasPrefix(err.Error(), "opamp remote_configuration_directory /tmp/opamp.d must be readable:"))

d, err := os.MkdirTemp("", "opamp.d")
assert.NoError(t, err)
defer os.RemoveAll(d)
Expand Down

0 comments on commit 8d723b4

Please sign in to comment.