From 313cfb6942dcda525332d369dc155f1102e9f00e Mon Sep 17 00:00:00 2001 From: Scott Chamberlain Date: Tue, 30 Jan 2024 10:06:49 -0800 Subject: [PATCH] change aws_db_rds_create and aws_db_redshift_create to return invisble() - update return docs for both fxns - change test for both fxns --- R/database-rds.R | 7 +++---- R/database-redshift.R | 7 +++---- man/aws_db_rds_create.Rd | 5 ++--- man/aws_db_redshift_create.Rd | 5 ++--- tests/testthat/test-db-rds.R | 6 ++---- tests/testthat/test-db-redshift.R | 6 ++---- 6 files changed, 14 insertions(+), 22 deletions(-) diff --git a/R/database-rds.R b/R/database-rds.R index bde9ba2..bf36425 100644 --- a/R/database-rds.R +++ b/R/database-rds.R @@ -105,9 +105,8 @@ aws_db_rds_con <- function( #' available for returning. That wait can be around 5 - 7 minutes. You can #' instead set `wait = FALSE` and then check on the status of the instance #' yourself in the AWS dashboard. -#' @return a list with methods for interfacing with RDS; -#' see . also prints useful -#' connection information after instance is available. +#' @return returns `NULL`, this function called for the side effect of +#' creating an RDS instance aws_db_rds_create <- function(id, class, user = NULL, pwd = NULL, dbname = "dev", engine = "mariadb", storage = 20, @@ -154,7 +153,7 @@ aws_db_rds_create <- ) } if (verbose) info(id, instance_con_info, "aws_db_rds_con") - return(env64$rds) + invisible() } #' Get the `paws` RDS client diff --git a/R/database-redshift.R b/R/database-redshift.R index 59b04f2..c23962f 100644 --- a/R/database-redshift.R +++ b/R/database-redshift.R @@ -93,9 +93,8 @@ aws_db_redshift_con <- function(user, pwd, id = NULL, host = NULL, port = NULL, #' @note See above link to `create_cluster` docs for details on requirements #' for each parameter #' @inheritSection aws_db_rds_create Waiting -#' @return a list with methods for interfacing with Redshift; -#' see . also prints useful -#' connection information after cluster is available. +#' @return returns `NULL`, this function called for the side effect of +#' creating an Redshift instance aws_db_redshift_create <- function(id, user, pwd, dbname = "dev", cluster_type = "multi-node", node_type = "dc2.large", number_nodes = 2, @@ -113,7 +112,7 @@ aws_db_redshift_create <- wait_for_cluster(id) } if (verbose) info(id, cluster_con_info, "aws_db_redshift_con") - return(env64$redshift) + invisible() } #' Get the `paws` Redshift client diff --git a/man/aws_db_rds_create.Rd b/man/aws_db_rds_create.Rd index 0324bb7..3cd4124 100644 --- a/man/aws_db_rds_create.Rd +++ b/man/aws_db_rds_create.Rd @@ -68,9 +68,8 @@ in AWS Secrets Manager? default: \code{TRUE}} \href{https://www.paws-r-sdk.com/docs/rds_create_db_instance/}{create_db_instance}} } \value{ -a list with methods for interfacing with RDS; -see \url{https://www.paws-r-sdk.com/docs/rds/}. also prints useful -connection information after instance is available. +returns \code{NULL}, this function called for the side effect of +creating an RDS instance } \description{ Create an RDS cluster diff --git a/man/aws_db_redshift_create.Rd b/man/aws_db_redshift_create.Rd index 40c5d17..bad3c5e 100644 --- a/man/aws_db_redshift_create.Rd +++ b/man/aws_db_redshift_create.Rd @@ -58,9 +58,8 @@ until the cluster is available. If \code{wait=FALSE} use \href{https://www.paws-r-sdk.com/docs/redshift_create_cluster/}{create_cluster}} } \value{ -a list with methods for interfacing with Redshift; -see \url{https://www.paws-r-sdk.com/docs/redshift/}. also prints useful -connection information after cluster is available. +returns \code{NULL}, this function called for the side effect of +creating an Redshift instance } \description{ Create a Redshift cluster diff --git a/tests/testthat/test-db-rds.R b/tests/testthat/test-db-rds.R index ff3fb75..7c266c2 100644 --- a/tests/testthat/test-db-rds.R +++ b/tests/testthat/test-db-rds.R @@ -10,10 +10,8 @@ test_that("aws_db_rds_create", { ) }) - # Note: the paws RDS client is just a list of fxns, hard - # to test it - expect_type(z, "list") - expect_type(z[[1]], "closure") + # retuns NULL b/c invisible() + expect_null(z) }) test_that("aws_db_rds_client", { diff --git a/tests/testthat/test-db-redshift.R b/tests/testthat/test-db-redshift.R index 3755065..f081b60 100644 --- a/tests/testthat/test-db-redshift.R +++ b/tests/testthat/test-db-redshift.R @@ -10,10 +10,8 @@ test_that("aws_db_redshift_create", { ) }) - # Note: the paws Redshift client is just a list of fxns, hard - # to test it - expect_type(z, "list") - expect_type(z[[1]], "closure") + # retuns NULL b/c invisible() + expect_null(z) }) test_that("aws_db_redshift_client", {