forked from open-telemetry/opentelemetry-collector
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
provide informative unsupported monitor error on windows (open-teleme…
- Loading branch information
1 parent
c6ce50c
commit 7a8af91
Showing
4 changed files
with
79 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
internal/receiver/smartagentreceiver/config_windows_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// Copyright OpenTelemetry Authors | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
//go:build windows | ||
// +build windows | ||
|
||
package smartagentreceiver | ||
|
||
import ( | ||
"path" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
"github.com/stretchr/testify/require" | ||
"go.opentelemetry.io/collector/component/componenttest" | ||
"go.opentelemetry.io/collector/service/servicetest" | ||
) | ||
|
||
func TestLoadUnsupportedCollectdMonitorOnWindows(t *testing.T) { | ||
factories, err := componenttest.NopFactories() | ||
assert.Nil(t, err) | ||
|
||
factory := NewFactory() | ||
factories.Receivers[typeStr] = factory | ||
cfg, err := servicetest.LoadConfig( | ||
path.Join(".", "testdata", "collectd_apache.yaml"), factories, | ||
) | ||
require.Error(t, err) | ||
require.EqualError(t, err, | ||
`error reading receivers configuration for "smartagent/collectd/apache": smart agent monitor type "collectd/apache" is not supported on windows platforms`) | ||
require.Nil(t, cfg) | ||
} |
16 changes: 16 additions & 0 deletions
16
internal/receiver/smartagentreceiver/testdata/collectd_apache.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
receivers: | ||
smartagent/collectd/apache: | ||
type: collectd/apache | ||
|
||
processors: | ||
nop: | ||
|
||
exporters: | ||
nop: | ||
|
||
service: | ||
pipelines: | ||
metrics: | ||
receivers: [smartagent/collectd/apache] | ||
processors: [nop] | ||
exporters: [nop] |