Skip to content

Commit

Permalink
Merge pull request #52 from ShwethaKumbla/labels-support
Browse files Browse the repository at this point in the history
Run only filtered features by their assigned labels using --labels
  • Loading branch information
k8s-ci-robot authored Oct 13, 2021
2 parents cd133e2 + 8e8d9d9 commit 0610338
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions pkg/env/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -289,10 +289,19 @@ func (e *testEnv) execFeature(ctx context.Context, t *testing.T, f types.Feature

// feature-level subtest
t.Run(featName, func(t *testing.T) {
// skip if feature name does not match
if e.cfg.FeatureRegex() != nil && !e.cfg.FeatureRegex().MatchString(featName) {
t.Skipf(`Skipping feature "%s": name not matched`, featName)
}

// skip if labels does not match
// run tests if --labels values matches the feature labels
for k, v := range e.cfg.Labels() {
if f.Labels()[k] != v {
t.Skipf(`Skipping feature "%s": unmatched label "%s=%s"`, featName, k, f.Labels()[k])
}
}

// setups run at feature-level
setups := features.GetStepsByLevel(f.Steps(), types.LevelSetup)
for _, setup := range setups {
Expand Down

0 comments on commit 0610338

Please sign in to comment.