ds.recodeValues.o: test development

I am have trying to develop Unit Tests for ‘ds.recodeValues.o’. But I keep getting a “object ‘age.60’ not found”. What am I missing?

Error message:

test-ds.recodeValues.o.R:30: error: recodeValues_checks
Command 'recodeValuesDS1.o("age.60", "-1,-6", "-10,-16")' failed on 'survival1': object 'age.60' not found
1: ds.recodeValues.o(var.name = "age.60", values2replace.vector = c(-1, -6), new.values.vector = c(-10, 
       -16), datasources = opals) at /home/vsts/work/1/s/tests/testthat/test-ds.recodeValues.o.R:30
2: datashield.aggregate(datasources, calltext1) at /home/vsts/work/1/s/R/ds.recodeValues.o.R:145
3: datashield.aggregate.list(datasources, calltext1)
4: datashield.command_result(opal, res, wait = TRUE)
5: datashield.command_result.list(opal, res, wait = TRUE)
6: lapply(1:length(opal), function(i) {
       datashield.command_result(opal[[i]], id[[i]], wait = wait)
   })
7: FUN(X[[i]], ...)
8: datashield.command_result(opal[[i]], id[[i]], wait = wait)
9: datashield.command_result.opal(opal[[i]], id[[i]], wait = wait)
10: stop("Command '", cmd$script, "' failed on '", opal$name, "': ", msg, call. = FALSE)

Source: https://github.com/StuartWheater/dsBetaTestClient/blob/master/tests/testthat/test-ds.recodeValues.o.R

Stuart

I expect that it will not fail if you use the name of the dataset and the dollar sign:

ds.recodeValues.o(var.name = “D$age.60”, values2replace.vector = c(-1, -6), new.values.vector = c(-10, -16), datasources = opals)

Sadly that leads to another, but different, problem.

Do I need to pre-create “D$age.60_recoded”?

test-ds.recodeValues.o.R:30: error: recodeValues_checks
Command 'messageDS.o("D$age.60_recoded")' failed on 'survival1': <no message>
1: ds.recodeValues.o(var.name = "D$age.60", values2replace.vector = c(-1, -6), new.values.vector = c(-10, 
        -16), datasources = opals) at /home/vsts/work/1/s/tests/testthat/test-ds.recodeValues.o.R:30
2: datashield.aggregate(datasources, calltext) at /home/vsts/work/1/s/R/ds.recodeValues.o.R:216
3: datashield.aggregate.list(datasources, calltext)
4: datashield.command_result(opal, res, wait = TRUE)
5: datashield.command_result.list(opal, res, wait = TRUE)
6: lapply(1:length(opal), function(i) {
       datashield.command_result(opal[[i]], id[[i]], wait = wait)
   })
7: FUN(X[[i]], ...)
8: datashield.command_result(opal[[i]], id[[i]], wait = wait)
9: datashield.command_result.opal(opal[[i]], id[[i]], wait = wait)
10: stop("Command '", cmd$script, "' failed on '", opal$name, "': ", msg, call. = FALSE)

This test works if run against Paul’s Test VM “datashield_ubuntu_development_101_QA.LD.LR.OPAL.UPDATED.211218”. I suspect the cause of the problem is that the package “dsBetaTest” on GitHub needs updating.

I have noticed that neither the older VM or updated VM has “messageDS.o” listed as a registered method within the Opal Admin Portal, but the VM datashield_ubuntu_development_101_QA.LD.LR.OPAL.UPDATED.211218 does. Could this contribute to the problem I am seeing?

Hi Stuart,

Yes, that’s right. I have just added the messageDS.o function in the dsBetaTest package (and the ds.message.o function in the client-side). Can you accept my commits and check if you still have an error?

HI, I am in process of creating a VM to test the deployment of dsBetaTest. Which has stopped working within the CI. Investigating…

Stuart

I now get a new message:

“Command ‘messageDS.o(“D$age.60_recoded”)’ failed on ‘survival1’: ‘messageDS.o’ is not an exported object from ‘namespace:dsBetaTest’”

Investigating…

Stuart

It’s not in the NAMESPACE file, so roxygen probably hasn’t been run.

OK, I will check this within my “Fork”.

Stuart