-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deprecate overwritepropertiesconverter, only used by non builder dist…
…ributions Signed-off-by: Bogdan <[email protected]>
- Loading branch information
1 parent
f24a6ac
commit 7dbf70c
Showing
6 changed files
with
101 additions
and
36 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' | ||
change_type: deprecation | ||
|
||
# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver) | ||
component: overwritepropertiesconverter | ||
|
||
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). | ||
note: "Deprecate `overwritepropertiesconverter`, only used by non builder distributions." | ||
|
||
# One or more tracking issues or pull requests related to the change | ||
issues: [6294] |
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
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
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,65 @@ | ||
// Copyright The 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. | ||
|
||
package service | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestSetFlag(t *testing.T) { | ||
tests := []struct { | ||
name string | ||
args []string | ||
expectedConfigs []string | ||
expectedErr string | ||
}{ | ||
{ | ||
name: "single set", | ||
args: []string{"--set=processors.batch.timeout=2s"}, | ||
expectedConfigs: []string{"yaml:processors::batch::timeout: 2s"}, | ||
}, | ||
{ | ||
name: "set and config", | ||
args: []string{"--set=processors.batch.timeout=2s", "--config=file:testdata/otelcol-nop.yaml"}, | ||
expectedConfigs: []string{"yaml:processors::batch::timeout: 2s", "file:testdata/otelcol-nop.yaml"}, | ||
}, | ||
{ | ||
name: "config and set", | ||
args: []string{"--config=file:testdata/otelcol-nop.yaml", "--set=processors.batch.timeout=2s"}, | ||
expectedConfigs: []string{"file:testdata/otelcol-nop.yaml", "yaml:processors::batch::timeout: 2s"}, | ||
}, | ||
{ | ||
name: "invalid set", | ||
args: []string{"--set=processors.batch.timeout:2s"}, | ||
expectedErr: `invalid value "processors.batch.timeout:2s" for flag -set: missing equal sign`, | ||
}, | ||
} | ||
|
||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
flgs := flags() | ||
err := flgs.Parse(tt.args) | ||
if tt.expectedErr != "" { | ||
assert.EqualError(t, err, tt.expectedErr) | ||
return | ||
} | ||
require.NoError(t, err) | ||
assert.Equal(t, tt.expectedConfigs, getConfigFlag(flgs)) | ||
}) | ||
} | ||
} |