fork 0k-charms
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

142 lines
2.2 KiB

  1. #!/bin/bash
  2. exname=$(basename $0)
  3. prefix_cmd="
  4. . /etc/shlib
  5. include common
  6. include parse
  7. . ../lib/common
  8. get_challenge_type() {
  9. local i
  10. echo \"Calling get_challenge_type\" >&2
  11. ((i=0))
  12. for arg in \"\$@\"; do
  13. echo \" arg\$((i++)):\"
  14. echo \"\$arg\" | prefix \" | \"
  15. done >&2
  16. echo \"\$GET_CHALLENGE_TYPE\"
  17. }
  18. export -f get_challenge_type
  19. "
  20. try "
  21. SERVICE_NAME='\$SERVICE_NAME'
  22. GET_CHALLENGE_TYPE=foo
  23. get_dc_env '' create bar
  24. "
  25. is errlvl 0
  26. is err part "\
  27. Calling get_challenge_type
  28. arg0:
  29. |
  30. arg1:
  31. | create
  32. arg2:
  33. | bar
  34. " RTRIM
  35. is out '$SERVICE_NAME:
  36. docker-compose:
  37. environment:
  38. CHALLENGE_TYPE: foo' RTRIM
  39. try "
  40. SERVICE_NAME='\$SERVICE_NAME'
  41. GET_CHALLENGE_TYPE=foo
  42. get_dc_env '
  43. email: foo@example.com
  44. ' create bar
  45. "
  46. is errlvl 0
  47. is err part "\
  48. Calling get_challenge_type
  49. arg0:
  50. |
  51. | email: foo@example.com
  52. |
  53. arg1:
  54. | create
  55. arg2:
  56. | bar
  57. " RTRIM
  58. is out '$SERVICE_NAME:
  59. docker-compose:
  60. environment:
  61. LETSENCRYPT_USER_MAIL: foo@example.com
  62. CHALLENGE_TYPE: foo' RTRIM
  63. try "
  64. SERVICE_NAME='\$SERVICE_NAME'
  65. GET_CHALLENGE_TYPE=foo
  66. get_dc_env '
  67. email: foo@example.com
  68. env:
  69. ' create bar
  70. " "environment def is empty"
  71. is errlvl 0
  72. is out '$SERVICE_NAME:
  73. docker-compose:
  74. environment:
  75. LETSENCRYPT_USER_MAIL: foo@example.com
  76. CHALLENGE_TYPE: foo' RTRIM
  77. try "
  78. SERVICE_NAME='\$SERVICE_NAME'
  79. GET_CHALLENGE_TYPE=foo
  80. get_dc_env '
  81. email: foo@example.com
  82. env:
  83. ignore: x
  84. ovh:
  85. foo: 1
  86. bar: 2
  87. wiz:
  88. foo: 1
  89. ' create bar
  90. " "environment def without provider"
  91. is errlvl 0
  92. is out '$SERVICE_NAME:
  93. docker-compose:
  94. environment:
  95. LETSENCRYPT_USER_MAIL: foo@example.com
  96. LEXICON_OVH_FOO: 1
  97. LEXICON_OVH_BAR: 2
  98. LEXICON_WIZ_FOO: 1
  99. LEXICON_PROVIDER: ovh
  100. CHALLENGE_TYPE: foo' RTRIM
  101. try "
  102. SERVICE_NAME='\$SERVICE_NAME'
  103. GET_CHALLENGE_TYPE=foo
  104. get_dc_env '
  105. email: foo@example.com
  106. env:
  107. ignore: y
  108. ovh:
  109. foo: 1
  110. bar: 2
  111. wiz:
  112. foo: 1
  113. provider: wiz
  114. ' create bar
  115. " "environment def with provider"
  116. is errlvl 0
  117. is out '$SERVICE_NAME:
  118. docker-compose:
  119. environment:
  120. LETSENCRYPT_USER_MAIL: foo@example.com
  121. LEXICON_OVH_FOO: 1
  122. LEXICON_OVH_BAR: 2
  123. LEXICON_WIZ_FOO: 1
  124. LEXICON_PROVIDER: wiz
  125. CHALLENGE_TYPE: foo' RTRIM