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

Adapt the unit test action to not use a docker image. #117

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

drgrice1
Copy link
Member

@drgrice1 drgrice1 commented Aug 24, 2022

This just uses the ubuntu 22.04 runner, and installs the webwork3 dependencies directly, and then runs the unit tests. It actually doesn't take much longer to do this than to use the prebuilt docker image.

This is one way to solve the issue of the dependence on a docker image that does not belong to the openwebwork project.

There is one issue though. Several of the tests were failing with this new approach. Looking closely at the tests that were failing, I realized that those tests should be failing. All of the tests that were failing were boolean values compared to numerical values. Those tests have been fixed in this pull request. However, the issue is that for some reason the fixed tests were passing for us when we run the tests on our local machines and they were passing in the previous docker image approach. We need to figure this out, so that we don't need to wait until the workflow has run to see what needs to be fixed.

The dockerfile used for the previous workflow image has also been updated for new Ubuntu package versions. Also the dependencies of Devel::Cover::Report::Codecove that are available in the Ubuntu repositories are installed via those packages. This speeds up the build some. Ubuntu packages install faster than building from cpan source via cpanm.

Note there was an instance in lib/DB/Schema/Result/ProblemSet.pm of a boolean column, and so that package should load the InflateColumn::Boolean class. Also, all of the __PACKAGE__->load_components calls were made uniform.

@drgrice1
Copy link
Member Author

This pull requests success is self evident. The unit test check action was successful, and looking back at times that previous unit test actions have taken you will see that it does pretty well. It took 2 minutes and 51 seconds for the unit test for this pull request. Looking at previous unit test actions you see that is comparable. I have run this numerous times on my fork and this is consistent.

@drgrice1 drgrice1 force-pushed the no-docker-unit-tests branch 9 times, most recently from 3526107 to ed65ddf Compare August 26, 2022 11:26
@drgrice1
Copy link
Member Author

The docker image built with the webwork3.dockerfile in this pull request will now also have the stricter boolean type checking. So the unit tests and the docker image are consistent, and the unit tests will fail in both without the changes to the tests in this pull request.

It would be nice to force the tests to use a specific JSON backend module, regardless of what is installed on the system. The environment variables PERL_JSON_BACKEND and MOJO_NO_JSON_XS should work for this, but they don't for some reason.

@drgrice1 drgrice1 force-pushed the no-docker-unit-tests branch 3 times, most recently from e4a9e7f to 9ac35f1 Compare August 27, 2022 17:37
@drgrice1
Copy link
Member Author

I added the Cpanel::JSON::XS module to the workflow and to the webwork2.dockerfile. So now the tests will run the way they do now on our local setups.

I will work to convert the tests to Test2::V0 and Test2::MojoX to make the tests more strict for boolean types.

@drgrice1 drgrice1 force-pushed the no-docker-unit-tests branch 2 times, most recently from 097d230 to 587dd60 Compare August 28, 2022 11:22
@drgrice1 drgrice1 force-pushed the no-docker-unit-tests branch 6 times, most recently from b8bcaa6 to 23e8c3a Compare November 2, 2022 16:17
This uses Ubuntu 22.04 for the runner and docker image.
@drgrice1 drgrice1 force-pushed the no-docker-unit-tests branch from 23e8c3a to 84a22e7 Compare November 2, 2022 16:31
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.

1 participant