Repository navigation
More tests with ginkgo - #29
Conversation
|
/retest |
|
/test k8s-e2e |
| @@ -0,0 +1,441 @@ | |||
| package actuators | |||
|
|
|||
There was a problem hiding this comment.
This is called actuators but the fact that this is driven by the actuator is circumstantial today, this could be e.g the machine controller. This should belong to the same suite there's in infra and may be rename it to "elastic compute" or similar
There was a problem hiding this comment.
I did not want to overload the word controller. It's true machine controller is "just" a wrapper around an actuator. Here, actuator is shorter than machinecontroller or elasticcompute. Plus, elastic compute is process oriented term compared to actuator which is component oriented. To goal was to break the tests into component-wise buckets. Infra homes all tests of which I was not sure what would be the right component to put them to. More or less following what I described in the test design google doc.
There was a problem hiding this comment.
the suite you are reimplementing belongs all together. It's validating holistic features that result from the interaction of one or more of the components that together provide the e2e machine API experience. Actuator is an implementation detail that we don't care about in this context
We should have only one suite pkg e.g "elastic compute", may be different files and a common utils
cc @bison @frobware
There was a problem hiding this comment.
I tend to agree that these are meant to be high-level E2E, so things should be named more after groups of features / use-cases / stories than components. Not really sure what the right thing is exactly though. Any example in upstream Kubernetes or something we can look to?
There was a problem hiding this comment.
We should have only one suite pkg e.g "elastic compute", may be different files and a common utils
There is only one test suite. Under the hood broken into more packages for better readability and manipulation.
-
To be clear the conflict of interest is to decide if we are going to break the single test suite component-wise or process-wise. The test suite for me here is "Conformance". We might even go with
pkg/e2e/conformance/...layout to explicitly say the tests fall under the category (though I don't consider that necessary).I am fine with both (component and process). Any hints on what would be the names/identifiers we might use for holistic process-wise categorization? I could imagine:
autoscalingmachinereconciling- anything else?
elasticcomputeis too generic buzzword that does not say anything. -
Does the conflict also includes the question of putting the tests under multiple files under one package instead of how it is currently done?
I still want to break the individual tests into packages so you can import subset of tests in different test suite (e.g.
Performance). If you check the import part ofe2e_test.go, you can see:import ( ... _ "github.com/openshift/cluster-api-actuator-pkg/pkg/e2e/actuators" _ "github.com/openshift/cluster-api-actuator-pkg/pkg/e2e/autoscaler" _ "github.com/openshift/cluster-api-actuator-pkg/pkg/e2e/infra" _ "github.com/openshift/cluster-api-actuator-pkg/pkg/e2e/operators" )
I could have
pkg/e2e/performance/e2e_test.gothat will import just operators (to assert both operators are available and working). With all tests under the same package (just different files) you can import either all the tests or no tests. And I don't want to import all conformance tests into the performance test suite.And again, it's easier to see intention of a set of tests if they are imported from e.g.
actuatorsorautocalerthen to just have:import ( ... _ "github.com/openshift/cluster-api-actuator-pkg/pkg/e2e" )
Bottom line: On the other hand, one could argue we can put all the tests under one huge test suite and use [Conformance] and [Performance]. Doing that, we would need to put the keyword to every Describe or spec part to make sure only conformance, resp. performance tests are run when --ginkgo.focus is set to [Conformance], resp. [Performance] focus. Though, this can be discussed later once we have more test suites.
There was a problem hiding this comment.
1 - This must be process/feature wise, it does not care about components. Conformance/machines/smoke/elasticCompute I don't have strong opinions on the naming
2 - "you can import either all the tests or no tests." this is good and it's exactly the invariant we want to force. This suite is the gate for any of repo which might have an impact on the user feature validation
There was a problem hiding this comment.
1 - This must be process/feature wise, it does not care about components. Conformance/machines/smoke/elasticCompute I don't have strong opinions on the naming
Conformance is the test suite name, machines, autoscaling, ... would be test suite groups. The question is what would be the group names?
2 - "you can import either all the tests or no tests." this is good and it's exactly the invariant we want to force. This suite is the gate for any of repo which might have an impact on the user feature validation
This is orthogonal to the question. All tests are to be run as part of Conformance test suite. Inseparably from each other. The intent is to:
- allow other test suites to reuse subset of tests
- decompose one huge test suite into smaller chunks (groups) so it's easier to maintain, read and extend the code
| ) | ||
|
|
||
| const ( | ||
| workerRoleLabel = "node-role.kubernetes.io/worker" |
There was a problem hiding this comment.
these values are duplicated in operator common. Can we have some common utils?
There was a problem hiding this comment.
nit: Anything but common or utils. Something with more explicit naming please.
There was a problem hiding this comment.
Yeah, I will create pkg/e2e/common package.
| @@ -0,0 +1,371 @@ | |||
| package infra | |||
There was a problem hiding this comment.
infra? is this an accidental carry over?
In any case is there any reason to have operator/autoscalers/infra/actuators.
I think they could all belong to same package e.g "elastic compute" and then have independent files and a common utils
There was a problem hiding this comment.
infra? is this an accidental carry over?
Right, it should be autoscaler.
In any case is there any reason to have operator/autoscalers/infra/actuators.
I think they could all belong to same package e.g "elastic compute" and then have independent files and a common utils
We are not exposing new API so in this case I prefer to allocate one directory/package for each important component. I still prefer smaller packages with few files rather than one package with a lots of files.
|
thanks!! Dropped some comments. I don't see the need for having different packages, I'd be in favour of having all the suite in the same package e.g "elastic compute" and different files one common utils. |
| .PHONY: test | ||
| test: # Run unit test | ||
| $(DOCKER_CMD) go test -race -cover ./pkg/... | ||
| $(DOCKER_CMD) go test -race -cover `go list ./... | grep -v github.com/openshift/cluster-api-actuator-pkg/pkg/e2e` |
There was a problem hiding this comment.
Why don't we be explicit here? Just run the named package?
There was a problem hiding this comment.
other packages might have unit tests worth running so I am just skipping anything but e2e
| .PHONY: k8s-e2e | ||
| k8s-e2e: ## Run k8s specific e2e test | ||
| # KUBECONFIG and SSH_PK dirs needs to be mounted inside a container if tests are run in containers | ||
| go test -timeout 30m \ |
There was a problem hiding this comment.
I think the test-e2e and the k8s-e2e only differ in the namespace. We could create a Makefile macro here and reduce the duplication.
There was a problem hiding this comment.
We might have a single make e2e-operator or similar and run make e2e-operator NAMESPACE=kube-system so there is only a single point of entry. This will require to update the Prow job first. Let's do it in the next iteration so we can start adding new tests to the new framework.
| ) | ||
|
|
||
| const ( | ||
| workerRoleLabel = "node-role.kubernetes.io/worker" |
There was a problem hiding this comment.
nit: Anything but common or utils. Something with more explicit naming please.
| return machine | ||
| } | ||
|
|
||
| func isNodeReady(node *corev1.Node) bool { |
There was a problem hiding this comment.
Can't believe you bailed on the 67MB import from kube for this... :-D
| return false | ||
| } | ||
|
|
||
| func waitUntilNodesAreReady(client runtimeclient.Client, listOpt *runtimeclient.ListOptions, nodeCount int) error { |
There was a problem hiding this comment.
I think we should pass in a Context here - start with that in mind so that we can do cancellation.
There was a problem hiding this comment.
We should have to set BeforeEach for each g.Describe like this (most of the code can be put into a function and called, yet still needs to be repeated):
var describeContext context.Context
g.BeforeEach(func() {
var cancel context.CancelFunc
g.By("Creating context")
stopCh := signals.SetupSignalHandler()
describeContext, cancel = context.WithCancel(context.Background())
go func() {
select {
case <-stopCh:
cancel()
case <-describeContext.Done():
}
}()
})There was a problem hiding this comment.
Let's discuss this and expectations in the next iteration of the tests. Right now, I am not sure how we should approach this.
|
/retest |
By running `dep ensure`
|
/approve |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: enxebre The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
This looks good enough to me. Once we merge we can sync all repos to run this and follow up with any farther improvement |
|
/lgtm |
No description provided.