rstudio / rsconnect

Publish Shiny Applications, RMarkdown Documents, Jupyter Notebooks, Plumber APIs, and more
http://rstudio.github.io/rsconnect/
133 stars 81 forks source link

Failure ('test-linters.R:17:3'): The linter identifies files not matching in case sensitivity -- #954

Closed tillea closed 1 year ago

tillea commented 1 year ago

Hi, when testing the Debian package of rsconnect I get:

== Failed tests ================================================================
-- Failure ('test-linters.R:17:3'): The linter identifies files not matching in case sensitivity --
as.integer(filepath.capitalization$indices) (`actual`) not equal to 31 (`expected`).
  `actual`:
`expected`: 31
[ FAIL 1 | WARN 1 | SKIP 116 | PASS 548 ]

You can see a full build log in the CI of Debian Gitlab instance

Kind regards, Andreas.

aronatkins commented 1 year ago

The last passing build appears to be have from rsconnect-0.8.29: https://salsa.debian.org/r-pkg-team/r-cran-rsconnect/-/jobs/3806435

aronatkins commented 1 year ago

@tillea - Could you share the steps I need to take to recreate that failure seen by the Debian CI? We run those same tests from our CI (using the GitHub Ubuntu runners) without issue.

aronatkins commented 1 year ago

One other note: The linters tests pass on the CRAN Debian hosts (we have other failures that were triggered by Bioconductor mirror problems): https://cran.rstudio.org/web/checks/check_results_rsconnect.html

tillea commented 1 year ago

Am Wed, Aug 16, 2023 at 05:29:36AM -0700 schrieb Aron Atkins:

The last passing build appears to be have from rsconnect-0.8.29: https://salsa.debian.org/r-pkg-team/r-cran-rsconnect/-/jobs/3806435

I guess this is not a safe point to start with. Since rsconnect had the new dependency renv we had to skip several of the latest point releases. It sometimes takes some time to get some new package into Debian. So we can not know a sensible bisecting point.

aronatkins commented 1 year ago

I guess this is not a safe point to start with.

Understood - there were linting changes in the 1.0.0 rsconnect release. I know the PRs and commits that included those changes. I mostly wanted to record that we were previously in a "passing" state.

Most likely, it was this work (https://github.com/rstudio/rsconnect/pull/695).

Is there a Dockerfile or something similar that I could use to recreate this failure?

tillea commented 1 year ago

Am Wed, Aug 16, 2023 at 07:02:49AM -0700 schrieb Aron Atkins:

Understood - there were linting changes in the 1.0.0 rsconnect release. I know the PRs and commits that included those changes. I mostly wanted to record that we were previously in a "passing" state.

Understood,

Is there a Dockerfile or something similar that I could use to recreate this failure?

I'm pretty sure there are some docker files of Debian unstable (this is what you need to seek for) out there. We are running this script for testing. (Note: You probably should skip the copying stuff and just do

    LC_ALL=C R --no-save < $testfile
aronatkins commented 1 year ago

The copy and gzip lines:

cp -a /usr/share/doc/$debname/tests/* $AUTOPKGTEST_TMP
gunzip testthat/test*.gz # do not unzip everything - some files need to remain compressed

Is there any chance that tests/testthat/shinyapp-with-absolute-paths/data/College.txt is missing or remaining compressed in the Debian test environment?

If I look at the current Debian package (from the 0.8.29-1 release), that is lacking test files, as well. For example, with that release:

/usr/share/doc/r-cran-rsconnect/tests/testthat/shinyapp-with-absolute-paths:
total 16
-rw-r--r-- 1 root root 2109 Jan  9  2023 ShinyDocument.Rmd
-rw-r--r-- 1 root root 1222 Jan  9  2023 ShinyPresentation.Rmd
-rw-r--r-- 1 root root 1063 Jan  9  2023 server.R
-rw-r--r-- 1 root root  667 Jan  9  2023 ui.R

However, if I look at the rsconnect Git repository at the point of the 0.8.29 tag, we have:

tests/testthat/shinyapp-with-absolute-paths
total 32
-rw-r--r--  1 aron  staff     0 Aug 16 11:21 College.txt
-rw-r--r--  1 aron  staff  2109 May 31 10:11 ShinyDocument.Rmd
-rw-r--r--  1 aron  staff  1222 May 31 10:11 ShinyPresentation.Rmd
-rw-r--r--  1 aron  staff  1063 Aug 16 11:21 server.R
drwxr-xr-x  3 aron  staff    96 May 31 10:11 subdir
-rw-r--r--  1 aron  staff   667 May 31 10:11 ui.R

tests/testthat/shinyapp-with-absolute-paths/subdir:
total 0
-rw-r--r--  1 aron  staff  0 May 31 10:11 Genetics.txt

It looks like there might be some other special handling for the rsconnect tests; maybe there's more to do to get all the tests packaged correctly? I expect that the same issue is present for newer builds.

https://salsa.debian.org/r-pkg-team/r-cran-rsconnect/-/blob/master/debian/rules

This is the Dockerfile I used to discover the missing test files with 0.8.29:

FROM debian:unstable

RUN apt-get update && apt-get install -y \
    r-bioc-biobase \
    r-cran-biocmanager \
    r-cran-foreign \
    r-cran-knitr \
    r-cran-mass \
    r-cran-plumber \
    r-cran-rcurl \
    r-cran-reticulate \
    r-cran-rmarkdown \
    r-cran-shiny \
    r-cran-testthat \
    r-cran-webfakes \
    r-cran-withr \
    build-essential

RUN apt-get install -y r-cran-rsconnect

The suggestion to run R directly to run tests was not useful; maybe there are other set-up tasks that were not included?

docker run -it --rm -v $(pwd):/rsconnect -w /rsconnect/tests/testthat debian-rsconnect
LC_ALL=C R --no-save < test-linters.R
#> ...
#> Error in test_that("linter warns about absolute paths and relative paths",  :
#>   could not find function "test_that"
#> Execution halted

Based on my findings, closing this as a problem with the Debian rsconnect packaging. Please re-open if you feel that this is not the case and you can provide a reproducible example.

aronatkins commented 1 year ago

@tillea - is Debian packaging removing all zero-length files? That could be the cause for these test failures. Each of the files that is missing was created by touch FILENAME and added to Git as an empty file.

tillea commented 1 year ago

Am Wed, Aug 16, 2023 at 08:33:35AM -0700 schrieb Aron Atkins:

@tillea - is Debian packaging removing all zero-length files? That could be the cause for these test failures. Each of the files that is missing was created by touch FILENAME and added to Git as an empty file.

Yep, I'll check this and will fix the test with the suggested touch. Thanks a lot for your patience!

tillea commented 1 year ago

Am Wed, Aug 16, 2023 at 08:33:35AM -0700 schrieb Aron Atkins:

@tillea - is Debian packaging removing all zero-length files? That could be the cause for these test failures. Each of the files that is missing was created by touch FILENAME and added to Git as an empty file.

Fixed with

https://salsa.debian.org/r-pkg-team/r-cran-rsconnect/-/commit/4d116d90988226c0bcf5032b925d76cf99ea2902

There was obviously a similar issue before which I simply forgot ... Sorry for the noise, Andreas.

aronatkins commented 1 year ago

No worries. Happy we could discover the issue together.