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

Snapshot updates for rcc-full ({"config":{"os":"ubuntu-22.04","r":"release","test-src":"test-mysql","covr":true,"desc":"MySQL with covr"}}) #2110

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ jobs:
- {os: ubuntu-20.04, r: 'release', test-src: 'test-mssql', covr: false, desc: 'SQL Server without covr' }
- {os: ubuntu-22.04, r: 'release', test-src: 'test-postgres', covr: true, desc: 'Postgres with covr' }
- {os: ubuntu-22.04, r: 'release', test-src: 'test-maria', covr: true, desc: 'MariaDB with covr' }
- {os: ubuntu-22.04, r: 'release', test-src: 'test-mysql-maria', covr: true, desc: 'MySQL with covr' }
- {os: ubuntu-22.04, r: 'release', test-src: 'test-mysql', covr: true, desc: 'MySQL with covr' }
- {os: ubuntu-22.04, r: 'release', test-src: 'test-duckdb', covr: true, desc: 'DuckDB with covr' }
- {os: ubuntu-22.04, r: 'release', test-src: 'test-sqlite', covr: true, desc: 'SQLite with covr' }
# End custom: matrix elements
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/custom/after-install/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ runs:
mariadb-version: 10.9

- uses: ankane/setup-mysql@v1
if: env.DM_TEST_SRC == 'test-mysql-maria'
if: env.DM_TEST_SRC == 'test-mysql'
with:
mysql-version: "8.0"

- name: Create database (MariaDB), set it to UTF-8, add time zone info
if: env.DM_TEST_SRC == 'test-maria' || env.DM_TEST_SRC == 'test-mysql-maria'
if: env.DM_TEST_SRC == 'test-maria' || env.DM_TEST_SRC == 'test-mysql'
run: |
mysql -e "CREATE DATABASE IF NOT EXISTS test; ALTER DATABASE test CHARACTER SET 'utf8'; FLUSH PRIVILEGES;"
shell: bash
Expand Down
26 changes: 18 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@ all: qtest
# Quiet tests
# Run with make -j $(nproc) -O
# or with pmake
qtest: qtest-df qtest-sqlite qtest-postgres qtest-mssql qtest-duckdb qtest-maria
qtest: qtest-df qtest-sqlite qtest-postgres qtest-mssql qtest-duckdb qtest-maria qtest-mysql

# Progress tests
test: test-df test-sqlite test-postgres test-mssql test-duckdb test-maria
test: test-df test-sqlite test-postgres test-mssql test-duckdb test-maria test-mysql

# Testing with lazytest
ltest: ltest-df ltest-sqlite ltest-postgres ltest-mssql ltest-duckdb ltest-maria
ltest: ltest-df ltest-sqlite ltest-postgres ltest-mssql ltest-duckdb ltest-maria ltest-mysql

# Silent testing
stest: stest-df stest-sqlite stest-postgres stest-mssql stest-duckdb stest-maria
stest: stest-df stest-sqlite stest-postgres stest-mssql stest-duckdb stest-maria stest-mysql

# Connectivity tests
connect: connect-sqlite connect-postgres connect-mssql connect-duckdb connect-maria
connect: connect-sqlite connect-postgres connect-mssql connect-duckdb connect-maria connect-mysql

qtest-%:
DM_TEST_SRC=$@ time R -q -e 'options("crayon.enabled" = TRUE); Sys.setenv(TESTTHAT_PARALLEL = FALSE); testthat::test_local(filter = "${DM_TEST_FILTER}")'
Expand All @@ -32,10 +32,20 @@ ltest-%:
connect-%:
DM_TEST_SRC=$@ R -q -e 'suppressMessages(pkgload::load_all()); my_test_con()'

db-init-maria:
while ! R -q -e 'suppressMessages(pkgload::load_all()); DBI::dbExecute(test_src_maria(root = TRUE)$$con, "GRANT ALL ON *.* TO '"'"'compose'"'"'@'"'"'%'"'"';"); DBI::dbExecute(test_src_maria()$$con, "FLUSH PRIVILEGES")'; do sleep 1; done

db-init-mysql:
while ! R -q -e 'suppressMessages(pkgload::load_all()); DBI::dbExecute(test_src_mysql(root = TRUE)$$con, "GRANT ALL ON *.* TO '"'"'compose'"'"'@'"'"'%'"'"';"); DBI::dbExecute(test_src_mysql()$$con, "FLUSH PRIVILEGES")'; do sleep 1; done

db-init-mssql:
while ! R -q -e 'suppressMessages(pkgload::load_all()); DBI::dbExecute(test_src_mssql(FALSE)$$con, "CREATE DATABASE test")'; do sleep 1; done

db-init: db-init-maria db-init-mysql db-init-mssql

db-start:
docker-compose up -d --force-recreate
R -q -e 'suppressMessages(pkgload::load_all()); DBI::dbExecute(test_src_maria(root = TRUE)$$con, "GRANT ALL ON *.* TO '"'"'compose'"'"'@'"'"'%'"'"';"); DBI::dbExecute(test_src_maria()$$con, "FLUSH PRIVILEGES")'
R -q -e 'suppressMessages(pkgload::load_all()); DBI::dbExecute(test_src_mssql(FALSE)$$con, "CREATE DATABASE test")'
docker-compose up -d --force-recreate --wait
$(MAKE) db-init

db-restart:
docker-compose up -d
Expand Down
5 changes: 4 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,20 @@ volumes:
driver: local
maria-db:
driver: local
mysql-db:
driver: local
services:
# https://www.beekeeperstudio.io/blog/how-to-use-mariadb-with-docker
mysql:
# FIXME: Still need to add Makefile rules to provision MySQL database
container_name: mysql
image: mysql
environment:
MYSQL_ROOT_PASSWORD: "YourStrong!Passw0rd"
MYSQL_DATABASE: test
MYSQL_USER: compose
MYSQL_PASSWORD: "YourStrong!Passw0rd"
volumes:
- mysql-db:/var/lib/mysql
ports:
- "3307:3306"
maria:
Expand Down
126 changes: 0 additions & 126 deletions tests/testthat/_snaps/disentangle.md
Original file line number Diff line number Diff line change
@@ -1,131 +1,5 @@
# dm_disentangle() works

Code
dm_disentangle(dm_for_filter_w_cycle(), tf_1) %>% dm_get_all_fks()
Message
Replaced table `tf_3` with `tf_3-1`, `tf_3-2`.
Replaced table `tf_4` with `tf_4-1`, `tf_4-2`.
Replaced table `tf_5` with `tf_5-1`, `tf_5-2`.
Replaced table `tf_6` with `tf_6-1`, `tf_6-2`.
Replaced table `tf_7` with `tf_7-1`, `tf_7-2`.
Output
# A tibble: 11 x 5
child_table child_fk_cols parent_table parent_key_cols on_delete
<chr> <keys> <chr> <keys> <chr>
1 tf_2 d tf_1 a no_action
2 tf_7-1 q tf_2 c no_action
3 tf_4-1 j, j1 tf_3-1 f, f1 no_action
4 tf_2 e, e1 tf_3-2 f, f1 no_action
5 tf_4-2 j, j1 tf_3-2 f, f1 no_action
6 tf_5-1 l tf_4-1 h cascade
7 tf_5-2 l tf_4-2 h cascade
8 tf_5-1 m tf_6-1 n no_action
9 tf_5-2 m tf_6-2 n no_action
10 tf_6-1 o tf_7-1 p no_action
11 tf_6-2 o tf_7-2 p no_action
Code
dm_disentangle(dm_for_filter_w_cycle(), tf_5) %>% dm_get_all_fks()
Message
Replaced table `tf_1` with `tf_1-1`, `tf_1-2`.
Replaced table `tf_2` with `tf_2-1`, `tf_2-2`.
Replaced table `tf_3` with `tf_3-1`, `tf_3-2`.
Replaced table `tf_4` with `tf_4-1`, `tf_4-2`.
Replaced table `tf_6` with `tf_6-1`, `tf_6-2`.
Replaced table `tf_7` with `tf_7-1`, `tf_7-2`.
Output
# A tibble: 12 x 5
child_table child_fk_cols parent_table parent_key_cols on_delete
<chr> <keys> <chr> <keys> <chr>
1 tf_2-1 d tf_1-1 a no_action
2 tf_2-2 d tf_1-2 a no_action
3 tf_7-1 q tf_2-1 c no_action
4 tf_7-2 q tf_2-2 c no_action
5 tf_4-1 j, j1 tf_3-1 f, f1 no_action
6 tf_2-1 e, e1 tf_3-1 f, f1 no_action
7 tf_2-2 e, e1 tf_3-2 f, f1 no_action
8 tf_4-2 j, j1 tf_3-2 f, f1 no_action
9 tf_5 l tf_4-1 h cascade
10 tf_5 m tf_6-2 n no_action
11 tf_6-1 o tf_7-1 p no_action
12 tf_6-2 o tf_7-2 p no_action
Code
dm_disentangle(entangled_dm(), a, quiet = TRUE) %>% dm_get_all_fks()
Output
# A tibble: 22 x 5
child_table child_fk_cols parent_table parent_key_cols on_delete
<chr> <keys> <chr> <keys> <chr>
1 a a b-1 b no_action
2 a a c-2 c no_action
3 b-1 b d-1 d no_action
4 c-1 c d-1 d no_action
5 c-2 c d-2 d no_action
6 b-2 b d-2 d no_action
7 d-1 d e-1 e no_action
8 d-2 d e-3 e no_action
9 d-1 d f-2 f no_action
10 d-2 d f-4 f no_action
# i 12 more rows
Code
dm_disentangle(entangled_dm(), c) %>% dm_get_all_fks()
Message
Replaced table `a` with `a-1`, `a-2`.
Replaced table `b` with `b-1`, `b-2`.
Replaced table `d` with `d-1`, `d-2`.
Replaced table `e` with `e-1`, `e-2`, `e-3`, `e-4`.
Replaced table `f` with `f-1`, `f-2`, `f-3`, `f-4`.
Replaced table `g` with `g-1`, `g-2`, `g-3`, `g-4`.
Replaced table `h` with `h-1`, `h-2`, `h-3`, `h-4`.
Output
# A tibble: 22 x 5
child_table child_fk_cols parent_table parent_key_cols on_delete
<chr> <keys> <chr> <keys> <chr>
1 a-1 a b-1 b no_action
2 a-2 a b-2 b no_action
3 a-1 a c c no_action
4 b-1 b d-1 d no_action
5 c c d-2 d no_action
6 b-2 b d-2 d no_action
7 d-1 d e-1 e no_action
8 d-2 d e-3 e no_action
9 d-1 d f-2 f no_action
10 d-2 d f-4 f no_action
# i 12 more rows
Code
dm_disentangle(entangled_dm_2(), a) %>% dm_get_all_fks()
Message
Replaced table `b` with `b-1`, `b-2`.
Replaced table `c` with `c-1`, `c-2`.
Replaced table `d` with `d-1`, `d-2`.
Replaced table `e` with `e-1`, `e-2`.
Output
# A tibble: 9 x 5
child_table child_fk_cols parent_table parent_key_cols on_delete
<chr> <keys> <chr> <keys> <chr>
1 a a d-1 d no_action
2 b-1 b d-1 d no_action
3 c-1 c d-1 d no_action
4 b-2 b d-2 d no_action
5 c-2 c d-2 d no_action
6 d-1 d e-1 e no_action
7 a a e-2 e no_action
8 d-2 d e-2 e no_action
9 f f g g no_action
Code
dm_disentangle(entangled_dm_2(), d, quiet = TRUE) %>% dm_get_all_fks()
Output
# A tibble: 7 x 5
child_table child_fk_cols parent_table parent_key_cols on_delete
<chr> <keys> <chr> <keys> <chr>
1 a-1 a d d no_action
2 b b d d no_action
3 c c d d no_action
4 a-1 a e-1 e no_action
5 d d e-2 e no_action
6 a-2 a e-2 e no_action
7 f f g g no_action

---

You can't call `dm_disentangle()` on a `dm_zoomed`. Consider using one of `dm_update_zoomed()`, `dm_insert_zoomed()` or `dm_discard_zoomed()` first.

---
Expand Down
Loading