Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(nginx): allow skip envsubst (#946)
* Update README.md * add test * fix: tests * fix test * fix * fix * fix * fix
- Loading branch information
Julien Bouquillon
committed
Feb 9, 2022
1 parent
6222644
commit d4e43ea
Showing
14 changed files
with
84 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
CUSTOM 404 PAGE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
// nginx/test/foo/bar/bar.js with VERSION=%%VERSION%% |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
nginx/test/index.html with VERSION=%%VERSION%% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/usr/bin/env bats | ||
|
||
load '../../.bats/common.bats.bash' | ||
|
||
setup_file() { | ||
cp -r ${BATS_TEST_DIRNAME}/fixtures-envsubst/ ${BATS_RUN_TMPDIR}/www2 | ||
|
||
docker-compose run \ | ||
--detach \ | ||
-e VERSION=x.y.z \ | ||
-e SKIP_ENVSUBST=true \ | ||
--publish 8888:80 \ | ||
--rm \ | ||
--volume ${BATS_RUN_TMPDIR}/www2:/usr/share/nginx/html \ | ||
alpine | ||
} | ||
|
||
teardown_file() { | ||
docker-compose rm -sf | ||
} | ||
|
||
@test "nginx: should NOT replace the VERSION with x.y.z in index.html" { | ||
run wget -qO - localhost:8888 | ||
assert_output "nginx/test/index.html with VERSION=%%VERSION%%" | ||
assert_success | ||
} | ||
|
||
@test "nginx: should NOT replace the VERSION with x.y.z in foo/bar/bar.js" { | ||
run wget -qO - localhost:8888/foo/bar/bar.js | ||
assert_output "// nginx/test/foo/bar/bar.js with VERSION=%%VERSION%%" ] | ||
assert_success | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
// nginx4spa/test/foo/bar/bar.js with VERSION=%%VERSION%% |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
nginx4spa/test/index.html with VERSION=%%VERSION%% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/usr/bin/env bats | ||
|
||
load '../../.bats/common.bats.bash' | ||
|
||
setup_file() { | ||
cp -r ${BATS_TEST_DIRNAME}/fixtures-envsubst/ ${BATS_RUN_TMPDIR}/www2 | ||
|
||
docker-compose run \ | ||
--detach \ | ||
-e VERSION=x.y.z \ | ||
-e SKIP_ENVSUBST=true \ | ||
--publish 8889:80 \ | ||
--rm \ | ||
--volume ${BATS_RUN_TMPDIR}/www2:/usr/share/nginx/html \ | ||
alpine | ||
} | ||
|
||
teardown_file() { | ||
docker-compose rm -sf | ||
} | ||
|
||
@test "nginx4spa: should NOT replace the VERSION with x.y.z in index.html" { | ||
run wget -qO - localhost:8889 | ||
assert_output "nginx4spa/test/index.html with VERSION=%%VERSION%%" | ||
assert_success | ||
} | ||
|
||
@test "nginx4spa: should NOT replace the VERSION with x.y.z in foo/bar/bar.js" { | ||
run wget -qO - localhost:8889/foo/bar/bar.js | ||
assert_output "// nginx4spa/test/foo/bar/bar.js with VERSION=%%VERSION%%" ] | ||
assert_success | ||
} | ||
|
||
|