Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update tests to be semantic with egress type space naming #585

Merged
merged 1 commit into from
Nov 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions ci/test-space-egress/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ Tests will be deployed by [cg-deploy-cf's ci pipeline](../ci/pipeline.yml) and t

Test org and spaces will be defined by [cg-deploy-cf's test-suite terraform](../terraform/) and deployed to each instance of CF with three spaces
- _Org:_ `platform-egress-test`
- _Space:_ `no-egress`
- _ASG:_ `internal_only`
- _Space:_ `closed-egress`
- _ASG:_ `internal_only`
- _ASG:_ `services_network`
- _Space:_ `open-egress`
- _ASG:_ `internal_only`
- _ASG:_ `services_network`
- _ASG:_ `dns`
- _Space:_ `restricted-egress`
- _ASG:_ `dns`
- _ASG:_ `trusted_local_networks`
- _Space:_ `public-egress`
- _ASG:_ `dns`
- _ASG:_ `trusted_local_networks`
- _ASG:_ `public_networks`

Tests will be defined in a test matrix file by the space, endpoint, HTTP status code, and an optional HTTP response.
Expand All @@ -31,15 +31,15 @@ Tests will be defined in a test matrix file by the space, endpoint, HTTP status

|Space|Endpoint|HTTP STATUS CODE|RESPONSE BODY|
|-----|--------|----------------|-------------|
|`no-egress`| `/`|`200`|`"Success"`|
|`no-egress`| `/test-internal-network`|`500`||
|`no-egress`| `/test-external-network`|`500`||
|`closed-egress`| `/`|`200`|`"Success"`|
|`closed-egress`| `/test-internal-network`|`200`|`"Success"`|
|`closed-egress`| `/test-internal-network`|`500`||
|`closed-egress`| `/test-external-network`|`500`||
|`open-egress`| `/`|`200`|`"Success"`|
|`open-egress`| `/test-internal-network`|`200`|`"Success"`|
|`open-egress`| `/test-external-network`|`200`|`"Success"`|
|`restricted-egress`| `/`|`200`|`"Success"`|
|`restricted-egress`| `/test-internal-network`|`200`|`"Success"`|
|`restricted-egress`| `/test-external-network`|`500`||
|`public-egress`| `/`|`200`|`"Success"`|
|`public-egress`| `/test-internal-network`|`200`|`"Success"`|
|`public-egress`| `/test-external-network`|`200`|`"Success"`|


### Deployment
Expand Down
8 changes: 4 additions & 4 deletions ci/test-space-egress/clean.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ set -e

ORG=$CF_ORG
DOMAIN=$CF_APP_DOMAIN
SPACE_NO_EGRESS="no-egress"
SPACE_CLOSED_EGRESS="closed-egress"
SPACE_OPEN_EGRESS="open-egress"
SPACE_RESTRICTED_EGRESS="restricted-egress"
SPACE_PUBLIC_EGRESS="public-egress"


## CF Auth
Expand All @@ -15,7 +15,7 @@ cf api "${CF_API_URL}"

## Delete apps

for space in $SPACE_NO_EGRESS $SPACE_CLOSED_EGRESS $SPACE_OPEN_EGRESS
for space in $SPACE_CLOSED_EGRESS $SPACE_RESTRICTED_EGRESS $SPACE_PUBLIC_EGRESS
do
# Change to target space
cf target -o $ORG -s $space
Expand All @@ -32,7 +32,7 @@ done

## Delete spaces

for space in $SPACE_NO_EGRESS $SPACE_CLOSED_EGRESS $SPACE_OPEN_EGRESS
for space in $SPACE_CLOSED_EGRESS $SPACE_RESTRICTED_EGRESS $SPACE_PUBLIC_EGRESS
do
cf delete-space $space -o $ORG -f
done
Expand Down
20 changes: 10 additions & 10 deletions ci/test-space-egress/deploy-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ set -e
ORG=$CF_ORG
QUOTA=$CF_QUOTA
DOMAIN=$CF_APP_DOMAIN
SPACE_NO_EGRESS="no-egress"
SPACE_CLOSED_EGRESS="closed-egress"
SPACE_OPEN_EGRESS="open-egress"
SPACE_RESTRICTED_EGRESS="restricted-egress"
SPACE_PUBLIC_EGRESS="public-egress"
ASG_TRUSTED_LOCAL_NETWORKS_INTERNAL_EGRESS="trusted_local_networks_egress"
ASG_PUBLIC_NETWORKS_EGRESS="public_networks_egress"
ASG_DNS_EGRESS="dns_egress"
Expand Down Expand Up @@ -41,24 +41,24 @@ cf set-org-quota $ORG $QUOTA

## Create spaces

for space in $SPACE_NO_EGRESS $SPACE_CLOSED_EGRESS $SPACE_OPEN_EGRESS
for space in $SPACE_CLOSED_EGRESS $SPACE_RESTRICTED_EGRESS $SPACE_PUBLIC_EGRESS
do
cf create-space $space -o $ORG
done

## Apply security groups

### Bind to closed egress space
cf bind-security-group $ASG_TRUSTED_LOCAL_NETWORKS_INTERNAL_EGRESS $ORG --space $SPACE_CLOSED_EGRESS
cf bind-security-group $ASG_TRUSTED_LOCAL_NETWORKS_INTERNAL_EGRESS $ORG --space $SPACE_RESTRICTED_EGRESS

### Bind to open egress space
cf bind-security-group $ASG_TRUSTED_LOCAL_NETWORKS_INTERNAL_EGRESS $ORG --space $SPACE_OPEN_EGRESS
cf bind-security-group $ASG_PUBLIC_NETWORKS_EGRESS $ORG --space $SPACE_OPEN_EGRESS
cf bind-security-group $ASG_DNS_EGRESS $ORG --space $SPACE_OPEN_EGRESS
cf bind-security-group $ASG_TRUSTED_LOCAL_NETWORKS_INTERNAL_EGRESS $ORG --space $SPACE_PUBLIC_EGRESS
cf bind-security-group $ASG_PUBLIC_NETWORKS_EGRESS $ORG --space $SPACE_PUBLIC_EGRESS
cf bind-security-group $ASG_DNS_EGRESS $ORG --space $SPACE_PUBLIC_EGRESS

## Create databases

for space in $SPACE_NO_EGRESS $SPACE_CLOSED_EGRESS $SPACE_OPEN_EGRESS
for space in $SPACE_CLOSED_EGRESS $SPACE_RESTRICTED_EGRESS $SPACE_PUBLIC_EGRESS
do
# target the correct space
cf target -o $ORG -s $space
Expand All @@ -69,7 +69,7 @@ done

## Wait for databases to create

for space in $SPACE_NO_EGRESS $SPACE_CLOSED_EGRESS $SPACE_OPEN_EGRESS
for space in $SPACE_CLOSED_EGRESS $SPACE_RESTRICTED_EGRESS $SPACE_PUBLIC_EGRESS
do
# target the correct space
cf target -o $ORG -s $space
Expand All @@ -80,7 +80,7 @@ done

## Push apps

for space in $SPACE_NO_EGRESS $SPACE_CLOSED_EGRESS $SPACE_OPEN_EGRESS
for space in $SPACE_CLOSED_EGRESS $SPACE_RESTRICTED_EGRESS $SPACE_PUBLIC_EGRESS
do
# target the correct space
cf target -o $ORG -s $space
Expand Down
14 changes: 7 additions & 7 deletions ci/test-space-egress/test-matrix
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
no-egress,/test,200,"Success"
no-egress,/test-internal-networks,500,""
no-egress,/test-external-networks,500,""
closed-egress,/test,200,"Success"
closed-egress,/test-internal-networks,200,"Success"
closed-egress,/test-internal-networks,500,""
closed-egress,/test-external-networks,500,""
open-egress,/test,200,"Success"
open-egress,/test-internal-networks,200,"Success"
open-egress,/test-external-networks,200,"Success"
restricted-egress,/test,200,"Success"
restricted-egress,/test-internal-networks,200,"Success"
restricted-egress,/test-external-networks,500,""
public-egress,/test,200,"Success"
public-egress,/test-internal-networks,200,"Success"
public-egress,/test-external-networks,200,"Success"