From d8658bd8d9825e7f9dc0c183b76e8b85610b07c8 Mon Sep 17 00:00:00 2001 From: Thomas LEVEIL Date: Sat, 7 Jan 2017 23:50:54 +0100 Subject: [PATCH] TEST: wildcards-hosts.bats - add a test which uses regexp end-of-string --- test/wildcard-hosts.bats | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/test/wildcard-hosts.bats b/test/wildcard-hosts.bats index ce9e3aa..826009e 100644 --- a/test/wildcard-hosts.bats +++ b/test/wildcard-hosts.bats @@ -43,8 +43,8 @@ function setup { @test "[$TEST_FILE] VIRTUAL_HOST=~^foo\.bar\..*\.bats" { # WHEN - prepare_web_container bats-wildcard-hosts-2 80 -e VIRTUAL_HOST=~^foo\.bar\..*\.bats - dockergen_wait_for_event $SUT_CONTAINER start bats-wildcard-hosts-2 + prepare_web_container bats-wildcard-hosts-3 80 -e VIRTUAL_HOST=~^foo\.bar\..*\.bats + dockergen_wait_for_event $SUT_CONTAINER start bats-wildcard-hosts-3 sleep 1 # THEN @@ -55,6 +55,20 @@ function setup { } +@test "[$TEST_FILE] VIRTUAL_HOST=~^foo\.bar\..*\.bats$" { + # WHEN + prepare_web_container bats-wildcard-hosts-4 80 -e VIRTUAL_HOST=~^foo\.bar\..*\.bats$ + dockergen_wait_for_event $SUT_CONTAINER start bats-wildcard-hosts-4 + sleep 1 + + # THEN + assert_200 foo.bar.whatever.bats + assert_200 foo.bar.why.not.bats + assert_503 foo.bar.why.not.bats-to-infinity-and-beyond + assert_503 unexpected.host.bats + +} + @test "[$TEST_FILE] stop all bats containers" { stop_bats_containers }