This PR allows dashes in service names, while still sanitizing them before they are used as database names. If the datastore is pre-existing, the datatabase name is assumed to be the same as the service name, and returned appropriately.
not ok 1 (mariadb:create) service with dashes in 17sec
(from function `assert_contains' in file test_helper.bash, line 13,
in test file service_create.bats, line 15)
`assert_contains "${lines[*]}" "dokku-$PLUGIN_COMMAND_PREFIX-service-with-dashes"' failed
expected dokku-mariadb-service-with-dashes to be in: MariaDB service service-with-dashes already exists
1..4 (service_list.bats)
not ok 0 (mariadb:list) with no exposed ports, no linked apps in 20sec
(from function `assert_contains' in file test_helper.bash, line 13,
in test file service_list.bats, line 14)
`assert_contains "${lines[*]}" "l mariadb:10.4.4 running - -"' failed
Waiting for container to be ready
=====> MariaDB container created: l
=====> Container Information
Config dir: /var/lib/dokku/services/mariadb/l/config
Data dir: /var/lib/dokku/services/mariadb/l/data
Dsn: mysql://mariadb:6f1af67e94077591@dokku-mariadb-l:3306/l
Exposed ports: -
Id: 65990cfa3ee1625d8b11011e3826572ef7015acc5d5e5b4716921d925500fa7b
Internal ip: 172.17.0.3
Links: -
Service root: /var/lib/dokku/services/mariadb/l
Status: running
Version: mariadb:10.4.4
expected l mariadb:10.4.4 running - - to be in: NAME VERSION STATUS EXPOSED PORTS LINKS l mariadb:10.4.4 running - - service-with-dashes mariadb:10.4.4 running - -
=====> Deleting l
=====> Stopping container
Container stopped
Removing container
Removing data
=====> MariaDB container deleted: l
not ok 1 (mariadb:list) with exposed ports in 34sec
(from function `assert_contains' in file test_helper.bash, line 13,
in test file service_list.bats, line 20)
`assert_contains "${lines[*]}" "l mariadb:10.4.4 running 3306->4242 -"' failed
Waiting for container to be ready
=====> MariaDB container created: l
=====> Container Information
Config dir: /var/lib/dokku/services/mariadb/l/config
Data dir: /var/lib/dokku/services/mariadb/l/data
Dsn: mysql://mariadb:7540abab918fda19@dokku-mariadb-l:3306/l
Exposed ports: -
Id: 2d42f94a4258835366128f649879cd1ec422e9d1ba5e2c5c177b79c2d7e8a151
Internal ip: 172.17.0.3
Links: -
Service root: /var/lib/dokku/services/mariadb/l
Status: running
Version: mariadb:10.4.4
-----> Service l exposed on port(s) [container->host]: 3306->4242
expected l mariadb:10.4.4 running 3306->4242 - to be in: NAME VERSION STATUS EXPOSED PORTS LINKS l mariadb:10.4.4 running 3306->4242 - service-with-dashes mariadb:10.4.4 running - -
=====> Deleting l
=====> Stopping container
Container stopped
Removing container
Removing data
=====> MariaDB container deleted: l
not ok 2 (mariadb:list) with linked app in 21sec
(from function `assert_contains' in file test_helper.bash, line 13,
in test file service_list.bats, line 27)
`assert_contains "${lines[*]}" "l mariadb:10.4.4 running - my_app"' failed
Waiting for container to be ready
=====> MariaDB container created: l
=====> Container Information
Config dir: /var/lib/dokku/services/mariadb/l/config
Data dir: /var/lib/dokku/services/mariadb/l/data
Dsn: mysql://mariadb:436be862c29d1f0a@dokku-mariadb-l:3306/l
Exposed ports: -
Id: a33c7e0d22d0fc94dd9bda71e4d017f69068f57b6b4d2eb6020674477d3a7ee9
Internal ip: 172.17.0.3
Links: -
Service root: /var/lib/dokku/services/mariadb/l
Status: running
Version: mariadb:10.4.4
-----> Creating my_app... done
-----> Setting config vars
DATABASE_URL: mysql://mariadb:436be862c29d1f0a@dokku-mariadb-l:3306/l
-----> Restarting app my_app
! App my_app has not been deployed
expected l mariadb:10.4.4 running - my_app to be in: NAME VERSION STATUS EXPOSED PORTS LINKS l mariadb:10.4.4 running - my_app service-with-dashes mariadb:10.4.4 running - -
Cannot delete linked service
not ok 3 (mariadb:list) when there are no services in 1sec
(from function `setup' in test file service_list.bats, line 5)
`dokku "$PLUGIN_COMMAND_PREFIX:create" l' failed
MariaDB service l already exists
Cannot delete linked service
1..4 (service_logs.bats)
not ok 0 (mariadb:logs) error when there are no arguments in 0sec
(from function `setup' in test file service_logs.bats, line 5)
`dokku "$PLUGIN_COMMAND_PREFIX:create" l' failed
MariaDB service l already exists
Cannot delete linked service
not ok 1 (mariadb:logs) error when service does not exist in 1sec
(from function `setup' in test file service_logs.bats, line 5)
`dokku "$PLUGIN_COMMAND_PREFIX:create" l' failed
MariaDB service l already exists
Cannot delete linked service
not ok 2 (mariadb:logs) success when not tailing in 1sec
(from function `setup' in test file service_logs.bats, line 5)
`dokku "$PLUGIN_COMMAND_PREFIX:create" l' failed
MariaDB service l already exists
Cannot delete linked service
not ok 3 (mariadb:logs) success when tailing in 0sec
(from function `setup' in test file service_logs.bats, line 5)
`dokku "$PLUGIN_COMMAND_PREFIX:create" l' failed
MariaDB service l already exists
Cannot delete linked service
1..8 (service_promote.bats)
not ok 0 (mariadb:promote) error when there are no arguments in 6sec
(from function `setup' in test file service_promote.bats, line 5)
`dokku "$PLUGIN_COMMAND_PREFIX:create" l' failed
MariaDB service l already exists
-----> Unsetting DATABASE_URL
-----> Restarting app my_app
! App my_app has not been deployed
=====> Deleting l
=====> Stopping container
Container stopped
Removing container
Removing data
=====> MariaDB container deleted: l
Destroying my_app (including all add-ons)
App image (dokku/my_app:latest) not found
Unlinking from service-with-dashes
App my_app has not been deployed
not ok 1 (mariadb:create) service with dashes in 17sec
(from function `assert_contains' in file test_helper.bash, line 13,
in test file service_create.bats, line 15)
`assert_contains "${lines[*]}" "dokku-$PLUGIN_COMMAND_PREFIX-service-with-dashes"' failed
expected dokku-mariadb-service-with-dashes to be in: MariaDB service service-with-dashes already exists
1..4 (service_list.bats)
not ok 0 (mariadb:list) with no exposed ports, no linked apps in 21sec
(from function `assert_contains' in file test_helper.bash, line 13,
in test file service_list.bats, line 14)
`assert_contains "${lines[*]}" "l mariadb:10.4.4 running - -"' failed
Waiting for container to be ready
=====> MariaDB container created: l
=====> Container Information
Config dir: /var/lib/dokku/services/mariadb/l/config
Data dir: /var/lib/dokku/services/mariadb/l/data
Dsn: mysql://mariadb:c45c0ff5fd9de8cd@dokku-mariadb-l:3306/l
Exposed ports: -
Id: 0c33cf5f2bba924c12fb828b44ce33cc6e2f32f456e66d2bae5d4edb4d028456
Internal ip: 172.17.0.3
Links: -
Service root: /var/lib/dokku/services/mariadb/l
Status: running
Version: mariadb:10.4.4
expected l mariadb:10.4.4 running - - to be in: NAME VERSION STATUS EXPOSED PORTS LINKS l mariadb:10.4.4 running - - service-with-dashes mariadb:10.4.4 running - -
=====> Deleting l
=====> Stopping container
Container stopped
Removing container
Removing data
=====> MariaDB container deleted: l
not ok 1 (mariadb:list) with exposed ports in 32sec
(from function `assert_contains' in file test_helper.bash, line 13,
in test file service_list.bats, line 20)
`assert_contains "${lines[*]}" "l mariadb:10.4.4 running 3306->4242 -"' failed
Waiting for container to be ready
=====> MariaDB container created: l
=====> Container Information
Config dir: /var/lib/dokku/services/mariadb/l/config
Data dir: /var/lib/dokku/services/mariadb/l/data
Dsn: mysql://mariadb:2735f9e6ae91f9a8@dokku-mariadb-l:3306/l
Exposed ports: -
Id: 2ee1e38ab8e027de1fa835f1e0abc0c51d227f05f9dc1880655bdd4e40d5b6c5
Internal ip: 172.17.0.3
Links: -
Service root: /var/lib/dokku/services/mariadb/l
Status: running
Version: mariadb:10.4.4
-----> Service l exposed on port(s) [container->host]: 3306->4242
expected l mariadb:10.4.4 running 3306->4242 - to be in: NAME VERSION STATUS EXPOSED PORTS LINKS l mariadb:10.4.4 running 3306->4242 - service-with-dashes mariadb:10.4.4 running - -
=====> Deleting l
=====> Stopping container
Container stopped
Removing container
Removing data
=====> MariaDB container deleted: l
not ok 2 (mariadb:list) with linked app in 20sec
(from function `assert_contains' in file test_helper.bash, line 13,
in test file service_list.bats, line 27)
`assert_contains "${lines[*]}" "l mariadb:10.4.4 running - my_app"' failed
Waiting for container to be ready
=====> MariaDB container created: l
=====> Container Information
Config dir: /var/lib/dokku/services/mariadb/l/config
Data dir: /var/lib/dokku/services/mariadb/l/data
Dsn: mysql://mariadb:92b1283f75d0ee4c@dokku-mariadb-l:3306/l
Exposed ports: -
Id: 4a46fa6d17e3899e95de03762a2ca3f4ab2a4a766664ecaebeeee4bf269f33fb
Internal ip: 172.17.0.3
Links: -
Service root: /var/lib/dokku/services/mariadb/l
Status: running
Version: mariadb:10.4.4
-----> Creating my_app... done
-----> Setting config vars
DATABASE_URL: mysql://mariadb:92b1283f75d0ee4c@dokku-mariadb-l:3306/l
-----> Restarting app my_app
! App my_app has not been deployed
expected l mariadb:10.4.4 running - my_app to be in: NAME VERSION STATUS EXPOSED PORTS LINKS l mariadb:10.4.4 running - my_app service-with-dashes mariadb:10.4.4 running - -
Cannot delete linked service
not ok 3 (mariadb:list) when there are no services in 1sec
(from function `setup' in test file service_list.bats, line 5)
`dokku "$PLUGIN_COMMAND_PREFIX:create" l' failed
MariaDB service l already exists
Cannot delete linked service
1..4 (service_logs.bats)
not ok 0 (mariadb:logs) error when there are no arguments in 1sec
(from function `setup' in test file service_logs.bats, line 5)
`dokku "$PLUGIN_COMMAND_PREFIX:create" l' failed
MariaDB service l already exists
Cannot delete linked service
not ok 1 (mariadb:logs) error when service does not exist in 0sec
(from function `setup' in test file service_logs.bats, line 5)
`dokku "$PLUGIN_COMMAND_PREFIX:create" l' failed
MariaDB service l already exists
Cannot delete linked service
not ok 2 (mariadb:logs) success when not tailing in 1sec
(from function `setup' in test file service_logs.bats, line 5)
`dokku "$PLUGIN_COMMAND_PREFIX:create" l' failed
MariaDB service l already exists
Cannot delete linked service
not ok 3 (mariadb:logs) success when tailing in 0sec
(from function `setup' in test file service_logs.bats, line 5)
`dokku "$PLUGIN_COMMAND_PREFIX:create" l' failed
MariaDB service l already exists
Cannot delete linked service
1..8 (service_promote.bats)
not ok 0 (mariadb:promote) error when there are no arguments in 5sec
(from function `setup' in test file service_promote.bats, line 5)
`dokku "$PLUGIN_COMMAND_PREFIX:create" l' failed
MariaDB service l already exists
-----> Unsetting DATABASE_URL
-----> Restarting app my_app
! App my_app has not been deployed
=====> Deleting l
=====> Stopping container
Container stopped
Removing container
Removing data
=====> MariaDB container deleted: l
Destroying my_app (including all add-ons)
App image (dokku/my_app:latest) not found
Unlinking from service-with-dashes
App my_app has not been deployed
This PR allows dashes in service names, while still sanitizing them before they are used as database names. If the datastore is pre-existing, the datatabase name is assumed to be the same as the service name, and returned appropriately.