|
@ -118,9 +118,13 @@ EOF2 |
|
|
. "$tprog" |
|
|
. "$tprog" |
|
|
|
|
|
|
|
|
_setup_state_dir |
|
|
_setup_state_dir |
|
|
test "\$(get_docker_compose_mixin_from_metadata testcharm)" == "entrypoint: any |
|
|
|
|
|
volumes: |
|
|
|
|
|
- /any:/vol" |
|
|
|
|
|
|
|
|
out="\$(get_docker_compose_mixin_from_metadata testcharm)" |
|
|
|
|
|
test "\$out" == "volumes: |
|
|
|
|
|
- /any:/vol |
|
|
|
|
|
entrypoint: any" || { |
|
|
|
|
|
echo -e "** get_docker_compose_mixin_from_metadata testcharm:\n\$out" |
|
|
|
|
|
exit 1 |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
## -- image |
|
|
## -- image |
|
|
|
|
|
|
|
@ -368,6 +372,47 @@ EOF |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function test_yaml_key_val_str { |
|
|
|
|
|
|
|
|
|
|
|
init_test |
|
|
|
|
|
|
|
|
|
|
|
assert_list <<EOF |
|
|
|
|
|
|
|
|
|
|
|
### Testing yaml_key_val_str |
|
|
|
|
|
|
|
|
|
|
|
## -- basic example |
|
|
|
|
|
|
|
|
|
|
|
. "$tprog" |
|
|
|
|
|
|
|
|
|
|
|
_setup_state_dir |
|
|
|
|
|
out="\$(yaml_key_val_str "a" "data: | |
|
|
|
|
|
hello |
|
|
|
|
|
multi |
|
|
|
|
|
line |
|
|
|
|
|
b: |
|
|
|
|
|
x: 1 |
|
|
|
|
|
y: 2 |
|
|
|
|
|
")" |
|
|
|
|
|
|
|
|
|
|
|
test "\$out" == "a: |
|
|
|
|
|
data: 'hello |
|
|
|
|
|
|
|
|
|
|
|
multi |
|
|
|
|
|
|
|
|
|
|
|
line |
|
|
|
|
|
|
|
|
|
|
|
' |
|
|
|
|
|
b: |
|
|
|
|
|
x: 1 |
|
|
|
|
|
y: 2" || { |
|
|
|
|
|
echo -e "** yaml_key_val_str:\n\$out" |
|
|
|
|
|
exit 1 |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
EOF |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function test_get_compose_service_def { |
|
|
function test_get_compose_service_def { |
|
|
|
|
|
|
|
@ -412,8 +457,12 @@ EOF2 |
|
|
|
|
|
|
|
|
_setup_state_dir |
|
|
_setup_state_dir |
|
|
COMPOSE_YML_FILE=$test_tmpdir/compose.yml |
|
|
COMPOSE_YML_FILE=$test_tmpdir/compose.yml |
|
|
test "\$(get_compose_service_def toto)" == "blabla: xxx |
|
|
|
|
|
charm: www" |
|
|
|
|
|
|
|
|
out="\$(get_compose_service_def toto)" |
|
|
|
|
|
test "\$out" == "charm: www |
|
|
|
|
|
blabla: xxx" || { |
|
|
|
|
|
echo -e "** get_compose_service_def toto:\n\$out" |
|
|
|
|
|
exit 1 |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
## -- Addition of default charm |
|
|
## -- Addition of default charm |
|
|
|
|
|
|
|
@ -962,7 +1011,38 @@ function test_get_docker_compose_2() { |
|
|
|
|
|
|
|
|
assert_list <<EOF |
|
|
assert_list <<EOF |
|
|
|
|
|
|
|
|
|
|
|
## -- Simple |
|
|
|
|
|
|
|
|
|
|
|
export CHARM_STORE=$test_tmpdir |
|
|
|
|
|
mkdir -p $test_tmpdir/{www,mysql,pg} |
|
|
|
|
|
touch $test_tmpdir/www/metadata.yml |
|
|
|
|
|
touch $test_tmpdir/mysql/metadata.yml |
|
|
|
|
|
|
|
|
|
|
|
cat <<EOF2 > $test_tmpdir/compose.yml |
|
|
|
|
|
app: |
|
|
|
|
|
charm: app |
|
|
|
|
|
relations: |
|
|
|
|
|
web-proxy: |
|
|
|
|
|
www: |
|
|
|
|
|
user: toto |
|
|
|
|
|
db: mysql |
|
|
|
|
|
EOF2 |
|
|
|
|
|
|
|
|
|
|
|
. "$tprog" |
|
|
|
|
|
COMPOSE_YML_FILE=$test_tmpdir/compose.yml |
|
|
|
|
|
_setup_state_dir |
|
|
|
|
|
|
|
|
|
|
|
out=\$(_get_docker_compose_links "app") |
|
|
|
|
|
test "\$out" == "app: |
|
|
|
|
|
links: |
|
|
|
|
|
- www |
|
|
|
|
|
- mysql" || { |
|
|
|
|
|
echo -e "** _get_docker_compose_links:\n\$out"; exit 1 |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## -- reverse-tech-dep |
|
|
## -- reverse-tech-dep |
|
|
|
|
|
|
|
|
export CHARM_STORE=$test_tmpdir |
|
|
export CHARM_STORE=$test_tmpdir |
|
|
mkdir -p $test_tmpdir/{www,mysql} |
|
|
mkdir -p $test_tmpdir/{www,mysql} |
|
|
cat <<EOF2 > $test_tmpdir/www/metadata.yml |
|
|
cat <<EOF2 > $test_tmpdir/www/metadata.yml |
|
|