-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add command-line flags for more control over test cases to run and ho…
…w they're handled (#757) This adds a few new features: * The existing `--test-file` flag can now be specified multiple times, so one can run multiple suites at the same time, directly from a YAML file instead of from the embedded test case data. * The existing `--known-failing` flag is changing to be a pattern, and can be specified multiple times. To refer to a file of patterns (old behavior), prefix the value with "@". * The `--known-flaky` flag, which indicates patterns of test case names that are known to be flaky. The difference between "known failing" and "known flaky" is that if a known flaky test happens to succeed, the conformance tests will still succeed. With a known failing test, however, if it passes, that causes the run to fail. The "known failing" set should generally be preferred so that if/when a test case is fixed, the conformance tests will enforce that you also update your list of known failing test cases. * The `--run` flag, which indicates patterns of test case names to include in the run. If not specified, _all_ test cases that apply (per config) are included. This allows running just a single test suite, test case, or test case permutation, depending on what the user is trying to debug. * The `--skip` flag, which is the reverse above. This indicates patterns of test case names to _not_ bother running. In general, users should prefer `--known-failing` or `--known-flaky` flags to opt-out of test cases. But this is a convenient way to simply _not run_ particular test cases when running the conformance tests.
- Loading branch information
Showing
16 changed files
with
604 additions
and
246 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
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 2023-2024 The Connect 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 main | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestParsePatterns(t *testing.T) { | ||
t.Parallel() | ||
patterns := parsePatternFile([]byte(` | ||
# This is a comment | ||
This is a test pattern/foo/bar/baz/test-case-name | ||
All tests in this suite/** | ||
**/all-test-cases-with-this-name | ||
Another suite/*/*/*/another-test-case | ||
A suite with interior double wildcard/**/foo/bar | ||
# Another comment`)) | ||
expectedResult := []string{ | ||
"This is a test pattern/foo/bar/baz/test-case-name", | ||
"All tests in this suite/**", | ||
"**/all-test-cases-with-this-name", | ||
"Another suite/*/*/*/another-test-case", | ||
"A suite with interior double wildcard/**/foo/bar", | ||
} | ||
assert.Equal(t, expectedResult, patterns) | ||
} |
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
Oops, something went wrong.