Skip to content

Commit

Permalink
change aws_db_rds_create and aws_db_redshift_create to return invisble()
Browse files Browse the repository at this point in the history
- update return docs for both fxns
- change test for both fxns
  • Loading branch information
sckott committed Jan 30, 2024
1 parent 474b888 commit 313cfb6
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 22 deletions.
7 changes: 3 additions & 4 deletions R/database-rds.R
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://www.paws-r-sdk.com/docs/rds/>. 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,
Expand Down Expand Up @@ -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
Expand Down
7 changes: 3 additions & 4 deletions R/database-redshift.R
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://www.paws-r-sdk.com/docs/redshift/>. 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,
Expand All @@ -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
Expand Down
5 changes: 2 additions & 3 deletions man/aws_db_rds_create.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions man/aws_db_redshift_create.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 2 additions & 4 deletions tests/testthat/test-db-rds.R
Original file line number Diff line number Diff line change
Expand Up @@ -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", {
Expand Down
6 changes: 2 additions & 4 deletions tests/testthat/test-db-redshift.R
Original file line number Diff line number Diff line change
Expand Up @@ -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", {
Expand Down

0 comments on commit 313cfb6

Please sign in to comment.