Skip to content

Add K8S infrastructure for selenium tests #10384

Merged
dmytro-ndp merged 11 commits intomasterfrom
CHE-9768
Jul 13, 2018
Merged

Add K8S infrastructure for selenium tests #10384
dmytro-ndp merged 11 commits intomasterfrom
CHE-9768

Conversation

@musienko-maxim
Copy link
Copy Markdown
Contributor

What does this PR do?

  • Add property for managing K8S infrastructure
  • Improve managing of configurations for different environments (docker, openshift, k8s)
  • Add K8S TestGroup for dependent tests

What issues does this PR fix or reference?

#9768

@benoitf benoitf added status/code-review This issue has a pull request posted for it and is awaiting code review completion by the community. kind/task Internal things, technical debt, and to-do tasks to be performed. labels Jul 11, 2018
} else {
throw new RuntimeException(
format("Infrastructure '%s' hasn't been supported by tests.", cheInfrastructure));
final Infrastructure cheInfrastructure =
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, restore configureInfrastructureRelatedDependencies() method and update its content according to your PR.

}
}
}
} No newline at end of file
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

empty line missed at the end of file

}

private String getTemplateDirectory(String template) {
String templateDirectoryName;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be simplified:

private String getTemplateDirectory(String template) {
    String templateDirectoryName = infrastructure.toString().toLowerCase();
    
    if (infrastructure == k8s){
      templateDirectoryName = k8s.toString().toLowerCase();
    }

    return format("/templates/factory/%s/%s", templateDirectoryName, template);

Copy link
Copy Markdown
Contributor

@dmytro-ndp dmytro-ndp Jul 11, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it can, but case-statement is more preferable so as it's more obvious compare to if-statement, and it is more flexible

switch (infrastructure) {
case openshift:
case k8s:
templateDirectoryName = Infrastructure.openshift.toString().toLowerCase();
Copy link
Copy Markdown
Contributor

@Ohrimenko1988 Ohrimenko1988 Jul 11, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it OK that case is "k8s" but infrastructure which using is "openshift"?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also may be optimized like in the previous remark

Copy link
Copy Markdown
Contributor

@dmytro-ndp dmytro-ndp Jul 11, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it OK that case "k8s" but infrastructure which using is "openshift"?

Yes - it was requirement to use openshift templates for k8s.

Also may be optimized like in the previous remark

Please take a look at the answer https://github.com/eclipse/che/pull/10384/files/a178ec69b067878bf86a824ead181e7232512185#r201723043


@Singleton
public enum Infrastructure {
docker,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

upper case please

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right that it is the constant and have to be in upper case.
But we are using Infrastructure enum to simplify injection from environment variable CHE_INFRASTRUCTURE like the follow:

@Inject
@Named("che.infrastructure")
private Infrastructure infrastructure;

Such injection is case sensitive, and CHE_INFRASTRUCTURE uses lower-case values like docker, openshift etc.

Copy link
Copy Markdown
Contributor

@skabashnyuk skabashnyuk Jul 12, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've asked about values of the enum, not about the name of enum itself.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can transform the value of CHE_INFRASTRUCTURE variable to upper case in time of configuring CheSeleniumSuiteModule to make it possible to inject upper case values: Infrastructure.DOCKER, Infrastructure.OPENSHIFT etc.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what do you mean. But lowercase enum values looks weird.

package org.eclipse.che.selenium.core.constant;

import com.google.inject.Singleton;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

javadoc

docker,
openshift,
k8s,
supershift
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

supershift is redundant here

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like an idea of supporting supershift in Che 😄

switch (infrastructure) {
case openshift:
case k8s:
templateDirectoryName = Infrastructure.k8s.toString().toLowerCase();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you mean Infrastructure.openshift.toString().toLowerCase() here?


case docker:
default:
templateDirectoryName = infrastructure.toString().toLowerCase();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you mean Infrastructure.docker.toString().toLowerCase() here?

Signed-off-by: Dmytro Nochevnov <dnochevnov@codenvy.com>
@dmytro-ndp
Copy link
Copy Markdown
Contributor

ci-test

@riuvshin
Copy link
Copy Markdown
Contributor

ci-test build report:
Build details
Test report
selenium tests report data
docker image: eclipseche/che-server:10384
https://github.com/orgs/eclipse/teams/eclipse-che-qa please check this report.

Signed-off-by: Dmytro Nochevnov <dnochevnov@codenvy.com>
@dmytro-ndp dmytro-ndp merged commit fc91a43 into master Jul 13, 2018
@benoitf benoitf added this to the 6.9.0 milestone Jul 13, 2018
@benoitf benoitf removed the status/code-review This issue has a pull request posted for it and is awaiting code review completion by the community. label Jul 13, 2018
@dmytro-ndp dmytro-ndp deleted the CHE-9768 branch August 1, 2018 16:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/task Internal things, technical debt, and to-do tasks to be performed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants