Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Schneider committed Jun 9, 2022
1 parent c83cafb commit b484203
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
18 changes: 18 additions & 0 deletions server/http_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -710,3 +710,21 @@ func TestHTTPServer_parseDuration(t *testing.T) {
t.Errorf("%#v", logs[0].Message)
}
}

func TestHTTPServer_EnvironmentBlocks(t *testing.T) {
helper := test.New(t)
client := newClient()

shutdown, _ := newCouper("testdata/integration/environment/01_couper.hcl", test.New(t))
defer shutdown()

req, err := http.NewRequest(http.MethodGet, "http://anyserver:8080/test", nil)
helper.Must(err)

res, err := client.Do(req)
helper.Must(err)

if res.StatusCode != http.StatusOK {
t.Errorf("Unexpected status code: %d", res.StatusCode)
}
}
21 changes: 21 additions & 0 deletions server/testdata/integration/environment/01_couper.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# environment "test" {
# server {
# endpoint "/test" {
# proxy {
# environment "test" {
# url = "${env.COUPER_TEST_BACKEND_ADDR}/anything"
# }
# environment "prod" {
# access_control = ["auth"]
# url = "${env.COUPER_TEST_BACKEND_ADDR}"
# }
# }
# }
# }
# }

environment "prod" {
server {}
}

de

0 comments on commit b484203

Please sign in to comment.