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

Fix some jUnit tests on Linux #7

Conversation

srstsavage
Copy link

Fix many path related and other issues with jUnit tests on Linux.

Note that these changes don't yet make every test pass, there are still issues with font differences in image generation, non-portable performance checks, and a handful of other differences.

Fix many path related and other issues with jUnit tests on Linux.

Note that these changes don't yet make every test pass, there
are still issues with font differences in image generation,
non-portable performance checks, and a handful of other differences.
ChrisJohnNOAA and others added 8 commits April 16, 2024 17:03
While linux may not send the modify events on deletion or the directory event, windows does
This is only used in one spot, so should be safe to modify.
Also it was previously checking if the string started with a / and if not, adding a slash to the end of it.
The wording of FileNotFoundException differs, so just make sure its that kind of exception. Mark testNcml flaky (for now), and fix the capitilzation of testGridNThreads for systems that are sensitive to that.
…ixes

Fixes so these work on Windows and Linux
@srstsavage
Copy link
Author

@ChrisJohnNOAA Your changes looked good to me and affected tests still passed on my Linux machine. Merged those!

@ChrisJohnNOAA ChrisJohnNOAA merged commit 97509f7 into ChrisJohnNOAA:test_migrations Apr 17, 2024
ChrisJohnNOAA added a commit that referenced this pull request Apr 24, 2024
* Add WEB-INF/temp to gitignore

* Set up a way to run tests dependent on WEB-INF directory structure

* Migrate SgtMap tests to JUnit

Note many of the images showed small differences from old tests due to fonts. I added a new tag that's just informative that these tests are font dependent (the images I'm adding pass on my machine-  there might be issues on different machines).

* Migrate some more tests to JUnit

New tag RequiresContent for tests that are relying on the content/setup.xml, I still need to find a way to make those tests not require manual setup.

* migrate more tests, add support for skipping setup.xml validation

Skipping the setup.xml validation allows additional tests that don't rely on those values

* Remove lastmodified column from the file visitor tests

Last modified is difficult to have consistent across machines (and even on the same machine).

* New load datasets using xml fragments approach and helper class for that.

Also migrate EDDGridFromDap to JUnit.

Sadly most tests are reliant on datasets from THREDDS, so they still aren't running. The plan to fix that is one of: mock THREDDS responses, local files for those datasets, or different datasets.

* Add support for generating test code coverage (based on JUnit tests)

* Migrate tests for cohort/array, cohort/util

* Migrate TestUtil and DataStream to JUnit

* Migrate a large collection of tests to junit

* Move resources to not included in git

Planning to transition to downloading the test resource files.

* Migrate more code to junit, update test resources for a plan to handle large files

Also moves some files to a new scripts folder that is for code designed to be run manually that is not part of the main server.

* Another set of tests migrated to junit

* More test migrations

Also update image all comparisons to use resource paths.

* Split up test resource files, Mark Flaky tests, split off very large files

This is to make the folders small enough they can be zipped under 2gb and served from a git release

* New approach for maven downloading files (using the maven-download-plugin now)

Also adding flaky annotations for tests that failed (several of them I believe failed due to things like file last modified timestamp being different).

* Update EDDGridFromDapTests.java

* Change when test resources are downloaded

Add the flaky annotation to several more tests.

* Improve netcdf loading for a fresh install, one more flaky tag

* More changes to eliminate reliance on specific hardcoded paths

Also fix a couple hardcoded dataset ids to use suggested ids.

* Centralize code for test initialization. Also set tests to use SansSerif for tests.

Tests are now using SansSerif because it is always available in java distributions and so it eliminates one more step needed for developer setup.

* For setups without fonts installed, any use of EDStatic also needs the font setup

* Add 2024 to the FileVisitorDNLS gpcp test

* Re-add download of content

* Set file separators to forward slash

* Update FileVisitorSubdirTests for path slash changes

* Update warsourceExcludes for new folders

* fix HashDigestTests path

* Fix some jUnit tests on Linux (#7)

* Fix some jUnit tests on Linux

Fix many path related and other issues with jUnit tests on Linux.

Note that these changes don't yet make every test pass, there
are still issues with font differences in image generation,
non-portable performance checks, and a handful of other differences.

* Fix watch directory tests on windows

While linux may not send the modify events on deletion or the directory event, windows does

* Disable the display in browser, it causes tests to pause

* Have the path regex work for both windows and linux

* Fix the forwardSlashDir utility function

This is only used in one spot, so should be safe to modify.
Also it was previously checking if the string started with a / and if not, adding a slash to the end of it.

* Fix some of the EDDGridFromNcFilesTests on Linux

The wording of FileNotFoundException differs, so just make sure its that kind of exception. Mark testNcml flaky (for now), and fix the capitilzation of testGridNThreads for systems that are sensitive to that.

* Disable the performance part of persistentTableTests for now

* Change to using a temp dir for eddtablefromhttpgettests

---------

Co-authored-by: Chris John <chris.john@noaa.gov>

* Clean up no longer used unitTestDataDir (and big version)

* Add a tag for imageComparison tests.

Add some explanation for image comparison tests to the readme.

* Mark a few tests as flaky due to differences on different OS. Also remove the performance checks in a couple spots.

* Don't start the email thread if we're testing

* Fix the regexfilename tests that look for java files

Recent pom changes mean the java files aren't copied over to the build outputs

* Fix the EDDTests to use the values in the Jetty setup.xml

* Simplify the changes when running in a test environment

* Re-add the ability for tests to skip defered loading

* Remove Flaky tag from several file visitor tests

* Have directory_strlen work cross platform

* Because file selection for attributes is based on OS lastModified and there's discepencies on how OSes handle that field, different files can be selected for the attributes of a dataset. Update some tests that were running into this with pulling some attributes from the loaded data instead of fully hardcoded.

* re-add maven-antrun-plugin data dir creation and comment out more non-portable performance tests (#8)

* re-add maven-antrun-plugin creation of jetty test data directory

* Comment out additional non-portable performance tests

---------

Co-authored-by: Shane St Savage <shane@axds.co>
Co-authored-by: Shane St Savage <shane@axiomdatascience.com>
ChrisJohnNOAA added a commit that referenced this pull request Jun 3, 2024
* Add WEB-INF/temp to gitignore

* Set up a way to run tests dependent on WEB-INF directory structure

* Migrate SgtMap tests to JUnit

Note many of the images showed small differences from old tests due to fonts. I added a new tag that's just informative that these tests are font dependent (the images I'm adding pass on my machine-  there might be issues on different machines).

* Migrate some more tests to JUnit

New tag RequiresContent for tests that are relying on the content/setup.xml, I still need to find a way to make those tests not require manual setup.

* migrate more tests, add support for skipping setup.xml validation

Skipping the setup.xml validation allows additional tests that don't rely on those values

* Remove lastmodified column from the file visitor tests

Last modified is difficult to have consistent across machines (and even on the same machine).

* New load datasets using xml fragments approach and helper class for that.

Also migrate EDDGridFromDap to JUnit.

Sadly most tests are reliant on datasets from THREDDS, so they still aren't running. The plan to fix that is one of: mock THREDDS responses, local files for those datasets, or different datasets.

* Add support for generating test code coverage (based on JUnit tests)

* Migrate tests for cohort/array, cohort/util

* Migrate TestUtil and DataStream to JUnit

* Migrate a large collection of tests to junit

* Move resources to not included in git

Planning to transition to downloading the test resource files.

* Migrate more code to junit, update test resources for a plan to handle large files

Also moves some files to a new scripts folder that is for code designed to be run manually that is not part of the main server.

* Another set of tests migrated to junit

* More test migrations

Also update image all comparisons to use resource paths.

* Split up test resource files, Mark Flaky tests, split off very large files

This is to make the folders small enough they can be zipped under 2gb and served from a git release

* New approach for maven downloading files (using the maven-download-plugin now)

Also adding flaky annotations for tests that failed (several of them I believe failed due to things like file last modified timestamp being different).

* Update EDDGridFromDapTests.java

* Change when test resources are downloaded

Add the flaky annotation to several more tests.

* Improve netcdf loading for a fresh install, one more flaky tag

* More changes to eliminate reliance on specific hardcoded paths

Also fix a couple hardcoded dataset ids to use suggested ids.

* Centralize code for test initialization. Also set tests to use SansSerif for tests.

Tests are now using SansSerif because it is always available in java distributions and so it eliminates one more step needed for developer setup.

* For setups without fonts installed, any use of EDStatic also needs the font setup

* Add 2024 to the FileVisitorDNLS gpcp test

* Re-add download of content

* Set file separators to forward slash

* Update FileVisitorSubdirTests for path slash changes

* Update warsourceExcludes for new folders

* fix HashDigestTests path

* Fix some jUnit tests on Linux (#7)

* Fix some jUnit tests on Linux

Fix many path related and other issues with jUnit tests on Linux.

Note that these changes don't yet make every test pass, there
are still issues with font differences in image generation,
non-portable performance checks, and a handful of other differences.

* Fix watch directory tests on windows

While linux may not send the modify events on deletion or the directory event, windows does

* Disable the display in browser, it causes tests to pause

* Have the path regex work for both windows and linux

* Fix the forwardSlashDir utility function

This is only used in one spot, so should be safe to modify.
Also it was previously checking if the string started with a / and if not, adding a slash to the end of it.

* Fix some of the EDDGridFromNcFilesTests on Linux

The wording of FileNotFoundException differs, so just make sure its that kind of exception. Mark testNcml flaky (for now), and fix the capitilzation of testGridNThreads for systems that are sensitive to that.

* Disable the performance part of persistentTableTests for now

* Change to using a temp dir for eddtablefromhttpgettests

---------

Co-authored-by: Chris John <chris.john@noaa.gov>

* Clean up no longer used unitTestDataDir (and big version)

* Add a tag for imageComparison tests.

Add some explanation for image comparison tests to the readme.

* Mark a few tests as flaky due to differences on different OS. Also remove the performance checks in a couple spots.

* Don't start the email thread if we're testing

* Fix the regexfilename tests that look for java files

Recent pom changes mean the java files aren't copied over to the build outputs

* Fix the EDDTests to use the values in the Jetty setup.xml

* Simplify the changes when running in a test environment

* Re-add the ability for tests to skip defered loading

* Remove Flaky tag from several file visitor tests

* Have directory_strlen work cross platform

* Because file selection for attributes is based on OS lastModified and there's discepencies on how OSes handle that field, different files can be selected for the attributes of a dataset. Update some tests that were running into this with pulling some attributes from the loaded data instead of fully hardcoded.

* Fix a handful of flaky tests

The main changes are to remove comparisons on last modified time
There's a couple other small changes as well (sorting results in a few tests to make sure the lines are always in the same order for example)

* Remove TagFlaky from tests that are fixed or currently seem to be working

Some of them were external servers that had previously temporarily been unavailable.

* Fix attributes for test1d

* First version of running a test that requires local erddap using jetty

* Enable more local erddap tests using jetty

* Generate a datasets file to use with jetty in tests that contains all of the test datasets

* Migrate additional tests to Jetty

Fix some flaky tests

* Make some tests more resilient to minor changes in data (use regex to not test some numbers).

* Enable some additional tests (SOS, Thredds, wms)

* Add initialization to EDDTableFromFilesTests

* Enable more tests

Get several local ERDDAP/Jetty tests working.
Change some tests from discontinued thredds datasets to new datasets and turn them on.

* New tests to cover gaps (metadata, sitemap, interpolate)

* Format EDDTestDataset

* Add test to make sure aggregaterows uses range from all inputs

* Test for esriAscii also format EDDGridTests and EDDTableAggregateRowsTests

* Enabling additional tests

As well as decrease flakiness of some existing tests.

* Add support for mismatched slashses to fileVisitor reduceDnlsTableToOneDir

* Add support for file separator mismatches while using files functionality

Enable an additional Jetty Test

* More changes to make tests more stable and pass cross platform

* More test changes to reduce flakiness

* Migrating some of the code not used by ERDDAP into separate directories

Possibly should delete this, but want to keep it until that's confirmed

* Remove jdom from repo

All tests still pass, should get additional confirmation on geotiff writer before release

* Archive additional code

Mostly dods/servers, dods/servlets. Also some additional files that were used with Browsers.

* Remove several datasets that fail to load from the Jetty tests datasets file

Also reduce the load wait time to 10 minutes.

* Fix filename filter test after code was archived

* Better testing geotiff

---------

Co-authored-by: Shane St Savage <shane@axds.co>
Co-authored-by: Shane St Savage <shane@axiomdatascience.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants