Skip to content
This repository has been archived by the owner on Oct 27, 2022. It is now read-only.

Implement Selective Testing #7

Closed
aszecowka opened this issue Mar 5, 2019 · 3 comments · Fixed by #28
Closed

Implement Selective Testing #7

aszecowka opened this issue Mar 5, 2019 · 3 comments · Fixed by #28
Assignees
Labels
help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/feature Categorizes issue or PR as related to a new feature.

Comments

@aszecowka
Copy link
Contributor

ClusterTestSuite has defined selectors:

  • matchNames
  • matchLabels

Currently, we run all the tests. Implement running only tests defined by selectors.

@aszecowka aszecowka added kind/feature Categorizes issue or PR as related to a new feature. quality/productivity labels Mar 5, 2019
@sjanota
Copy link

sjanota commented Mar 15, 2019

There is a problem with matchNames: TestDefinitions are namespaced, but we don't require namespace in selector. The only solution would be to fetch all namespaces and scan them in a for loop, but that sounds weak to me. I guess we must enhance matchNames with namespace.

There are some places in kubernetes where a convention namespace:name is used. auth can-i is one of those places. Maybe we can stick to it?

@sjanota
Copy link

sjanota commented Jun 27, 2019

Right now the TestSelector is defined as follows:

type TestsSelector struct {
	// Find test definitions by it's name
	MatchNames []TestDefReference `json:"matchNames,omitempty"`
	// Find test definitions by it's labels.
	// TestDefinition should have AT LEAST one label listed here to be executed.
	MatchLabels []string `json:"matchLabels,omitempty"`
}

The idea was that MatchLabels contains list of label names to match using EXISTS operator.

I suggest we change the approach to something like this:

type TestsSelector struct {
    // Find test definitions by it's name
    MatchNames []TestDefReference `json:"matchNames,omitempty"`
    // Find test definitions by it's labels.
    // TestDefinition should match AT LEAST one expression listed here to be executed.
    // For a complete grammar see: https://github.com/kubernetes/apimachinery/blob/master/pkg/labels/selector.go#L811
    MatchLabelExpressions []string `json:"matchLabels,omitempty"`
} 

Thanks to that we can utilize apimachinery labels.Parse function. The semantics would be OR, so every TD that matches at least one of the listed expressions should be executed.

@sjanota sjanota added the help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. label Jun 27, 2019
@sjanota sjanota self-assigned this Jun 28, 2019
@sjanota
Copy link

sjanota commented Jun 28, 2019

I'll go with the idea. PR should appear shortly.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/feature Categorizes issue or PR as related to a new feature.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants