-
Notifications
You must be signed in to change notification settings - Fork 487
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into expose-physical-disk-collector-from-windows-…
…exporter
- Loading branch information
Showing
189 changed files
with
5,601 additions
and
1,967 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 |
---|---|---|
|
@@ -22,7 +22,7 @@ jobs: | |
path: source | ||
|
||
- name: Install chart-testing | ||
uses: helm/[email protected].0 | ||
uses: helm/[email protected].1 | ||
|
||
- name: List changed charts | ||
id: list-changed | ||
|
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 |
---|---|---|
|
@@ -57,7 +57,7 @@ jobs: | |
check-latest: true | ||
|
||
- name: Install chart-testing | ||
uses: helm/[email protected].0 | ||
uses: helm/[email protected].1 | ||
|
||
- name: Determine changed charts | ||
id: list-changed | ||
|
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
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,86 @@ | ||
package flowmode | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestParseExtraArgs(t *testing.T) { | ||
type testCase struct { | ||
name string | ||
extraArgs string | ||
expected []string | ||
expectedError string | ||
} | ||
|
||
var testCases = []testCase{ | ||
{ | ||
name: "integrations next with env vars", | ||
extraArgs: "-enable-features=integrations-next -config.expand-env", | ||
expected: []string{"-enable-features", "integrations-next", "-config.expand-env"}, | ||
}, | ||
{ | ||
name: "longhand", | ||
extraArgs: "--key=value", | ||
expected: []string{"--key", "value"}, | ||
}, | ||
{ | ||
name: "shorthand", | ||
extraArgs: "-k=value", | ||
expected: []string{"-k", "value"}, | ||
}, | ||
{ | ||
name: "bool longhand", | ||
extraArgs: "--boolVariable", | ||
expected: []string{"--boolVariable"}, | ||
}, | ||
{ | ||
name: "bool shorthand", | ||
extraArgs: "-b", | ||
expected: []string{"-b"}, | ||
}, | ||
{ | ||
name: "combo", | ||
extraArgs: "--key=value -k=value --boolVariable -b", | ||
expected: []string{"--key", "value", "-k", "value", "--boolVariable", "-b"}, | ||
}, | ||
{ | ||
name: "spaced", | ||
extraArgs: "--key value", | ||
expected: []string{"--key", "value"}, | ||
}, | ||
{ | ||
name: "value with equals", | ||
extraArgs: `--key="foo=bar"`, | ||
expected: []string{"--key", `"foo=bar"`}, | ||
}, | ||
{ | ||
name: "no value", | ||
extraArgs: "--key=", | ||
expected: []string{"--key"}, | ||
}, | ||
{ | ||
name: "no dashes", | ||
extraArgs: "key", | ||
expected: []string{"key"}, | ||
}, | ||
{ | ||
name: "no dashes with value", | ||
extraArgs: "key=value", | ||
expectedError: "invalid flag found: key=value", | ||
}, | ||
} | ||
|
||
for _, tc := range testCases { | ||
t.Run(tc.name, func(t *testing.T) { | ||
res, err := parseExtraArgs(tc.extraArgs) | ||
if tc.expectedError != "" { | ||
require.EqualError(t, err, tc.expectedError) | ||
return | ||
} | ||
require.NoError(t, err) | ||
require.Equal(t, tc.expected, res) | ||
}) | ||
} | ||
} |
Oops, something went wrong.