Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding system tests #399

Open
wants to merge 33 commits into
base: dev_main
Choose a base branch
from
Open

Adding system tests #399

wants to merge 33 commits into from

Conversation

Vahila
Copy link
Member

@Vahila Vahila commented Jan 20, 2025

This PR has following changes:

  • Added system tests under src/test/java/com/mathworks/ci/systemTests
  • Moved the integ test under the above mentioned folder as sometimes there are errors because of inconsistent directory and package path
  • Deleted some unnecessary tests

System tests needs access to MATLAB to run successfully. The MATLAB root path is read from 'MATLAB_ROOT' env variable. These tests are configured to run only if the 'MATLAB_ROOT' variable is defined. This is to ensure that the tests pass in Jenkinsci jobs and it makes it easier to run the tests locally as well.

Matrix project needs two versions of MATLAB to run successfully. Since there is an error while using Set up MATLAB twice, these tests would be skipped(Updating the main.yml to define MATLAB_ROOT_22b would trigger the tests)

System tests follow the standard integration tests format *IT.java. These tests can be run in isolation using failsafe plugin.
mvn test - Runs only unit tests
mvn verify - Runs both unit and system tests
mvn failsafe:integration-test - Runs only system tests

@Vahila Vahila requested a review from mw-kapilg January 20, 2025 16:10
@Vahila Vahila marked this pull request as ready for review January 20, 2025 16:18
pom.xml Outdated Show resolved Hide resolved
@@ -1,136 +1,136 @@
package unit.com.mathworks.ci.actions;
Copy link
Member

Choose a reason for hiding this comment

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

I never noticed this before but we have separate test packages. In the Bamboo plugin we use the same package. Should the package be updated or are we going to keep them in separate packages?

@@ -0,0 +1,28 @@
name: using mpm to install MATLAB
Copy link
Member

Choose a reason for hiding this comment

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

I like that we're using GitHub Actions. Does this mean we can remove the Azure Pipelines yaml?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, we only run 'mvn verify' command in azure pipelines as well. So we can remove that.

.github/workflows/main.yml Outdated Show resolved Hide resolved
Copy link
Member

@sameagen-MW sameagen-MW left a comment

Choose a reason for hiding this comment

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

Looks really good! Definitely a huge improvement, just a couple of things that I caught during the review.

name: using mpm to install MATLAB
on: push
jobs:
my-job:
Copy link
Member

Choose a reason for hiding this comment

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

Could maybe give this job a more descriptive name in case we want to add more in the future.

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated the job name to 'run-tests-job'. Hope this makes sense.

FreeStyleBuild build = project.scheduleBuild2(0).get();

jenkins.assertBuildStatus(Result.FAILURE, build);
jenkins.assertLogContains("Verify global tool configuration for the specified node.", build);
Copy link
Member

Choose a reason for hiding this comment

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

This could fail in a future Jenkins update, which is just something that we should be aware of in case it ever shows up.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, the message could change. I added a note specifying the same.

Comment on lines 171 to 181
@Test
public void verifyMATLABscratchFileNotGenerated() throws Exception {
this.buildWrapper.setMatlabBuildWrapperContent(
new MatlabBuildWrapperContent(Message.getValue("matlab.custom.location"), Utilities.getMatlabRoot()));
project.getBuildWrappersList().add(this.buildWrapper);
scriptBuilder.setTasks("");
project.getBuildersList().add(this.scriptBuilder);
FreeStyleBuild build = project.scheduleBuild2(0).get();
File matlabRunner = new File(build.getWorkspace() + File.separator + "runMatlabTests.m");
Assert.assertFalse(matlabRunner.exists());
}
Copy link
Member

Choose a reason for hiding this comment

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

I think this test case is probably not necessry.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I will delete these tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants